@scottish-government/designsystem-react 0.6.0 → 0.7.1

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 (169) hide show
  1. package/@types/components/Accordion.d.ts +2 -2
  2. package/@types/components/ConfirmationMessage.d.ts +1 -1
  3. package/@types/components/NotificationPanel.d.ts +1 -1
  4. package/@types/components/SummaryCard.d.ts +1 -1
  5. package/@types/components/Tabs.d.ts +1 -1
  6. package/@types/sgds.d.ts +1 -1
  7. package/CHANGELOG.md +81 -0
  8. package/README.md +4 -0
  9. package/dist/common/{abstract-notification-banner.jsx → AbstractNotificationBanner.jsx} +5 -5
  10. package/dist/components/{accordion/accordion.jsx → Accordion/Accordion.jsx} +6 -6
  11. package/dist/components/{back-to-top/back-to-top.jsx → BackToTop/BackToTop.jsx} +2 -2
  12. package/dist/components/{button/button.jsx → Button/Button.jsx} +7 -7
  13. package/dist/components/{checkbox/checkbox.jsx → Checkbox/Checkbox.jsx} +2 -2
  14. package/dist/components/{confirmation-message/confirmation-message.jsx → ConfirmationMessage/ConfirmationMessage.jsx} +6 -6
  15. package/dist/components/{contents-nav/contents-nav.jsx → ContentsNav/ContentsNav.jsx} +3 -3
  16. package/dist/components/{cookie-banner/cookie-banner.jsx → CookieBanner/CookieBanner.jsx} +4 -4
  17. package/dist/components/{date-picker/date-picker.jsx → DatePicker/DatePicker.jsx} +7 -7
  18. package/dist/components/{error-summary/error-summary.jsx → ErrorSummary/ErrorSummary.jsx} +2 -2
  19. package/dist/components/{file-download/file-download.jsx → FileDownload/FileDownload.jsx} +2 -2
  20. package/dist/components/{hide-this-page/hide-this-page.jsx → HideThisPage/HideThisPage.jsx} +3 -3
  21. package/dist/components/{notification-banner/notification-banner.jsx → NotificationBanner/NotificationBanner.jsx} +4 -4
  22. package/dist/components/{notification-panel/notification-panel.jsx → NotificationPanel/NotificationPanel.jsx} +4 -4
  23. package/dist/components/{pagination/pagination.jsx → Pagination/Pagination.jsx} +3 -3
  24. package/dist/components/{phase-banner/phase-banner.jsx → PhaseBanner/PhaseBanner.jsx} +2 -2
  25. package/dist/components/{question/question.jsx → Question/Question.jsx} +7 -7
  26. package/dist/components/{radio-button/radio-button.jsx → RadioButton/RadioButton.jsx} +2 -2
  27. package/dist/components/{select/select.jsx → Select/Select.jsx} +4 -4
  28. package/dist/components/{site-header/site-header.jsx → SiteHeader/SiteHeader.jsx} +13 -13
  29. package/dist/components/{site-search/site-search.jsx → SiteSearch/SiteSearch.jsx} +2 -2
  30. package/dist/components/{summary-card/summary-card.jsx → SummaryCard/SummaryCard.jsx} +6 -6
  31. package/dist/components/{summary-list/summary-list.jsx → SummaryList/SummaryList.jsx} +8 -8
  32. package/dist/components/{tabs/tabs.jsx → Tabs/Tabs.jsx} +4 -4
  33. package/dist/components/{task-list/task-list.jsx → TaskList/TaskList.jsx} +9 -9
  34. package/dist/components/{text-input/text-input.jsx → TextInput/TextInput.jsx} +11 -11
  35. package/dist/components/{textarea/textarea.jsx → Textarea/Textarea.jsx} +7 -7
  36. package/dist/tsconfig.tsbuildinfo +1 -1
  37. package/package.json +1 -1
  38. package/src/common/{abstract-notification-banner.test.tsx → AbstractNotificationBanner.test.tsx} +11 -11
  39. package/src/common/{abstract-notification-banner.tsx → AbstractNotificationBanner.tsx} +2 -2
  40. package/src/common/{conditional-wrapper.test.tsx → ConditionalWrapper.test.tsx} +1 -1
  41. package/src/common/{file-icon.test.tsx → FileIcon.test.tsx} +10 -10
  42. package/src/common/{hint-text.test.tsx → HintText.test.tsx} +12 -12
  43. package/src/common/{icon.test.tsx → Icon.test.tsx} +16 -16
  44. package/src/common/{screen-reader-text.test.tsx → ScreenReaderText.test.tsx} +5 -5
  45. package/src/common/{wrapper-tag.test.tsx → WrapperTag.test.tsx} +5 -5
  46. package/src/components/{accordion/accordion.test.tsx → Accordion/Accordion.test.tsx} +35 -35
  47. package/src/components/{accordion/accordion.tsx → Accordion/Accordion.tsx} +5 -5
  48. package/src/components/{aspect-box/aspect-box.test.tsx → AspectBox/AspectBox.test.tsx} +2 -2
  49. package/src/components/{back-to-top/back-to-top.test.tsx → BackToTop/BackToTop.test.tsx} +1 -1
  50. package/src/components/{back-to-top/back-to-top.tsx → BackToTop/BackToTop.tsx} +1 -1
  51. package/src/components/{breadcrumbs/breadcrumbs.test.tsx → Breadcrumbs/Breadcrumbs.test.tsx} +7 -7
  52. package/src/components/{button/button.test.tsx → Button/Button.test.tsx} +1 -1
  53. package/src/components/{button/button.tsx → Button/Button.tsx} +3 -3
  54. package/src/components/{checkbox/checkbox.test.tsx → Checkbox/Checkbox.test.tsx} +16 -16
  55. package/src/components/{checkbox/checkbox.tsx → Checkbox/Checkbox.tsx} +1 -1
  56. package/src/components/{confirmation-message/confirmation-message.test.tsx → ConfirmationMessage/ConfirmationMessage.test.tsx} +12 -14
  57. package/src/components/{confirmation-message/confirmation-message.tsx → ConfirmationMessage/ConfirmationMessage.tsx} +4 -4
  58. package/src/components/{contents-nav/contents-nav.test.tsx → ContentsNav/ContentsNav.test.tsx} +21 -28
  59. package/src/components/{contents-nav/contents-nav.tsx → ContentsNav/ContentsNav.tsx} +1 -1
  60. package/src/components/{cookie-banner/cookie-banner.test.tsx → CookieBanner/CookieBanner.test.tsx} +3 -3
  61. package/src/components/{cookie-banner/cookie-banner.tsx → CookieBanner/CookieBanner.tsx} +1 -1
  62. package/src/components/{date-picker/date-picker.test.tsx → DatePicker/DatePicker.test.tsx} +76 -66
  63. package/src/components/{date-picker/date-picker.tsx → DatePicker/DatePicker.tsx} +2 -2
  64. package/src/components/{details/details.test.tsx → Details/Details.test.tsx} +10 -10
  65. package/src/components/{error-message/error-message.test.tsx → ErrorMessage/ErrorMessage.test.tsx} +10 -10
  66. package/src/components/{error-summary/error-summary.test.tsx → ErrorSummary/ErrorSummary.test.tsx} +13 -14
  67. package/src/components/{error-summary/error-summary.tsx → ErrorSummary/ErrorSummary.tsx} +1 -1
  68. package/src/components/{file-download/file-download.test.tsx → FileDownload/FileDownload.test.tsx} +21 -21
  69. package/src/components/{file-download/file-download.tsx → FileDownload/FileDownload.tsx} +1 -1
  70. package/src/components/{hide-this-page/hide-this-page.test.tsx → HideThisPage/HideThisPage.test.tsx} +4 -4
  71. package/src/components/{hide-this-page/hide-this-page.tsx → HideThisPage/HideThisPage.tsx} +3 -3
  72. package/src/components/{inset-text/inset-text.test.tsx → InsetText/InsetText.test.tsx} +1 -1
  73. package/src/components/{notification-banner/notification-banner.test.tsx → NotificationBanner/NotificationBanner.test.tsx} +4 -4
  74. package/src/components/{notification-banner/notification-banner.tsx → NotificationBanner/NotificationBanner.tsx} +1 -1
  75. package/src/components/{notification-panel/notification-panel.test.tsx → NotificationPanel/NotificationPanel.test.tsx} +24 -23
  76. package/src/components/{notification-panel/notification-panel.tsx → NotificationPanel/NotificationPanel.tsx} +3 -3
  77. package/src/components/{page-header/page-header.test.tsx → PageHeader/PageHeader.test.tsx} +9 -9
  78. package/src/components/{page-metadata/page-metadata.test.tsx → PageMetadata/PageMetadata.test.tsx} +9 -9
  79. package/src/components/{pagination/pagination.test.tsx → Pagination/Pagination.test.tsx} +56 -56
  80. package/src/components/{pagination/pagination.tsx → Pagination/Pagination.tsx} +1 -1
  81. package/src/components/{phase-banner/phase-banner.test.tsx → PhaseBanner/PhaseBanner.test.tsx} +9 -9
  82. package/src/components/{phase-banner/phase-banner.tsx → PhaseBanner/PhaseBanner.tsx} +1 -1
  83. package/src/components/{question/question.test.tsx → Question/Question.test.tsx} +10 -10
  84. package/src/components/{question/question.tsx → Question/Question.tsx} +3 -3
  85. package/src/components/{radio-button/radio-button.test.tsx → RadioButton/RadioButton.test.tsx} +23 -23
  86. package/src/components/{radio-button/radio-button.tsx → RadioButton/RadioButton.tsx} +1 -1
  87. package/src/components/{select/select.test.tsx → Select/Select.test.tsx} +67 -64
  88. package/src/components/{select/select.tsx → Select/Select.tsx} +2 -2
  89. package/src/components/{sequential-navigation/sequential-navigation.test.tsx → SequentialNavigation/SequentialNavigation.test.tsx} +18 -18
  90. package/src/components/{side-navigation/side-navigation.test.tsx → SideNavigation/SideNavigation.test.tsx} +8 -8
  91. package/src/components/{site-header/site-header.test.tsx → SiteHeader/SiteHeader.test.tsx} +25 -25
  92. package/src/components/{site-header/site-header.tsx → SiteHeader/SiteHeader.tsx} +4 -4
  93. package/src/components/{site-navigation/site-navigation.test.tsx → SiteNavigation/SiteNavigation.test.tsx} +8 -8
  94. package/src/components/{site-search/site-search.test.tsx → SiteSearch/SiteSearch.test.tsx} +16 -16
  95. package/src/components/{site-search/site-search.tsx → SiteSearch/SiteSearch.tsx} +1 -1
  96. package/src/components/{skip-links/skip-links.test.tsx → SkipLinks/SkipLinks.test.tsx} +15 -15
  97. package/src/components/{summary-card/summary-card.test.tsx → SummaryCard/SummaryCard.test.tsx} +28 -28
  98. package/src/components/{summary-card/summary-card.tsx → SummaryCard/SummaryCard.tsx} +4 -4
  99. package/src/components/{summary-list/summary-list.test.tsx → SummaryList/SummaryList.test.tsx} +55 -56
  100. package/src/components/{summary-list/summary-list.tsx → SummaryList/SummaryList.tsx} +2 -2
  101. package/src/components/{table/table.test.tsx → Table/Table.test.tsx} +4 -4
  102. package/src/components/{tabs/tabs.test.tsx → Tabs/Tabs.test.tsx} +22 -42
  103. package/src/components/{tabs/tabs.tsx → Tabs/Tabs.tsx} +3 -3
  104. package/src/components/{tag/tag.test.tsx → Tag/Tag.test.tsx} +10 -10
  105. package/src/components/{task-list/task-list.test.tsx → TaskList/TaskList.test.tsx} +109 -108
  106. package/src/components/{task-list/task-list.tsx → TaskList/TaskList.tsx} +4 -4
  107. package/src/components/{text-input/text-input.test.tsx → TextInput/TextInput.test.tsx} +92 -87
  108. package/src/components/{text-input/text-input.tsx → TextInput/TextInput.tsx} +4 -4
  109. package/src/components/{textarea/textarea.test.tsx → Textarea/Textarea.test.tsx} +71 -67
  110. package/src/components/{textarea/textarea.tsx → Textarea/Textarea.tsx} +3 -3
  111. package/src/components/{warning-text/warning-text.test.tsx → WarningText/WarningText.test.tsx} +1 -1
  112. package/dist/icons/ArrowUpward.jsx +0 -41
  113. package/dist/icons/CalendarToday.jsx +0 -41
  114. package/dist/icons/Cancel.jsx +0 -40
  115. package/dist/icons/CheckCircle.jsx +0 -41
  116. package/dist/icons/ChevronLeft.jsx +0 -41
  117. package/dist/icons/ChevronRight.jsx +0 -41
  118. package/dist/icons/Close.jsx +0 -41
  119. package/dist/icons/Description.jsx +0 -41
  120. package/dist/icons/DoubleChevronLeft.jsx +0 -40
  121. package/dist/icons/DoubleChevronRight.jsx +0 -40
  122. package/dist/icons/Error.jsx +0 -41
  123. package/dist/icons/ExpandLess.jsx +0 -41
  124. package/dist/icons/ExpandMore.jsx +0 -41
  125. package/dist/icons/List.jsx +0 -44
  126. package/dist/icons/Menu.jsx +0 -41
  127. package/dist/icons/PriorityHigh.jsx +0 -42
  128. package/dist/icons/Search.jsx +0 -41
  129. package/dist/icons/index.js +0 -40
  130. /package/dist/common/{conditional-wrapper.jsx → ConditionalWrapper.jsx} +0 -0
  131. /package/dist/common/{file-icon.jsx → FileIcon.jsx} +0 -0
  132. /package/dist/common/{hint-text.jsx → HintText.jsx} +0 -0
  133. /package/dist/common/{icon.jsx → Icon.jsx} +0 -0
  134. /package/dist/common/{screen-reader-text.jsx → ScreenReaderText.jsx} +0 -0
  135. /package/dist/common/{wrapper-tag.jsx → WrapperTag.jsx} +0 -0
  136. /package/dist/components/{aspect-box/aspect-box.jsx → AspectBox/AspectBox.jsx} +0 -0
  137. /package/dist/components/{breadcrumbs/breadcrumbs.jsx → Breadcrumbs/Breadcrumbs.jsx} +0 -0
  138. /package/dist/components/{details/details.jsx → Details/Details.jsx} +0 -0
  139. /package/dist/components/{error-message/error-message.jsx → ErrorMessage/ErrorMessage.jsx} +0 -0
  140. /package/dist/components/{inset-text/inset-text.jsx → InsetText/InsetText.jsx} +0 -0
  141. /package/dist/components/{page-header/page-header.jsx → PageHeader/PageHeader.jsx} +0 -0
  142. /package/dist/components/{page-metadata/page-metadata.jsx → PageMetadata/PageMetadata.jsx} +0 -0
  143. /package/dist/components/{sequential-navigation/sequential-navigation.jsx → SequentialNavigation/SequentialNavigation.jsx} +0 -0
  144. /package/dist/components/{side-navigation/side-navigation.jsx → SideNavigation/SideNavigation.jsx} +0 -0
  145. /package/dist/components/{site-navigation/site-navigation.jsx → SiteNavigation/SiteNavigation.jsx} +0 -0
  146. /package/dist/components/{skip-links/skip-links.jsx → SkipLinks/SkipLinks.jsx} +0 -0
  147. /package/dist/components/{table/table.jsx → Table/Table.jsx} +0 -0
  148. /package/dist/components/{tag/tag.jsx → Tag/Tag.jsx} +0 -0
  149. /package/dist/components/{warning-text/warning-text.jsx → WarningText/WarningText.jsx} +0 -0
  150. /package/src/common/{conditional-wrapper.tsx → ConditionalWrapper.tsx} +0 -0
  151. /package/src/common/{file-icon.tsx → FileIcon.tsx} +0 -0
  152. /package/src/common/{hint-text.tsx → HintText.tsx} +0 -0
  153. /package/src/common/{icon.tsx → Icon.tsx} +0 -0
  154. /package/src/common/{screen-reader-text.tsx → ScreenReaderText.tsx} +0 -0
  155. /package/src/common/{wrapper-tag.tsx → WrapperTag.tsx} +0 -0
  156. /package/src/components/{aspect-box/aspect-box.tsx → AspectBox/AspectBox.tsx} +0 -0
  157. /package/src/components/{breadcrumbs/breadcrumbs.tsx → Breadcrumbs/Breadcrumbs.tsx} +0 -0
  158. /package/src/components/{details/details.tsx → Details/Details.tsx} +0 -0
  159. /package/src/components/{error-message/error-message.tsx → ErrorMessage/ErrorMessage.tsx} +0 -0
  160. /package/src/components/{inset-text/inset-text.tsx → InsetText/InsetText.tsx} +0 -0
  161. /package/src/components/{page-header/page-header.tsx → PageHeader/PageHeader.tsx} +0 -0
  162. /package/src/components/{page-metadata/page-metadata.tsx → PageMetadata/PageMetadata.tsx} +0 -0
  163. /package/src/components/{sequential-navigation/sequential-navigation.tsx → SequentialNavigation/SequentialNavigation.tsx} +0 -0
  164. /package/src/components/{side-navigation/side-navigation.tsx → SideNavigation/SideNavigation.tsx} +0 -0
  165. /package/src/components/{site-navigation/site-navigation.tsx → SiteNavigation/SiteNavigation.tsx} +0 -0
  166. /package/src/components/{skip-links/skip-links.tsx → SkipLinks/SkipLinks.tsx} +0 -0
  167. /package/src/components/{table/table.tsx → Table/Table.tsx} +0 -0
  168. /package/src/components/{tag/tag.tsx → Tag/Tag.tsx} +0 -0
  169. /package/src/components/{warning-text/warning-text.tsx → WarningText/WarningText.tsx} +0 -0
@@ -1,14 +1,14 @@
1
1
  import { test, expect } from 'vitest';
2
2
  import { render, screen, within } from '@testing-library/react';
3
- import AbstractNotificationBanner from './abstract-notification-banner';
4
- import Button from '../components/button/button';
3
+ import AbstractNotificationBanner from './AbstractNotificationBanner';
4
+ import Button from '../components/Button/Button';
5
5
 
6
- const text = 'We need to tell you about something';
6
+ const NOTIFICATION_TEXT = 'We need to tell you about something';
7
7
 
8
8
  test('abstract notification banner renders correctly', () => {
9
9
  render(
10
10
  <AbstractNotificationBanner>
11
- {text}
11
+ {NOTIFICATION_TEXT}
12
12
  </AbstractNotificationBanner>
13
13
  );
14
14
 
@@ -24,7 +24,7 @@ test('abstract notification banner renders correctly', () => {
24
24
  expect(bannerTitle).toHaveClass('visually-hidden');
25
25
 
26
26
  expect(bannerText).toHaveClass('ds_notification__text');
27
- expect(bannerText?.textContent).toEqual(text);
27
+ expect(bannerText?.textContent).toEqual(NOTIFICATION_TEXT);
28
28
 
29
29
  expect(bannerContent).toHaveClass('ds_notification__content');
30
30
  expect(bannerWrapper).toHaveClass('ds_wrapper');
@@ -34,7 +34,7 @@ test('abstract notification banner renders correctly', () => {
34
34
  test('abstract notification banner with close button', () => {
35
35
  render(
36
36
  <AbstractNotificationBanner close>
37
- {text}
37
+ {NOTIFICATION_TEXT}
38
38
  </AbstractNotificationBanner>
39
39
  );
40
40
 
@@ -57,7 +57,7 @@ test('abstract notification banner with close button', () => {
57
57
  test('abstract notification banner with icon', () => {
58
58
  render(
59
59
  <AbstractNotificationBanner icon="Search">
60
- {text}
60
+ {NOTIFICATION_TEXT}
61
61
  </AbstractNotificationBanner>
62
62
  );
63
63
 
@@ -73,7 +73,7 @@ test('abstract notification banner with icon', () => {
73
73
  test('abstract notification banner with icon modifier classes', () => {
74
74
  render(
75
75
  <AbstractNotificationBanner icon="Search" iconColour iconInverse>
76
- {text}
76
+ {NOTIFICATION_TEXT}
77
77
  </AbstractNotificationBanner>
78
78
  );
79
79
 
@@ -86,7 +86,7 @@ test('abstract notification banner with icon modifier classes', () => {
86
86
  test('abstract notification banner with buttons', () => {
87
87
  render(
88
88
  <AbstractNotificationBanner>
89
- {text}
89
+ {NOTIFICATION_TEXT}
90
90
  <AbstractNotificationBanner.Buttons>
91
91
  <Button data-testid="button">Foo</Button>
92
92
  </AbstractNotificationBanner.Buttons>
@@ -106,7 +106,7 @@ test('abstract notification banner with buttons', () => {
106
106
  test('passing additional props', () => {
107
107
  render(
108
108
  <AbstractNotificationBanner data-test="foo">
109
- {text}
109
+ {NOTIFICATION_TEXT}
110
110
  </AbstractNotificationBanner>
111
111
  )
112
112
 
@@ -117,7 +117,7 @@ test('passing additional props', () => {
117
117
  test('passing additional CSS classes', () => {
118
118
  render(
119
119
  <AbstractNotificationBanner className="foo">
120
- {text}
120
+ {NOTIFICATION_TEXT}
121
121
  </AbstractNotificationBanner>
122
122
  )
123
123
 
@@ -1,6 +1,6 @@
1
1
  import { Children, isValidElement } from 'react';
2
- import Icon from './icon';
3
- import ScreenReaderText from './screen-reader-text';
2
+ import Icon from './Icon';
3
+ import ScreenReaderText from './ScreenReaderText';
4
4
 
5
5
  const Buttons: React.FC<SGDS.Common.AbstractNotificationBanner.Buttons> = ({
6
6
  children
@@ -1,6 +1,6 @@
1
1
  import { test, expect } from 'vitest';
2
2
  import { render, screen } from '@testing-library/react';
3
- import ConditionalWrapper from './conditional-wrapper';
3
+ import ConditionalWrapper from './ConditionalWrapper';
4
4
 
5
5
  test('conditional wrapper true', () => {
6
6
  render(
@@ -1,13 +1,13 @@
1
1
  import { test, expect } from 'vitest';
2
2
  import { render, screen } from '@testing-library/react';
3
- import FileIcon from './file-icon';
3
+ import FileIcon from './FileIcon';
4
4
 
5
- const iconName = 'Generic';
5
+ const ICON_NAME = 'Generic';
6
6
 
7
7
  test('file icon renders correctly', () => {
8
8
  render(
9
9
  <FileIcon data-testid="icon"
10
- icon={iconName}
10
+ icon={ICON_NAME}
11
11
  />
12
12
  );
13
13
 
@@ -19,12 +19,12 @@ test('file icon renders correctly', () => {
19
19
  });
20
20
 
21
21
  test('file icon with class name', () => {
22
- const className = 'foo';
22
+ const CLASSNAME = 'foo';
23
23
 
24
24
  render(
25
25
  <FileIcon data-testid="icon"
26
- icon={iconName}
27
- className={className}
26
+ icon={ICON_NAME}
27
+ className={CLASSNAME}
28
28
  />
29
29
  );
30
30
 
@@ -34,17 +34,17 @@ test('file icon with class name', () => {
34
34
  });
35
35
 
36
36
  test('file icon with aria label', () => {
37
- const label = 'My icon';
37
+ const LABEL = 'My icon';
38
38
 
39
39
  render(
40
40
  <FileIcon data-testid="icon"
41
- icon={iconName}
42
- ariaLabel={label}
41
+ icon={ICON_NAME}
42
+ ariaLabel={LABEL}
43
43
  />
44
44
  );
45
45
 
46
46
  const icon = screen.getByRole('img', {hidden: true});
47
47
 
48
- expect(icon).toHaveAttribute('aria-label', label);
48
+ expect(icon).toHaveAttribute('aria-label', LABEL);
49
49
  expect(icon).not.toHaveAttribute('aria-hidden');
50
50
  });
@@ -1,43 +1,43 @@
1
1
  import { test, expect } from 'vitest';
2
2
  import { render, screen } from '@testing-library/react';
3
- import HintText from './hint-text';
3
+ import HintText from './HintText';
4
4
 
5
- const id = 'hint-text';
6
- const content = 'Hint text';
5
+ const HINT_TEXT_ID = 'hint-text';
6
+ const HINT_TEXT_CONTENT = 'Hint text';
7
7
 
8
8
  test('hint test renders correctly', () => {
9
9
  render(
10
10
  <HintText data-testid="hint-text"
11
- id={id}
12
- text={content}
11
+ id={HINT_TEXT_ID}
12
+ text={HINT_TEXT_CONTENT}
13
13
  />
14
14
  );
15
15
 
16
16
  const hintText = screen.getByTestId('hint-text');
17
17
  expect(hintText).toHaveClass('ds_hint-text');
18
- expect(hintText).toHaveAttribute('id', id);
18
+ expect(hintText).toHaveAttribute('id', HINT_TEXT_ID);
19
19
  expect(hintText.tagName).toEqual('P');
20
- expect(hintText.textContent).toEqual(content);
20
+ expect(hintText.textContent).toEqual(HINT_TEXT_CONTENT);
21
21
  });
22
22
 
23
23
  test('hint test with children instead of text', () => {
24
24
  render(
25
25
  <HintText data-testid="hint-text"
26
- id={id}
26
+ id={HINT_TEXT_ID}
27
27
  >
28
- <span>{content}</span>
28
+ <span>{HINT_TEXT_CONTENT}</span>
29
29
  </HintText>
30
30
  );
31
31
 
32
32
  const hintText = screen.getByTestId('hint-text');
33
- expect(hintText.innerHTML).toEqual(`<span>${content}</span>`);
33
+ expect(hintText.innerHTML).toEqual(`<span>${HINT_TEXT_CONTENT}</span>`);
34
34
  });
35
35
 
36
36
  test('passing additional props', () => {
37
37
  render(
38
38
  <HintText data-testid="hint-text"
39
- id={id}
40
- text={content}
39
+ id={HINT_TEXT_ID}
40
+ text={HINT_TEXT_CONTENT}
41
41
  data-test="foo"
42
42
  />
43
43
  );
@@ -1,13 +1,13 @@
1
1
  import { test, expect } from 'vitest';
2
2
  import { render, screen } from '@testing-library/react';
3
- import Icon from './icon';
3
+ import Icon from './Icon';
4
4
 
5
- const iconName = 'Search';
5
+ const ICON_NAME = 'Search';
6
6
 
7
7
  test('icon renders correctly', () => {
8
8
  render(
9
9
  <Icon data-testid="icon"
10
- icon={iconName}
10
+ icon={ICON_NAME}
11
11
  />
12
12
  );
13
13
 
@@ -20,24 +20,24 @@ test('icon renders correctly', () => {
20
20
  });
21
21
 
22
22
  test('icon with class name', () => {
23
- const className = 'foo';
23
+ const CLASSNAME = 'foo';
24
24
 
25
25
  render(
26
26
  <Icon data-testid="icon"
27
- icon={iconName}
28
- className={className}
27
+ icon={ICON_NAME}
28
+ className={CLASSNAME}
29
29
  />
30
30
  );
31
31
 
32
32
  const icon = screen.getByRole('img', {hidden: true});
33
33
 
34
- expect(icon).toHaveClass('foo', 'ds_icon');
34
+ expect(icon).toHaveClass(CLASSNAME);
35
35
  });
36
36
 
37
37
  test('icon with fill', () => {
38
38
  render(
39
39
  <Icon data-testid="icon"
40
- icon={iconName}
40
+ icon={ICON_NAME}
41
41
  fill
42
42
  />
43
43
  );
@@ -48,32 +48,32 @@ test('icon with fill', () => {
48
48
  });
49
49
 
50
50
  test('icon with size', () => {
51
- const size = 48;
51
+ const ICON_SIZE = 48;
52
52
 
53
53
  render(
54
54
  <Icon data-testid="icon"
55
- icon={iconName}
56
- iconSize={size}
55
+ icon={ICON_NAME}
56
+ iconSize={ICON_SIZE}
57
57
  />
58
58
  );
59
59
 
60
60
  const icon = screen.getByRole('img', {hidden: true});
61
61
 
62
- expect(icon).toHaveClass(`ds_icon--${size}`);
62
+ expect(icon).toHaveClass(`ds_icon--${ICON_SIZE}`);
63
63
  });
64
64
 
65
65
  test('icon with aria label', () => {
66
- const label = 'My icon';
66
+ const ARIA_LABEL = 'My icon';
67
67
 
68
68
  render(
69
69
  <Icon data-testid="icon"
70
- icon={iconName}
71
- ariaLabel={label}
70
+ icon={ICON_NAME}
71
+ ariaLabel={ARIA_LABEL}
72
72
  />
73
73
  );
74
74
 
75
75
  const icon = screen.getByRole('img', {hidden: true});
76
76
 
77
- expect(icon).toHaveAttribute('aria-label', label);
77
+ expect(icon).toHaveAttribute('aria-label', ARIA_LABEL);
78
78
  expect(icon).not.toHaveAttribute('aria-hidden');
79
79
  });
@@ -1,20 +1,20 @@
1
1
  import { test, expect } from 'vitest';
2
2
  import { render } from '@testing-library/react';
3
- import ScreenReaderText from './screen-reader-text';
3
+ import ScreenReaderText from './ScreenReaderText';
4
4
 
5
- const content = 'My content';
5
+ const CONTENT = 'My content';
6
6
 
7
7
  test('screen reader text renders correctly', () => {
8
8
  render(
9
9
  <ScreenReaderText>
10
- {content}
10
+ {CONTENT}
11
11
  </ScreenReaderText>
12
12
  );
13
13
 
14
14
  const srtext = document.querySelector('span');
15
15
 
16
16
  expect(srtext).toHaveClass('visually-hidden');
17
- expect(srtext?.textContent).toEqual(content)
17
+ expect(srtext?.textContent).toEqual(CONTENT)
18
18
  });
19
19
 
20
20
  test('passing additional props', () => {
@@ -22,7 +22,7 @@ test('passing additional props', () => {
22
22
  <ScreenReaderText
23
23
  data-test="foo"
24
24
  >
25
- {content}
25
+ {CONTENT}
26
26
  </ScreenReaderText>
27
27
  );
28
28
 
@@ -1,13 +1,13 @@
1
1
  import { test, expect } from 'vitest';
2
2
  import { render } from '@testing-library/react';
3
- import WrapperTag from './wrapper-tag';
3
+ import WrapperTag from './WrapperTag';
4
4
 
5
- const content = 'My content';
5
+ const CONTENT = 'My content';
6
6
 
7
7
  test('wrapper tag renders correctly', () => {
8
8
  render(
9
9
  <WrapperTag id="foo">
10
- {content}
10
+ {CONTENT}
11
11
  </WrapperTag>
12
12
  );
13
13
 
@@ -21,7 +21,7 @@ test('wrapper tag widh tag name', () => {
21
21
  <WrapperTag id="foo"
22
22
  tagName="section"
23
23
  >
24
- {content}
24
+ {CONTENT}
25
25
  </WrapperTag>
26
26
  );
27
27
 
@@ -33,7 +33,7 @@ test('wrapper tag widh tag name', () => {
33
33
  test('passing additional props', () => {
34
34
  render(
35
35
  <WrapperTag id="foo" data-test="foo">
36
- {content}
36
+ {CONTENT}
37
37
  </WrapperTag>
38
38
  );
39
39
 
@@ -1,18 +1,18 @@
1
1
  import { test, expect } from 'vitest';
2
2
  import { render, screen, within } from '@testing-library/react';
3
- import Accordion from './accordion';
3
+ import Accordion from './Accordion';
4
4
 
5
- const id = 'my-accordion';
6
- const itemId = 'my-accordion-item';
7
- const titleText = 'Healthcare for veterans';
8
- const contentText = `Veterans are entitled to the same healthcare as any citizen. And there
5
+ const ACCORDION_ID = 'my-accordion';
6
+ const ACCORDION_ITEM_ID = 'my-accordion-item';
7
+ const TITLE_TEXT = 'Healthcare for veterans';
8
+ const CONTENT_TEXT = `Veterans are entitled to the same healthcare as any citizen. And there
9
9
  are health care options and support available specifically for veterans`;
10
10
 
11
11
  test('accordion renders correctly', () => {
12
- const defaultHeaderLevel = 'h3';
12
+ const DEFAULT_HEADING_LEVEL = 'h3';
13
13
 
14
14
  render(
15
- <Accordion id={id} data-testid={id}>
15
+ <Accordion id={ACCORDION_ID} data-testid={ACCORDION_ID}>
16
16
  <Accordion.Item id="accordion-1" title="Healthcare for veterans">
17
17
  <p>Veterans are entitled to the same healthcare as any citizen. And there
18
18
  are health care options and support available specifically for veterans.</p>
@@ -30,7 +30,7 @@ test('accordion renders correctly', () => {
30
30
  </Accordion>
31
31
  );
32
32
 
33
- const accordion = screen.getByTestId(id);
33
+ const accordion = screen.getByTestId(ACCORDION_ID);
34
34
  const openAllButton = document.querySelector('.ds_accordion__open-all');
35
35
  const accordionItems = document.querySelectorAll('.ds_accordion-item');
36
36
  const firstAccordionTitle = document.querySelector('.ds_accordion-item__title');
@@ -45,12 +45,12 @@ test('accordion renders correctly', () => {
45
45
 
46
46
  expect(accordionItems.length).toEqual(3);
47
47
 
48
- expect(firstAccordionTitle?.tagName).toEqual(defaultHeaderLevel.toUpperCase());
48
+ expect(firstAccordionTitle?.tagName).toEqual(DEFAULT_HEADING_LEVEL.toUpperCase());
49
49
  });
50
50
 
51
51
  test('accordion without open all', () => {
52
52
  render(
53
- <Accordion id={id} data-testid={id} hideOpenAll>
53
+ <Accordion id={ACCORDION_ID} data-testid={ACCORDION_ID} hideOpenAll>
54
54
  <Accordion.Item id="accordion-1" title="Healthcare for veterans">
55
55
  <p>Veterans are entitled to the same healthcare as any citizen. And there
56
56
  are health care options and support available specifically for veterans.</p>
@@ -75,7 +75,7 @@ test('accordion without open all', () => {
75
75
 
76
76
  test('empty accordion has no open all', () => {
77
77
  render(
78
- <Accordion id={id} data-testid={id} hideOpenAll>
78
+ <Accordion id={ACCORDION_ID} data-testid={ACCORDION_ID} hideOpenAll>
79
79
  </Accordion>
80
80
  );
81
81
 
@@ -84,11 +84,11 @@ test('empty accordion has no open all', () => {
84
84
  expect(openAllButton).toBeNull();
85
85
  })
86
86
 
87
- test('accordion with custom header level', () => {
88
- const headerLevel = 'h2';
87
+ test('accordion with custom heading level', () => {
88
+ const HEADING_LEVEL = 'h2';
89
89
 
90
90
  render(
91
- <Accordion id={id} data-testid={id} headerLevel={headerLevel}>
91
+ <Accordion id={ACCORDION_ID} data-testid={ACCORDION_ID} headingLevel={HEADING_LEVEL}>
92
92
  <Accordion.Item id="accordion-1" title="Healthcare for veterans">
93
93
  <p>Veterans are entitled to the same healthcare as any citizen. And there
94
94
  are health care options and support available specifically for veterans.</p>
@@ -99,37 +99,37 @@ test('accordion with custom header level', () => {
99
99
  );
100
100
 
101
101
  const firstAccordionTitle = document.querySelector('.ds_accordion-item__title');
102
- expect(firstAccordionTitle?.tagName).toEqual(headerLevel.toUpperCase());
102
+ expect(firstAccordionTitle?.tagName).toEqual(HEADING_LEVEL.toUpperCase());
103
103
  });
104
104
 
105
105
  test('passing additional props to accordion', () => {
106
106
  render(
107
- <Accordion id={id} data-testid={id} data-test="foo">
107
+ <Accordion id={ACCORDION_ID} data-testid={ACCORDION_ID} data-test="foo">
108
108
  </Accordion>
109
109
  );
110
110
 
111
- const accordion = screen.getByTestId(id);
111
+ const accordion = screen.getByTestId(ACCORDION_ID);
112
112
  expect(accordion?.dataset.test).toEqual('foo');
113
113
  });
114
114
 
115
115
  test('passing additional CSS classes', () => {
116
116
  render(
117
- <Accordion id={id} data-testid={id} className="foo">
117
+ <Accordion id={ACCORDION_ID} data-testid={ACCORDION_ID} className="foo">
118
118
  </Accordion>
119
119
  );
120
120
 
121
- const accordion = screen.getByTestId(id);
121
+ const accordion = screen.getByTestId(ACCORDION_ID);
122
122
  expect(accordion).toHaveClass('foo', 'ds_accordion');
123
123
  });
124
124
 
125
125
  test('accordion item renders correctly', () => {
126
126
  render(
127
- <Accordion.Item id={itemId} data-testid={itemId} title={titleText}>
128
- <p>{contentText}</p>
127
+ <Accordion.Item id={ACCORDION_ITEM_ID} data-testid={ACCORDION_ITEM_ID} title={TITLE_TEXT}>
128
+ <p>{CONTENT_TEXT}</p>
129
129
  </Accordion.Item>
130
130
  );
131
131
 
132
- const accordionItem = screen.getByTestId(itemId);
132
+ const accordionItem = screen.getByTestId(ACCORDION_ITEM_ID);
133
133
  const input = within(accordionItem).getByRole('checkbox');
134
134
  const header = document.querySelector('.ds_accordion-item__header');
135
135
  const title = header?.querySelector('.ds_accordion-item__title');
@@ -138,16 +138,16 @@ test('accordion item renders correctly', () => {
138
138
  const body = document.querySelector('.ds_accordion-item__body');
139
139
 
140
140
  expect(accordionItem).toHaveClass('ds_accordion-item');
141
- expect(accordionItem).toHaveAttribute('id', itemId);
141
+ expect(accordionItem).toHaveAttribute('id', ACCORDION_ITEM_ID);
142
142
 
143
143
  expect(input).toHaveClass('ds_accordion-item__control', 'visually-hidden')
144
- expect(input).toHaveAttribute('id', `${itemId}-control`);
144
+ expect(input).toHaveAttribute('id', `${ACCORDION_ITEM_ID}-control`);
145
145
 
146
146
  expect(header?.tagName).toEqual('DIV');
147
147
 
148
- expect(title).toHaveAttribute('id', `panel-${itemId}-heading`);
148
+ expect(title).toHaveAttribute('id', `panel-${ACCORDION_ITEM_ID}-heading`);
149
149
  expect(title?.tagName).toEqual('H3');
150
- expect(title?.textContent).toEqual(titleText);
150
+ expect(title?.textContent).toEqual(TITLE_TEXT);
151
151
 
152
152
  expect(indicator?.tagName).toEqual('SPAN');
153
153
 
@@ -156,12 +156,12 @@ test('accordion item renders correctly', () => {
156
156
  expect(label?.textContent).toEqual('Show this section');
157
157
  expect(label?.children[0]).toHaveClass('visually-hidden');
158
158
 
159
- expect(body?.innerHTML).toEqual(`<p>${contentText}</p>`);
159
+ expect(body?.innerHTML).toEqual(`<p>${CONTENT_TEXT}</p>`);
160
160
  });
161
161
 
162
162
  test('accordion items without ID are given unique IDs', () => {
163
163
  render(
164
- <Accordion id={id} data-testid={id} hideOpenAll>
164
+ <Accordion id={ACCORDION_ID} data-testid={ACCORDION_ID} hideOpenAll>
165
165
  <Accordion.Item data-testid="item1" title="Healthcare for veterans">
166
166
  <p>Veterans are entitled to the same healthcare as any citizen. And there
167
167
  are health care options and support available specifically for veterans.</p>
@@ -194,12 +194,12 @@ test('accordion items without ID are given unique IDs', () => {
194
194
 
195
195
  test('open accordion item', () => {
196
196
  render(
197
- <Accordion.Item open id={itemId} data-testid={itemId} title={titleText}>
198
- <p>{contentText}</p>
197
+ <Accordion.Item open id={ACCORDION_ITEM_ID} data-testid={ACCORDION_ITEM_ID} title={TITLE_TEXT}>
198
+ <p>{CONTENT_TEXT}</p>
199
199
  </Accordion.Item>
200
200
  );
201
201
 
202
- const accordionItem = screen.getByTestId(itemId);
202
+ const accordionItem = screen.getByTestId(ACCORDION_ITEM_ID);
203
203
  const input = within(accordionItem).getByRole('checkbox');
204
204
 
205
205
  expect(input).toHaveAttribute('checked');
@@ -207,7 +207,7 @@ test('open accordion item', () => {
207
207
 
208
208
  test('passing additional props to accordion item', () => {
209
209
  render(
210
- <Accordion.Item id={itemId} data-testid={itemId} title="Healthcare for veterans" data-test="foo">
210
+ <Accordion.Item id={ACCORDION_ITEM_ID} data-testid={ACCORDION_ITEM_ID} title="Healthcare for veterans" data-test="foo">
211
211
  <p>Veterans are entitled to the same healthcare as any citizen. And there
212
212
  are health care options and support available specifically for veterans.</p>
213
213
  <p>If you have a health condition that’s related to your service, you’re
@@ -215,13 +215,13 @@ test('passing additional props to accordion item', () => {
215
215
  </Accordion.Item>
216
216
  );
217
217
 
218
- const accordionItem = screen.getByTestId(itemId);
218
+ const accordionItem = screen.getByTestId(ACCORDION_ITEM_ID);
219
219
  expect(accordionItem?.dataset.test).toEqual('foo');
220
220
  });
221
221
 
222
222
  test('passing additional CSS classes', () => {
223
223
  render(
224
- <Accordion.Item id={itemId} data-testid={itemId} title="Healthcare for veterans" className="foo">
224
+ <Accordion.Item id={ACCORDION_ITEM_ID} data-testid={ACCORDION_ITEM_ID} title="Healthcare for veterans" className="foo">
225
225
  <p>Veterans are entitled to the same healthcare as any citizen. And there
226
226
  are health care options and support available specifically for veterans.</p>
227
227
  <p>If you have a health condition that’s related to your service, you’re
@@ -229,6 +229,6 @@ test('passing additional CSS classes', () => {
229
229
  </Accordion.Item>
230
230
  );
231
231
 
232
- const accordionItem = screen.getByTestId(itemId);
232
+ const accordionItem = screen.getByTestId(ACCORDION_ITEM_ID);
233
233
  expect(accordionItem).toHaveClass('foo', 'ds_accordion-item');
234
234
  });
@@ -1,5 +1,5 @@
1
1
  import React, { Children, useEffect, useRef } from 'react';
2
- import WrapperTag from '../../common/wrapper-tag';
2
+ import WrapperTag from '../../common/WrapperTag';
3
3
  // @ts-ignore
4
4
  import DSAccordion from '@scottish-government/design-system/src/components/accordion/accordion';
5
5
 
@@ -8,7 +8,7 @@ let accordionItemCounter = 0;
8
8
  const AccordionItem: React.FC<SGDS.Component.Accordion.Item> = ({
9
9
  children,
10
10
  className,
11
- headerLevel = 'h3',
11
+ headingLevel = 'h3',
12
12
  id: rawId,
13
13
  open = false,
14
14
  title,
@@ -39,7 +39,7 @@ const AccordionItem: React.FC<SGDS.Component.Accordion.Item> = ({
39
39
  <WrapperTag
40
40
  id={`panel-${processedId}-heading`}
41
41
  className="ds_accordion-item__title"
42
- tagName={headerLevel}
42
+ tagName={headingLevel}
43
43
  >
44
44
  {title}
45
45
  </WrapperTag>
@@ -62,7 +62,7 @@ const Accordion: React.FC<SGDS.Component.Accordion>
62
62
  & { Item: React.FC<SGDS.Component.Accordion.Item> } = ({
63
63
  children,
64
64
  className,
65
- headerLevel = 'h3',
65
+ headingLevel = 'h3',
66
66
  hideOpenAll,
67
67
  ...props
68
68
  }) => {
@@ -79,7 +79,7 @@ const Accordion: React.FC<SGDS.Component.Accordion>
79
79
  }
80
80
 
81
81
  function processChild(child: any) {
82
- return React.cloneElement(child, { headerLevel: headerLevel });
82
+ return React.cloneElement(child, { headingLevel: headingLevel });
83
83
  }
84
84
 
85
85
  return (
@@ -1,6 +1,6 @@
1
1
  import { test, expect } from 'vitest';
2
- import { render, screen } from '@testing-library/react';
3
- import AspectBox from './aspect-box';
2
+ import { render } from '@testing-library/react';
3
+ import AspectBox from './AspectBox';
4
4
 
5
5
  test('aspect box renders correctly', () => {
6
6
  render(
@@ -1,6 +1,6 @@
1
1
  import { test, expect } from 'vitest';
2
2
  import { render, screen, within } from '@testing-library/react';
3
- import BackToTop from './back-to-top';
3
+ import BackToTop from './BackToTop';
4
4
 
5
5
  test('back to top renders correctly', () => {
6
6
  render(
@@ -1,7 +1,7 @@
1
1
  import { useEffect, useRef } from 'react';
2
+ import Icon from '../../common/Icon';
2
3
  // @ts-ignore
3
4
  import DSBackToTop from '@scottish-government/design-system/src/components/back-to-top/back-to-top';
4
- import Icon from '../../common/icon';
5
5
 
6
6
  const BackToTop: React.FC<SGDS.Component.BackToTop> = ({
7
7
  className,