@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,42 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
+
|
|
4
|
+
import Breadcrumbs from './Breadcrumbs';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/Breadcrumbs/Breadcrumb.Item',
|
|
8
|
+
component: Breadcrumbs.Item,
|
|
9
|
+
decorators: [
|
|
10
|
+
Story => (
|
|
11
|
+
<Breadcrumbs>
|
|
12
|
+
<Story />
|
|
13
|
+
</Breadcrumbs>
|
|
14
|
+
)
|
|
15
|
+
],
|
|
16
|
+
argTypes: {
|
|
17
|
+
href: argTypes.href({type: {name: 'string', required: true}}),
|
|
18
|
+
isHidden: {
|
|
19
|
+
description: 'Applies a visually-hidden CSS class',
|
|
20
|
+
control: 'boolean'
|
|
21
|
+
},
|
|
22
|
+
linkComponent: argTypes.linkComponent(),
|
|
23
|
+
children: argTypes.children()
|
|
24
|
+
},
|
|
25
|
+
args: {
|
|
26
|
+
href: '#foo',
|
|
27
|
+
children: 'Category'
|
|
28
|
+
}
|
|
29
|
+
} satisfies Meta<typeof Breadcrumbs.Item>;
|
|
30
|
+
|
|
31
|
+
export default meta;
|
|
32
|
+
type Story = StoryObj<typeof meta>;
|
|
33
|
+
|
|
34
|
+
export const Default: Story = {
|
|
35
|
+
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const Hidden: Story = {
|
|
39
|
+
args: {
|
|
40
|
+
isHidden: true
|
|
41
|
+
}
|
|
42
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import ButtonGroup from './ButtonGroup';
|
|
3
|
+
import Button from '../Button/Button';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Components/Buttons/ButtonGroup',
|
|
7
|
+
component: ButtonGroup,
|
|
8
|
+
parameters: {
|
|
9
|
+
controls: { sort: 'alpha' }
|
|
10
|
+
},
|
|
11
|
+
argTypes: {
|
|
12
|
+
isInline: {
|
|
13
|
+
description: 'Force inline buttons on small screens',
|
|
14
|
+
control: 'boolean',
|
|
15
|
+
table: {
|
|
16
|
+
type: {
|
|
17
|
+
summary: 'boolean'
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
args: {
|
|
23
|
+
children: <>
|
|
24
|
+
<Button buttonStyle="secondary">Button one</Button>
|
|
25
|
+
<Button buttonStyle="secondary">Button two</Button>
|
|
26
|
+
<Button buttonStyle="secondary">Button three</Button>
|
|
27
|
+
</>
|
|
28
|
+
}
|
|
29
|
+
} satisfies Meta<typeof ButtonGroup>;
|
|
30
|
+
|
|
31
|
+
export default meta;
|
|
32
|
+
type Story = StoryObj<typeof meta>;
|
|
33
|
+
|
|
34
|
+
export const Default: Story = {
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const Inline: Story = {
|
|
38
|
+
args: {
|
|
39
|
+
isInline: true
|
|
40
|
+
}
|
|
41
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { test, expect } from 'vitest';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import ButtonGroup from './ButtonGroup';
|
|
4
|
+
|
|
5
|
+
test('renders correctly', () => {
|
|
6
|
+
render(
|
|
7
|
+
<ButtonGroup data-testid="button-group">
|
|
8
|
+
</ButtonGroup>
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
const buttonGroup = screen.getByTestId('button-group');
|
|
12
|
+
expect(buttonGroup).toBeInTheDocument();
|
|
13
|
+
expect(buttonGroup).toHaveClass('ds_button-group');
|
|
14
|
+
expect(buttonGroup.tagName).toEqual('DIV');
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test('inline button group', () => {
|
|
18
|
+
render(
|
|
19
|
+
<ButtonGroup isInline data-testid="button-group">
|
|
20
|
+
|
|
21
|
+
</ButtonGroup>
|
|
22
|
+
);
|
|
23
|
+
const buttonGroup = screen.getByTestId('button-group');
|
|
24
|
+
expect(buttonGroup).toHaveClass('ds_button-group--inline');
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test('passing additional props', () => {
|
|
28
|
+
render(
|
|
29
|
+
<ButtonGroup data-test="foo" data-testid="button-group">
|
|
30
|
+
</ButtonGroup>
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const buttonGroup = screen.getByTestId('button-group');
|
|
34
|
+
expect(buttonGroup.dataset.test).toEqual('foo');
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test('passing additional CSS classes', () => {
|
|
38
|
+
render(
|
|
39
|
+
<ButtonGroup className="foo" data-testid="button-group">
|
|
40
|
+
</ButtonGroup>
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const buttonGroup = screen.getByTestId('button-group');
|
|
44
|
+
expect(buttonGroup).toHaveClass('foo', 'ds_button-group');
|
|
45
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const ButtonGroup = ({
|
|
2
|
+
children,
|
|
3
|
+
className,
|
|
4
|
+
isInline,
|
|
5
|
+
...props
|
|
6
|
+
}: SGDS.Component.ButtonGroup) => {
|
|
7
|
+
return (
|
|
8
|
+
<div className={[
|
|
9
|
+
"ds_button-group",
|
|
10
|
+
isInline ? "ds_button-group--inline" : undefined,
|
|
11
|
+
className
|
|
12
|
+
].join(' ')} { ...props } >
|
|
13
|
+
{children}
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
ButtonGroup.displayName = 'ButtonGroup';
|
|
19
|
+
|
|
20
|
+
export default ButtonGroup;
|
|
@@ -4,7 +4,7 @@ import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
|
4
4
|
import CategoryItem from './CategoryItem';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: 'Components/
|
|
7
|
+
title: 'Components/CategoryItem',
|
|
8
8
|
component: CategoryItem,
|
|
9
9
|
argTypes: {
|
|
10
10
|
children: argTypes.children(),
|
|
@@ -5,7 +5,7 @@ import CategoryList from './CategoryList';
|
|
|
5
5
|
import CategoryItem from '../CategoryItem/CategoryItem';
|
|
6
6
|
|
|
7
7
|
const meta = {
|
|
8
|
-
title: 'Components/
|
|
8
|
+
title: 'Components/CategoryList',
|
|
9
9
|
component: CategoryList,
|
|
10
10
|
argTypes: {
|
|
11
11
|
children: argTypes.children(),
|
|
@@ -4,7 +4,7 @@ import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
|
4
4
|
import ConfirmationMessage from './ConfirmationMessage';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: 'Components/
|
|
7
|
+
title: 'Components/ConfirmationMessage',
|
|
8
8
|
component: ConfirmationMessage,
|
|
9
9
|
argTypes: {
|
|
10
10
|
headingLevel: argTypes.headingLevel(),
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
+
|
|
4
|
+
import ContentsNav from './ContentsNav';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/ContentsNav/ContentsNav.Item',
|
|
8
|
+
component: ContentsNav.Item,
|
|
9
|
+
decorators: [
|
|
10
|
+
Story => (
|
|
11
|
+
<ul className="ds_contents-nav__list">
|
|
12
|
+
<Story />
|
|
13
|
+
</ul>
|
|
14
|
+
)
|
|
15
|
+
],
|
|
16
|
+
argTypes: {
|
|
17
|
+
href: argTypes.href({type: {name: 'string', required: true}}),
|
|
18
|
+
isCurrent: argTypes.isCurrent(),
|
|
19
|
+
linkComponent: argTypes.linkComponent(),
|
|
20
|
+
children: argTypes.children()
|
|
21
|
+
},
|
|
22
|
+
args: {
|
|
23
|
+
children: <>
|
|
24
|
+
Apply for Blue Badge
|
|
25
|
+
</>,
|
|
26
|
+
href: '#foo'
|
|
27
|
+
}
|
|
28
|
+
} satisfies Meta<typeof ContentsNav.Item>;
|
|
29
|
+
|
|
30
|
+
export default meta;
|
|
31
|
+
type Story = StoryObj<typeof meta>;
|
|
32
|
+
|
|
33
|
+
export const Default: Story = {
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Current: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
isCurrent: true
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const NoLink: Story = {
|
|
43
|
+
args: {
|
|
44
|
+
href: undefined
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const NoLinkCurrent: Story = {
|
|
49
|
+
args: {
|
|
50
|
+
href: undefined,
|
|
51
|
+
isCurrent: true
|
|
52
|
+
}
|
|
53
|
+
};
|
|
@@ -4,12 +4,11 @@ import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
|
4
4
|
import ContentsNav from './ContentsNav';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: 'Components/
|
|
7
|
+
title: 'Components/ContentsNav',
|
|
8
8
|
component: ContentsNav,
|
|
9
9
|
argTypes: {
|
|
10
10
|
ariaLabel: argTypes.ariaLabel({description: 'Text to use for the content nav\'s aria-label property'}),
|
|
11
11
|
children: argTypes.children(),
|
|
12
|
-
linkComponent: argTypes.linkComponent(),
|
|
13
12
|
title: {
|
|
14
13
|
description: 'Title of the contents nav',
|
|
15
14
|
type: 'string'
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
+
|
|
4
|
+
import CookieBanner from './CookieBanner';
|
|
5
|
+
import Button from '../Button/Button';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Components/CookieBanner/CookieBanner.Buttons',
|
|
9
|
+
component: CookieBanner.Buttons,
|
|
10
|
+
argTypes: {
|
|
11
|
+
children: argTypes.children()
|
|
12
|
+
},
|
|
13
|
+
args: {
|
|
14
|
+
children: [
|
|
15
|
+
<Button className="js-accept-all-cookies" small buttonStyle="secondary">Accept all cookies</Button>,
|
|
16
|
+
<Button className="js-accept-essential-cookies" small buttonStyle="secondary">Use essential cookies only</Button>,
|
|
17
|
+
<a href="/cookies/">Set cookie preferences</a>
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
} satisfies Meta<typeof CookieBanner.Buttons>;
|
|
21
|
+
|
|
22
|
+
export default meta;
|
|
23
|
+
type Story = StoryObj<typeof meta>;
|
|
24
|
+
|
|
25
|
+
export const Default: Story = {
|
|
26
|
+
|
|
27
|
+
};
|
|
@@ -5,7 +5,7 @@ import CookieBanner from './CookieBanner';
|
|
|
5
5
|
import Button from '../Button/Button';
|
|
6
6
|
|
|
7
7
|
const meta = {
|
|
8
|
-
title: 'Components/
|
|
8
|
+
title: 'Components/CookieBanner',
|
|
9
9
|
component: CookieBanner,
|
|
10
10
|
argTypes: {
|
|
11
11
|
children: argTypes.children()
|
|
@@ -16,7 +16,7 @@ const meta = {
|
|
|
16
16
|
experience.</p>,
|
|
17
17
|
<p key="bar">Click 'Accept all cookies' to agree to all cookies that collect anonymous data.
|
|
18
18
|
To only allow the cookies that make the site work, click 'Use essential cookies only.' Visit 'Set cookie preferences' to control specific cookies.</p>,
|
|
19
|
-
<CookieBanner.Buttons
|
|
19
|
+
<CookieBanner.Buttons>
|
|
20
20
|
<Button className="js-accept-all-cookies" small buttonStyle="secondary">Accept all cookies</Button>
|
|
21
21
|
<Button className="js-accept-essential-cookies" small buttonStyle="secondary">Use essential cookies only</Button>
|
|
22
22
|
<a href="/cookies/">Set cookie preferences</a>
|
|
@@ -4,7 +4,7 @@ import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
|
4
4
|
import ErrorMessage from './ErrorMessage';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: 'Components/
|
|
7
|
+
title: 'Components/ErrorMessage',
|
|
8
8
|
component: ErrorMessage,
|
|
9
9
|
argTypes: {
|
|
10
10
|
children: argTypes.children()
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
+
|
|
4
|
+
import ErrorSummary from './ErrorSummary';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/ErrorSummary/ErrorSummary.Item',
|
|
8
|
+
component: ErrorSummary.Item,
|
|
9
|
+
decorators: [
|
|
10
|
+
Story => (
|
|
11
|
+
<ul className="ds_error-summary__list">
|
|
12
|
+
<Story />
|
|
13
|
+
</ul>
|
|
14
|
+
)
|
|
15
|
+
],
|
|
16
|
+
argTypes: {
|
|
17
|
+
fragmentId: {
|
|
18
|
+
description: 'ID of the question or field to link to',
|
|
19
|
+
type: 'string'
|
|
20
|
+
},
|
|
21
|
+
linkComponent: argTypes.linkComponent(),
|
|
22
|
+
children: argTypes.children()
|
|
23
|
+
},
|
|
24
|
+
args: {
|
|
25
|
+
fragmentId: 'did-resolve',
|
|
26
|
+
children: 'Did this resolve your issue?'
|
|
27
|
+
}
|
|
28
|
+
} satisfies Meta<typeof ErrorSummary.Item>;
|
|
29
|
+
|
|
30
|
+
export default meta;
|
|
31
|
+
type Story = StoryObj<typeof meta>;
|
|
32
|
+
|
|
33
|
+
export const Default: Story = {
|
|
34
|
+
|
|
35
|
+
};
|
|
@@ -4,10 +4,9 @@ import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
|
4
4
|
import ErrorSummary from './ErrorSummary';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: 'Components/
|
|
7
|
+
title: 'Components/ErrorSummary',
|
|
8
8
|
component: ErrorSummary,
|
|
9
9
|
argTypes: {
|
|
10
|
-
linkComponent: argTypes.linkComponent(),
|
|
11
10
|
title: {
|
|
12
11
|
description: 'The title of the error summary',
|
|
13
12
|
type: 'string'
|
|
@@ -4,7 +4,7 @@ import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
|
4
4
|
import NotificationBanner from './NotificationBanner';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: 'Components/
|
|
7
|
+
title: 'Components/NotificationBanner',
|
|
8
8
|
component: NotificationBanner,
|
|
9
9
|
argTypes: {
|
|
10
10
|
children: argTypes.children(),
|
|
@@ -4,7 +4,7 @@ import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
|
4
4
|
import NotificationPanel from './NotificationPanel';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: 'Components/
|
|
7
|
+
title: 'Components/NotificationPanel',
|
|
8
8
|
component: NotificationPanel,
|
|
9
9
|
argTypes: {
|
|
10
10
|
ariaLive: argTypes.ariaLive(),
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
+
|
|
4
|
+
import Metadata from './PageMetadata';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/PageMetadata/PageMetadata.Item',
|
|
8
|
+
component: Metadata.Item,
|
|
9
|
+
decorators: [
|
|
10
|
+
Story => (
|
|
11
|
+
<Metadata>
|
|
12
|
+
<dl className="ds_page-metadata__list">
|
|
13
|
+
<Story />
|
|
14
|
+
</dl>
|
|
15
|
+
</Metadata>
|
|
16
|
+
)
|
|
17
|
+
],
|
|
18
|
+
argTypes: {
|
|
19
|
+
children: argTypes.children(),
|
|
20
|
+
name: {
|
|
21
|
+
description: 'The name or key of the metadata item',
|
|
22
|
+
type: {
|
|
23
|
+
name: 'string',
|
|
24
|
+
required: true
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
args: {
|
|
29
|
+
name: 'Last updated',
|
|
30
|
+
children: '21/04/2020'
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
} satisfies Meta<typeof Metadata.Item>;
|
|
34
|
+
|
|
35
|
+
export default meta;
|
|
36
|
+
type Story = StoryObj<typeof meta>;
|
|
37
|
+
|
|
38
|
+
export const Default: Story = {
|
|
39
|
+
|
|
40
|
+
};
|
|
@@ -4,19 +4,24 @@ import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
|
4
4
|
import Metadata from './PageMetadata';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: 'Components/
|
|
7
|
+
title: 'Components/PageMetadata',
|
|
8
8
|
component: Metadata,
|
|
9
9
|
argTypes: {
|
|
10
10
|
children: argTypes.children(),
|
|
11
|
-
|
|
11
|
+
isInline: {
|
|
12
12
|
control: 'boolean',
|
|
13
13
|
description: 'Makes the page metadata use the truncated ‘inline’ display'
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
args: {
|
|
17
|
-
children:
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
children: <>
|
|
18
|
+
<Metadata.Item name="Content type">
|
|
19
|
+
Publication
|
|
20
|
+
</Metadata.Item>
|
|
21
|
+
<Metadata.Item name="Last updated">
|
|
22
|
+
21/04/2020
|
|
23
|
+
</Metadata.Item>
|
|
24
|
+
</>
|
|
20
25
|
}
|
|
21
26
|
} satisfies Meta<typeof Metadata>;
|
|
22
27
|
|
|
@@ -6,7 +6,7 @@ const RadioGroup = ({
|
|
|
6
6
|
className,
|
|
7
7
|
isInline,
|
|
8
8
|
isSmall,
|
|
9
|
-
name,
|
|
9
|
+
name = '',
|
|
10
10
|
...props
|
|
11
11
|
}: SGDS.Component.RadioButton.Group) => {
|
|
12
12
|
return (
|
|
@@ -19,7 +19,7 @@ const RadioGroup = ({
|
|
|
19
19
|
].join(' ')}
|
|
20
20
|
{...props}
|
|
21
21
|
>
|
|
22
|
-
<CheckboxRadioContext value={{ isSmall: !!isSmall, name
|
|
22
|
+
<CheckboxRadioContext value={{ isSmall: !!isSmall, name}}>
|
|
23
23
|
{children}
|
|
24
24
|
</CheckboxRadioContext>
|
|
25
25
|
</div>
|