@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.
Files changed (109) hide show
  1. package/.storybook/manager.ts +1 -7
  2. package/.storybook/sgdsArgTypes.ts +19 -0
  3. package/@types/components/Accordion.d.ts +3 -2
  4. package/@types/components/ButtonGroup.d.ts +5 -0
  5. package/@types/components/RadioButton.d.ts +2 -2
  6. package/@types/components/SearchFacets.d.ts +18 -0
  7. package/@types/components/SearchFilters.d.ts +14 -0
  8. package/@types/components/SearchResult.d.ts +30 -0
  9. package/@types/components/SearchSort.d.ts +9 -0
  10. package/@types/components/SideNavigation.d.ts +1 -1
  11. package/CHANGELOG.md +31 -5
  12. package/README.md +3 -0
  13. package/dist/common/AbstractNotificationBanner.jsx +2 -5
  14. package/dist/components/Accordion/Accordion.jsx +8 -3
  15. package/dist/components/ButtonGroup/ButtonGroup.jsx +13 -0
  16. package/dist/components/RadioButton/RadioGroup.jsx +1 -1
  17. package/dist/components/SearchFacets/SearchFacets.jsx +101 -0
  18. package/dist/components/SearchFilters/SearchFilters.jsx +63 -0
  19. package/dist/components/SearchResult/SearchResult.jsx +93 -0
  20. package/dist/components/SearchSort/SearchSort.jsx +28 -0
  21. package/dist/components/SideNavigation/SideNavigation.jsx +2 -2
  22. package/dist/components/TaskList/TaskList.jsx +1 -0
  23. package/dist/tsconfig.tsbuildinfo +1 -1
  24. package/package.json +3 -3
  25. package/src/common/AbstractNotificationBanner.tsx +2 -6
  26. package/src/components/Accordion/Accordion.Item.stories.tsx +63 -0
  27. package/src/components/Accordion/Accordion.stories.tsx +4 -54
  28. package/src/components/Accordion/Accordion.test.tsx +48 -14
  29. package/src/components/Accordion/Accordion.tsx +12 -1
  30. package/src/components/AspectBox/AspectBox.stories.tsx +1 -1
  31. package/src/components/BackToTop/BackToTop.stories.tsx +1 -1
  32. package/src/components/Breadcrumbs/Breadcrumbs.Item.stories.tsx +42 -0
  33. package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +0 -1
  34. package/src/components/Button/Button.stories.tsx +1 -1
  35. package/src/components/ButtonGroup/ButtonGroup.stories.tsx +41 -0
  36. package/src/components/ButtonGroup/ButtonGroup.test.tsx +45 -0
  37. package/src/components/ButtonGroup/ButtonGroup.tsx +20 -0
  38. package/src/components/CategoryItem/CategoryItem.stories.tsx +1 -1
  39. package/src/components/CategoryList/CategoryList.stories.tsx +1 -1
  40. package/src/components/Checkbox/Checkbox.stories.tsx +1 -1
  41. package/src/components/Checkbox/CheckboxGroup.stories.tsx +1 -1
  42. package/src/components/ConfirmationMessage/ConfirmationMessage.stories.tsx +1 -1
  43. package/src/components/ContentsNav/ContentsNav.Item.stories.tsx +53 -0
  44. package/src/components/ContentsNav/ContentsNav.stories.tsx +1 -2
  45. package/src/components/CookieBanner/CookieBanner.Buttons.stories.tsx +27 -0
  46. package/src/components/CookieBanner/CookieBanner.stories.tsx +2 -2
  47. package/src/components/DatePicker/DatePicker.stories.tsx +1 -1
  48. package/src/components/ErrorMessage/ErrorMessage.stories.tsx +1 -1
  49. package/src/components/ErrorSummary/ErrorSummary.Item.stories.tsx +35 -0
  50. package/src/components/ErrorSummary/ErrorSummary.stories.tsx +1 -2
  51. package/src/components/FileDownload/FileDownload.stories.tsx +1 -1
  52. package/src/components/HideThisPage/HideThisPage.stories.tsx +1 -1
  53. package/src/components/InsetText/InsetText.stories.tsx +1 -1
  54. package/src/components/NotificationBanner/NotificationBanner.stories.tsx +1 -1
  55. package/src/components/NotificationPanel/NotificationPanel.stories.tsx +1 -1
  56. package/src/components/PageHeader/PageHeader.stories.tsx +1 -1
  57. package/src/components/PageMetadata/PageMetadata.Item.stories.tsx +40 -0
  58. package/src/components/PageMetadata/PageMetadata.stories.tsx +10 -5
  59. package/src/components/PhaseBanner/PhaseBanner.stories.tsx +1 -1
  60. package/src/components/RadioButton/RadioButton.stories.tsx +1 -1
  61. package/src/components/RadioButton/RadioGroup.stories.tsx +1 -1
  62. package/src/components/RadioButton/RadioGroup.tsx +2 -2
  63. package/src/components/SearchFacets/SearchFacets.Group.stories.tsx +56 -0
  64. package/src/components/SearchFacets/SearchFacets.Item.stories.tsx +53 -0
  65. package/src/components/SearchFacets/SearchFacets.stories.tsx +38 -0
  66. package/src/components/SearchFacets/SearchFacets.test.tsx +214 -0
  67. package/src/components/SearchFacets/SearchFacets.tsx +99 -0
  68. package/src/components/SearchFilters/SearchFilters.Panel.stories.tsx +201 -0
  69. package/src/components/SearchFilters/SearchFilters.stories.tsx +137 -0
  70. package/src/components/SearchFilters/SearchFilters.test.tsx +161 -0
  71. package/src/components/SearchFilters/SearchFilters.tsx +89 -0
  72. package/src/components/SearchResult/SearchResult.stories.tsx +111 -0
  73. package/src/components/SearchResult/SearchResult.test.tsx +215 -0
  74. package/src/components/SearchResult/SearchResult.tsx +137 -0
  75. package/src/components/SearchSort/SearchSort.stories.tsx +32 -0
  76. package/src/components/SearchSort/SearchSort.test.tsx +129 -0
  77. package/src/components/SearchSort/SearchSort.tsx +45 -0
  78. package/src/components/SequentialNavigation/SequentialNavigation.Next.stories.tsx +35 -0
  79. package/src/components/SequentialNavigation/SequentialNavigation.Previous.stories.tsx +35 -0
  80. package/src/components/SequentialNavigation/SequentialNavigation.stories.tsx +1 -2
  81. package/src/components/SequentialNavigation/SequentialNavigation.test.tsx +15 -0
  82. package/src/components/SideNavigation/SideNavigation.Item.stories.tsx +45 -0
  83. package/src/components/SideNavigation/SideNavigation.List.stories.tsx +53 -0
  84. package/src/components/SideNavigation/SideNavigation.stories.tsx +1 -2
  85. package/src/components/SideNavigation/SideNavigation.tsx +2 -1
  86. package/src/components/SiteFooter/SiteFooter.License.stories.tsx +46 -0
  87. package/src/components/SiteFooter/SiteFooter.Link.stories.tsx +34 -0
  88. package/src/components/SiteFooter/SiteFooter.Links.stories.tsx +32 -0
  89. package/src/components/SiteFooter/SiteFooter.Org.stories.tsx +45 -0
  90. package/src/components/SiteFooter/SiteFooter.stories.tsx +1 -1
  91. package/src/components/SiteHeader/SiteHeader.Brand.stories.tsx +45 -0
  92. package/src/components/SiteHeader/SiteHeader.stories.tsx +1 -1
  93. package/src/components/SiteNavigation/SiteNavigation.Item.stories.tsx +40 -0
  94. package/src/components/SiteNavigation/SiteNavigation.stories.tsx +1 -2
  95. package/src/components/SkipLinks/SkipLinks.Item.stories.tsx +37 -0
  96. package/src/components/SkipLinks/SkipLinks.stories.tsx +1 -1
  97. package/src/components/SummaryCard/SummaryCard.Action.stories.tsx +39 -0
  98. package/src/components/SummaryCard/SummaryCard.stories.tsx +8 -1
  99. package/src/components/SummaryList/SummaryList.Action.stories.tsx +32 -0
  100. package/src/components/SummaryList/SummaryList.Item.stories.tsx +50 -0
  101. package/src/components/SummaryList/SummaryList.Value.stories.tsx +30 -0
  102. package/src/components/SummaryList/SummaryList.stories.tsx +1 -1
  103. package/src/components/Tabs/Tabs.Item.stories.tsx +37 -0
  104. package/src/components/Tag/Tag.stories.tsx +2 -6
  105. package/src/components/TaskList/TaskList.Group.stories.tsx +110 -0
  106. package/src/components/TaskList/TaskList.Item.stories.tsx +77 -0
  107. package/src/components/TaskList/TaskList.stories.tsx +1 -1
  108. package/src/components/TaskList/TaskList.test.tsx +21 -1
  109. package/src/components/TaskList/TaskList.tsx +1 -0
@@ -6,7 +6,7 @@ import coo from '../../../static/images/highland-cow.jpg';
6
6
  import AspectBox from './AspectBox';
7
7
 
8
8
  const meta = {
9
- title: 'Components/Aspect Box',
9
+ title: 'Components/AspectBox',
10
10
  component: AspectBox,
11
11
  argTypes: {
12
12
  ratio: {
@@ -3,7 +3,7 @@ import type { Meta, StoryObj } from '@storybook/react-vite';
3
3
  import BackToTop from './BackToTop';
4
4
 
5
5
  const meta = {
6
- title: 'Components/Back to top',
6
+ title: 'Components/BackToTop',
7
7
  component: BackToTop,
8
8
  argTypes: {
9
9
  href: {
@@ -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
+ };
@@ -7,7 +7,6 @@ const meta = {
7
7
  title: 'Components/Breadcrumbs',
8
8
  component: Breadcrumbs,
9
9
  argTypes: {
10
- linkComponent: argTypes.linkComponent(),
11
10
  children: argTypes.children()
12
11
  },
13
12
  args: {
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import Button from './Button';
3
3
 
4
4
  const meta = {
5
- title: 'Components/Button',
5
+ title: 'Components/Buttons/Button',
6
6
  component: Button,
7
7
  parameters: {
8
8
  controls: { sort: 'alpha' }
@@ -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/Category item',
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/Category list',
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 Checkbox from './Checkbox';
5
5
 
6
6
  const meta = {
7
- title: 'Components/Checkbox',
7
+ title: 'Components/Checkboxes/Checkbox',
8
8
  component: Checkbox,
9
9
  argTypes: {
10
10
  checked: {
@@ -6,7 +6,7 @@ import Checkbox from './Checkbox';
6
6
 
7
7
  const meta = {
8
8
  component: CheckboxGroup,
9
- title: 'Components/CheckboxGroup',
9
+ title: 'Components/Checkboxes/CheckboxGroup',
10
10
  argTypes: {
11
11
  children: argTypes.children(),
12
12
  isSmall: argTypes.isSmall()
@@ -4,7 +4,7 @@ import argTypes from '../../../.storybook/sgdsArgTypes';
4
4
  import ConfirmationMessage from './ConfirmationMessage';
5
5
 
6
6
  const meta = {
7
- title: 'Components/Confirmation Message',
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/Contents nav',
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/Cookie banner',
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 key="baz">
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 DatePicker from './DatePicker';
5
5
 
6
6
  const meta = {
7
- title: 'Components/Date picker',
7
+ title: 'Components/DatePicker',
8
8
  component: DatePicker,
9
9
  argTypes: {
10
10
  dateSelectCallback: {},
@@ -4,7 +4,7 @@ import argTypes from '../../../.storybook/sgdsArgTypes';
4
4
  import ErrorMessage from './ErrorMessage';
5
5
 
6
6
  const meta = {
7
- title: 'Components/Error message',
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/Error summary',
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'
@@ -3,7 +3,7 @@ import type { Meta, StoryObj } from '@storybook/react-vite';
3
3
  import FileDownload from './FileDownload';
4
4
 
5
5
  const meta = {
6
- title: 'Components/File download',
6
+ title: 'Components/FileDownload',
7
7
  component: FileDownload,
8
8
  argTypes: {
9
9
  cover: {
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import HideThisPage from './HideThisPage';
3
3
 
4
4
  const meta = {
5
- title: 'Components/Hide this page',
5
+ title: 'Components/HideThisPage',
6
6
  component: HideThisPage,
7
7
  argTypes: {
8
8
  escapeUrl: {
@@ -4,7 +4,7 @@ import argTypes from '../../../.storybook/sgdsArgTypes';
4
4
  import InsetText from './InsetText';
5
5
 
6
6
  const meta = {
7
- title: 'Components/Inset text',
7
+ title: 'Components/InsetText',
8
8
  component: InsetText,
9
9
  argTypes: {
10
10
  children: argTypes.children()
@@ -4,7 +4,7 @@ import argTypes from '../../../.storybook/sgdsArgTypes';
4
4
  import NotificationBanner from './NotificationBanner';
5
5
 
6
6
  const meta = {
7
- title: 'Components/Notification banner',
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/Notification panel',
7
+ title: 'Components/NotificationPanel',
8
8
  component: NotificationPanel,
9
9
  argTypes: {
10
10
  ariaLive: argTypes.ariaLive(),
@@ -5,7 +5,7 @@ import PageHeader from './PageHeader';
5
5
  import Metadata from '../PageMetadata/PageMetadata';
6
6
 
7
7
  const meta = {
8
- title: 'Components/Page header',
8
+ title: 'Components/PageHeader',
9
9
  component: PageHeader,
10
10
  argTypes: {
11
11
  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 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/Page metadata',
7
+ title: 'Components/PageMetadata',
8
8
  component: Metadata,
9
9
  argTypes: {
10
10
  children: argTypes.children(),
11
- isInline: {
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: <Metadata.Item name="Last updated">
18
- 21/04/2020
19
- </Metadata.Item>
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
 
@@ -4,7 +4,7 @@ import argTypes from '../../../.storybook/sgdsArgTypes';
4
4
  import PhaseBanner from './PhaseBanner';
5
5
 
6
6
  const meta = {
7
- title: 'Components/Phase banner',
7
+ title: 'Components/PhaseBanner',
8
8
  component: PhaseBanner,
9
9
  argTypes: {
10
10
  children: argTypes.children(),
@@ -4,7 +4,7 @@ import argTypes from '../../../.storybook/sgdsArgTypes';
4
4
  import RadioButton from './RadioButton';
5
5
 
6
6
  const meta = {
7
- title: 'Components/Radio button',
7
+ title: 'Components/Radio/Radio button',
8
8
  component: RadioButton,
9
9
  argTypes: {
10
10
  checked: {
@@ -5,7 +5,7 @@ import RadioButton from '../RadioButton/RadioButton';
5
5
  import RadioGroup from './RadioGroup';
6
6
 
7
7
  const meta = {
8
- title: 'Components/Radio group',
8
+ title: 'Components/Radio/Radio group',
9
9
  component: RadioGroup,
10
10
  argTypes: {
11
11
  isInline: {
@@ -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>