@scottish-government/designsystem-react 0.12.1 → 0.13.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 (227) hide show
  1. package/.storybook/main.ts +6 -6
  2. package/.storybook/sgdsArgTypes.ts +84 -43
  3. package/CHANGELOG.md +26 -0
  4. package/eslint.config.mjs +32 -0
  5. package/package.json +8 -3
  6. package/src/common/AbstractNotificationBanner/AbstractNotificationBanner.tsx +5 -4
  7. package/src/common/AbstractNotificationBanner/types.ts +15 -0
  8. package/src/common/ActionLink/ActionLink.tsx +3 -1
  9. package/src/common/ActionLink/types.ts +8 -0
  10. package/src/common/ConditionalWrapper/ConditionalWrapper.tsx +10 -2
  11. package/src/common/ConditionalWrapper/types.ts +4 -0
  12. package/src/common/FileIcon/FileIcon.tsx +2 -1
  13. package/src/common/FileIcon/types.ts +7 -0
  14. package/src/common/HintText/HintText.test.tsx +3 -15
  15. package/src/common/HintText/HintText.tsx +4 -4
  16. package/src/common/HintText/types.ts +4 -0
  17. package/src/common/Icon/Icon.tsx +2 -1
  18. package/src/common/Icon/types.ts +9 -0
  19. package/src/common/ScreenReaderText/ScreenReaderText.tsx +1 -1
  20. package/src/common/WrapperTag/WrapperTag.tsx +5 -3
  21. package/src/common/WrapperTag/types.ts +3 -0
  22. package/src/components/Accordion/Accordion.Item.stories.tsx +1 -5
  23. package/src/components/Accordion/Accordion.stories.tsx +5 -5
  24. package/src/components/Accordion/Accordion.tsx +5 -4
  25. package/src/components/Accordion/types.ts +13 -0
  26. package/src/components/AspectBox/AspectBox.stories.tsx +1 -2
  27. package/src/components/AspectBox/AspectBox.tsx +5 -4
  28. package/src/components/AspectBox/types.ts +3 -0
  29. package/src/components/BackToTop/BackToTop.tsx +3 -2
  30. package/src/components/BackToTop/types.ts +3 -0
  31. package/src/components/Breadcrumbs/Breadcrumbs.tsx +4 -2
  32. package/src/components/Breadcrumbs/types.ts +6 -0
  33. package/src/components/Button/Button.tsx +2 -1
  34. package/src/components/Button/ButtonGroup.tsx +3 -1
  35. package/src/components/Button/types.ts +21 -0
  36. package/src/components/CategoryItem/CategoryItem.tsx +7 -4
  37. package/src/components/CategoryItem/types.ts +10 -0
  38. package/src/components/CategoryList/CategoryList.tsx +4 -2
  39. package/src/components/CategoryList/types.ts +5 -0
  40. package/src/components/Checkbox/Checkbox.stories.tsx +3 -3
  41. package/src/components/Checkbox/Checkbox.tsx +5 -4
  42. package/src/components/Checkbox/CheckboxGroup.tsx +3 -3
  43. package/src/components/Checkbox/types.ts +9 -0
  44. package/src/components/ConfirmationMessage/ConfirmationMessage.tsx +2 -1
  45. package/src/components/ConfirmationMessage/types.ts +7 -0
  46. package/src/components/ContentsNav/ContentsNav.stories.tsx +5 -1
  47. package/src/components/ContentsNav/ContentsNav.tsx +3 -2
  48. package/src/components/ContentsNav/types.ts +11 -0
  49. package/src/components/CookieBanner/CookieBanner.Buttons.stories.tsx +3 -3
  50. package/src/components/CookieBanner/CookieBanner.stories.tsx +6 -6
  51. package/src/components/CookieBanner/CookieBanner.test.tsx +6 -0
  52. package/src/components/CookieBanner/CookieBanner.tsx +13 -3
  53. package/src/components/DatePicker/DatePicker.test.tsx +0 -5
  54. package/src/components/DatePicker/DatePicker.tsx +3 -2
  55. package/src/components/DatePicker/types.ts +20 -0
  56. package/src/components/Details/Details.stories.tsx +1 -1
  57. package/src/components/Details/Details.tsx +3 -1
  58. package/src/components/Details/types.ts +4 -0
  59. package/src/components/ErrorMessage/ErrorMessage.tsx +3 -1
  60. package/src/components/ErrorMessage/types.ts +3 -0
  61. package/src/components/ErrorSummary/ErrorSummary.test.tsx +1 -1
  62. package/src/components/ErrorSummary/ErrorSummary.tsx +3 -2
  63. package/src/components/ErrorSummary/types.ts +11 -0
  64. package/src/components/FileDownload/FileDownload.tsx +2 -1
  65. package/src/components/FileDownload/types.ts +11 -0
  66. package/src/components/HideThisPage/HideThisPage.tsx +3 -2
  67. package/src/components/HideThisPage/types.ts +3 -0
  68. package/src/components/InsetText/InsetText.tsx +1 -1
  69. package/src/components/NotificationBanner/NotificationBanner.stories.tsx +2 -2
  70. package/src/components/NotificationBanner/NotificationBanner.tsx +5 -4
  71. package/src/components/NotificationPanel/NotificationPanel.tsx +2 -1
  72. package/src/components/NotificationPanel/types.ts +7 -0
  73. package/src/components/PageHeader/PageHeader.tsx +3 -1
  74. package/src/components/PageHeader/types.ts +5 -0
  75. package/src/components/PageMetadata/PageMetadata.stories.tsx +1 -1
  76. package/src/components/PageMetadata/PageMetadata.tsx +5 -3
  77. package/src/components/PageMetadata/types.ts +7 -0
  78. package/src/components/Pagination/Pagination.tsx +5 -3
  79. package/src/components/Pagination/types.ts +20 -0
  80. package/src/components/PhaseBanner/PhaseBanner.stories.tsx +1 -4
  81. package/src/components/PhaseBanner/PhaseBanner.tsx +2 -1
  82. package/src/components/PhaseBanner/types.ts +3 -0
  83. package/src/components/Question/Question.tsx +3 -2
  84. package/src/components/Question/types.ts +9 -0
  85. package/src/components/RadioButton/RadioButton.tsx +5 -4
  86. package/src/components/RadioButton/RadioGroup.tsx +2 -1
  87. package/src/components/RadioButton/types.ts +12 -0
  88. package/src/components/SearchFacets/SearchFacets.Group.stories.tsx +2 -3
  89. package/src/components/SearchFacets/SearchFacets.stories.tsx +1 -1
  90. package/src/components/SearchFacets/SearchFacets.tsx +7 -6
  91. package/src/components/SearchFacets/types.ts +14 -0
  92. package/src/components/SearchFilters/SearchFilters.Panel.stories.tsx +18 -7
  93. package/src/components/SearchFilters/SearchFilters.stories.tsx +1 -1
  94. package/src/components/SearchFilters/SearchFilters.tsx +4 -3
  95. package/src/components/SearchFilters/types.ts +14 -0
  96. package/src/components/SearchResult/SearchResult.stories.tsx +9 -10
  97. package/src/components/SearchResult/SearchResult.tsx +9 -8
  98. package/src/components/SearchResult/types.ts +13 -0
  99. package/src/components/SearchSort/SearchSort.stories.tsx +2 -1
  100. package/src/components/SearchSort/SearchSort.tsx +2 -1
  101. package/src/components/SearchSort/types.ts +7 -0
  102. package/src/components/Select/Select.tsx +5 -4
  103. package/src/components/Select/types.ts +7 -0
  104. package/src/components/SequentialNavigation/SequentialNavigation.tsx +6 -4
  105. package/src/components/SequentialNavigation/types.ts +12 -0
  106. package/src/components/SideNavigation/SideNavigation.tsx +5 -4
  107. package/src/components/SideNavigation/types.ts +16 -0
  108. package/src/components/SiteFooter/SiteFooter.tsx +7 -6
  109. package/src/components/SiteFooter/types.ts +20 -0
  110. package/src/components/SiteHeader/SiteHeader.stories.tsx +4 -3
  111. package/src/components/SiteHeader/SiteHeader.tsx +10 -9
  112. package/src/components/SiteHeader/types.ts +22 -0
  113. package/src/components/SiteNavigation/SiteNavigation.tsx +4 -2
  114. package/src/components/SiteNavigation/types.ts +11 -0
  115. package/src/components/SiteSearch/SiteSearch.stories.tsx +4 -2
  116. package/src/components/SiteSearch/SiteSearch.tsx +6 -5
  117. package/src/components/SiteSearch/types.ts +13 -0
  118. package/src/components/SkipLinks/SkipLinks.stories.tsx +3 -3
  119. package/src/components/SkipLinks/SkipLinks.tsx +4 -4
  120. package/src/components/SkipLinks/types.ts +9 -0
  121. package/src/components/SummaryCard/SummaryCard.test.tsx +0 -11
  122. package/src/components/SummaryCard/SummaryCard.tsx +6 -4
  123. package/src/components/SummaryCard/types.ts +6 -0
  124. package/src/components/SummaryList/SummaryList.Item.stories.tsx +5 -5
  125. package/src/components/SummaryList/SummaryList.stories.tsx +1 -1
  126. package/src/components/SummaryList/SummaryList.test.tsx +1 -6
  127. package/src/components/SummaryList/SummaryList.tsx +8 -6
  128. package/src/components/SummaryList/types.ts +7 -0
  129. package/src/components/Table/Table.tsx +3 -2
  130. package/src/components/Table/types.ts +6 -0
  131. package/src/components/Tabs/Tabs.Item.stories.tsx +7 -7
  132. package/src/components/Tabs/Tabs.stories.tsx +3 -3
  133. package/src/components/Tabs/Tabs.tsx +7 -5
  134. package/src/components/Tabs/types.ts +19 -0
  135. package/src/components/Tag/Tag.tsx +3 -1
  136. package/src/components/Tag/types.ts +5 -0
  137. package/src/components/TaskList/TaskList.Group.stories.tsx +0 -5
  138. package/src/components/TaskList/TaskList.stories.tsx +0 -1
  139. package/src/components/TaskList/TaskList.tsx +12 -9
  140. package/src/components/TaskList/types.ts +20 -0
  141. package/src/components/TextInput/TextInput.tsx +6 -6
  142. package/src/components/TextInput/types.ts +12 -0
  143. package/src/components/Textarea/Textarea.tsx +6 -5
  144. package/src/components/WarningText/WarningText.tsx +1 -1
  145. package/src/hooks/useTracking/useTracking.test.tsx +5 -7
  146. package/src/hooks/useTracking/useTracking.ts +1 -1
  147. package/src/images/icons/arrow_upward.tsx +10 -10
  148. package/src/images/icons/calendar_today.tsx +10 -10
  149. package/src/images/icons/cancel.tsx +8 -8
  150. package/src/images/icons/check_circle.tsx +10 -10
  151. package/src/images/icons/chevron_left.tsx +10 -10
  152. package/src/images/icons/chevron_right.tsx +10 -10
  153. package/src/images/icons/close.tsx +10 -10
  154. package/src/images/icons/description.tsx +10 -10
  155. package/src/images/icons/double_chevron_left.tsx +8 -8
  156. package/src/images/icons/double_chevron_right.tsx +8 -8
  157. package/src/images/icons/error.tsx +10 -10
  158. package/src/images/icons/expand_less.tsx +10 -10
  159. package/src/images/icons/expand_more.tsx +10 -10
  160. package/src/images/icons/list.tsx +13 -13
  161. package/src/images/icons/menu.tsx +10 -10
  162. package/src/images/icons/priority_high.tsx +11 -11
  163. package/src/images/icons/search.tsx +10 -10
  164. package/src/shared-types.ts +40 -0
  165. package/vite.config.ts +2 -1
  166. package/@types/common/AbstractNotificationBanner.d.ts +0 -17
  167. package/@types/common/ActionLink.d.ts +0 -8
  168. package/@types/common/ConditionalWrapper.d.ts +0 -6
  169. package/@types/common/FileIcon.d.ts +0 -7
  170. package/@types/common/HintText.d.ts +0 -6
  171. package/@types/common/Icon.d.ts +0 -9
  172. package/@types/common/ScreenReaderText.d.ts +0 -4
  173. package/@types/common/WrapperTag.d.ts +0 -5
  174. package/@types/components/Accordion.d.ts +0 -15
  175. package/@types/components/AspectBox.d.ts +0 -5
  176. package/@types/components/BackToTop.d.ts +0 -5
  177. package/@types/components/Breadcrumbs.d.ts +0 -11
  178. package/@types/components/Button.d.ts +0 -17
  179. package/@types/components/ButtonGroup.d.ts +0 -5
  180. package/@types/components/CategoryItem.d.ts +0 -10
  181. package/@types/components/CategoryList.d.ts +0 -7
  182. package/@types/components/Checkbox.d.ts +0 -11
  183. package/@types/components/ConfirmationMessage.d.ts +0 -7
  184. package/@types/components/ContentsNav.d.ts +0 -13
  185. package/@types/components/DatePicker.d.ts +0 -20
  186. package/@types/components/Details.d.ts +0 -6
  187. package/@types/components/ErrorMessage.d.ts +0 -5
  188. package/@types/components/ErrorSummary.d.ts +0 -12
  189. package/@types/components/FileDownload.d.ts +0 -11
  190. package/@types/components/HideThisPage.d.ts +0 -5
  191. package/@types/components/InsetText.d.ts +0 -5
  192. package/@types/components/Metadata.d.ts +0 -11
  193. package/@types/components/NotificationPanel.d.ts +0 -7
  194. package/@types/components/PageHeader.d.ts +0 -7
  195. package/@types/components/Pagination.d.ts +0 -22
  196. package/@types/components/PhaseBanner.d.ts +0 -5
  197. package/@types/components/Question.d.ts +0 -11
  198. package/@types/components/RadioButton.d.ts +0 -14
  199. package/@types/components/SearchFacets.d.ts +0 -18
  200. package/@types/components/SearchFilters.d.ts +0 -14
  201. package/@types/components/SearchResult.d.ts +0 -30
  202. package/@types/components/SearchSort.d.ts +0 -9
  203. package/@types/components/Select.d.ts +0 -7
  204. package/@types/components/SequentialNavigation.d.ts +0 -14
  205. package/@types/components/SideNavigation.d.ts +0 -18
  206. package/@types/components/SiteFooter.d.ts +0 -25
  207. package/@types/components/SiteHeader.d.ts +0 -20
  208. package/@types/components/SiteNavigation.d.ts +0 -13
  209. package/@types/components/SiteSearch.d.ts +0 -14
  210. package/@types/components/SkipLinks.d.ts +0 -13
  211. package/@types/components/SummaryCard.d.ts +0 -6
  212. package/@types/components/SummaryList.d.ts +0 -14
  213. package/@types/components/Table.d.ts +0 -8
  214. package/@types/components/Tabs.d.ts +0 -21
  215. package/@types/components/Tag.d.ts +0 -5
  216. package/@types/components/TaskList.d.ts +0 -22
  217. package/@types/components/TextInput.d.ts +0 -12
  218. package/@types/components/Textarea.d.ts +0 -4
  219. package/@types/components/WarningText.d.ts +0 -5
  220. package/@types/global.d.ts +0 -1
  221. package/@types/sgds.d.ts +0 -49
  222. package/dist/index.d.ts +0 -4
  223. package/dist/index.js +0 -40
  224. package/dist/tsconfig.tsbuildinfo +0 -1
  225. package/src/components/FeatureHeader/FeatureHeader.stories.tsx +0 -60
  226. package/src/components/FeatureHeader/FeatureHeader.tsx +0 -94
  227. package/src/components/FeatureHeader/index.ts +0 -1
@@ -1,6 +1,6 @@
1
1
  import { useEffect } from 'react';
2
2
 
3
- //@ts-ignore
3
+ // @ts-expect-error no types from core SGDS
4
4
  import DSTracking from '@scottish-government/design-system/src/base/tools/tracking/tracking';
5
5
 
6
6
  export default function () {
@@ -1,15 +1,15 @@
1
1
  import * as React from "react";
2
2
  import type { SVGProps } from "react";
3
3
  const SvgArrowUpward = (props: SVGProps<SVGSVGElement>) => (
4
- <svg
5
- xmlns="http://www.w3.org/2000/svg"
6
- viewBox="0 0 24 24"
7
- fill="#000000"
8
- role="img"
9
- {...props}
10
- >
11
- <path d="M0 0h24v24H0V0z" fill="none" />
12
- <path d="M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z" />
13
- </svg>
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ viewBox="0 0 24 24"
7
+ fill="#000000"
8
+ role="img"
9
+ {...props}
10
+ >
11
+ <path d="M0 0h24v24H0V0z" fill="none" />
12
+ <path d="M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z" />
13
+ </svg>
14
14
  );
15
15
  export default SvgArrowUpward;
@@ -1,15 +1,15 @@
1
1
  import * as React from "react";
2
2
  import type { SVGProps } from "react";
3
3
  const SvgCalendarToday = (props: SVGProps<SVGSVGElement>) => (
4
- <svg
5
- xmlns="http://www.w3.org/2000/svg"
6
- viewBox="0 0 24 24"
7
- fill="#000000"
8
- role="img"
9
- {...props}
10
- >
11
- <path d="M0 0h24v24H0z" fill="none" />
12
- <path d="M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 18H4V8h16v13z" />
13
- </svg>
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ viewBox="0 0 24 24"
7
+ fill="#000000"
8
+ role="img"
9
+ {...props}
10
+ >
11
+ <path d="M0 0h24v24H0z" fill="none" />
12
+ <path d="M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 18H4V8h16v13z" />
13
+ </svg>
14
14
  );
15
15
  export default SvgCalendarToday;
@@ -1,13 +1,13 @@
1
1
  import * as React from "react";
2
2
  import type { SVGProps } from "react";
3
3
  const SvgCancel = (props: SVGProps<SVGSVGElement>) => (
4
- <svg
5
- xmlns="http://www.w3.org/2000/svg"
6
- viewBox="0 0 24 24"
7
- role="img"
8
- {...props}
9
- >
10
- <path d="m8.4 17 3.6-3.6 3.6 3.6 1.4-1.4-3.6-3.6L17 8.4 15.6 7 12 10.6 8.4 7 7 8.4l3.6 3.6L7 15.6 8.4 17Zm3.6 5c-1.4 0-2.7-.3-3.9-.8S5.8 20 4.9 19.1s-1.6-2-2.1-3.2S2 13.4 2 12s.3-2.7.8-3.9S4 5.8 4.9 4.9s2-1.6 3.2-2.1S10.6 2 12 2s2.7.3 3.9.8 2.3 1.2 3.2 2.1 1.6 2 2.1 3.2.8 2.5.8 3.9-.3 2.7-.8 3.9-1.2 2.3-2.1 3.2-2 1.6-3.2 2.1-2.5.8-3.9.8Z" />
11
- </svg>
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ viewBox="0 0 24 24"
7
+ role="img"
8
+ {...props}
9
+ >
10
+ <path d="m8.4 17 3.6-3.6 3.6 3.6 1.4-1.4-3.6-3.6L17 8.4 15.6 7 12 10.6 8.4 7 7 8.4l3.6 3.6L7 15.6 8.4 17Zm3.6 5c-1.4 0-2.7-.3-3.9-.8S5.8 20 4.9 19.1s-1.6-2-2.1-3.2S2 13.4 2 12s.3-2.7.8-3.9S4 5.8 4.9 4.9s2-1.6 3.2-2.1S10.6 2 12 2s2.7.3 3.9.8 2.3 1.2 3.2 2.1 1.6 2 2.1 3.2.8 2.5.8 3.9-.3 2.7-.8 3.9-1.2 2.3-2.1 3.2-2 1.6-3.2 2.1-2.5.8-3.9.8Z" />
11
+ </svg>
12
12
  );
13
13
  export default SvgCancel;
@@ -1,15 +1,15 @@
1
1
  import * as React from "react";
2
2
  import type { SVGProps } from "react";
3
3
  const SvgCheckCircle = (props: SVGProps<SVGSVGElement>) => (
4
- <svg
5
- xmlns="http://www.w3.org/2000/svg"
6
- viewBox="0 0 24 24"
7
- fill="#000000"
8
- role="img"
9
- {...props}
10
- >
11
- <path d="M0 0h24v24H0z" fill="none" />
12
- <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" />
13
- </svg>
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ viewBox="0 0 24 24"
7
+ fill="#000000"
8
+ role="img"
9
+ {...props}
10
+ >
11
+ <path d="M0 0h24v24H0z" fill="none" />
12
+ <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" />
13
+ </svg>
14
14
  );
15
15
  export default SvgCheckCircle;
@@ -1,15 +1,15 @@
1
1
  import * as React from "react";
2
2
  import type { SVGProps } from "react";
3
3
  const SvgChevronLeft = (props: SVGProps<SVGSVGElement>) => (
4
- <svg
5
- xmlns="http://www.w3.org/2000/svg"
6
- viewBox="0 0 24 24"
7
- fill="#000000"
8
- role="img"
9
- {...props}
10
- >
11
- <path d="M0 0h24v24H0z" fill="none" />
12
- <path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z" />
13
- </svg>
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ viewBox="0 0 24 24"
7
+ fill="#000000"
8
+ role="img"
9
+ {...props}
10
+ >
11
+ <path d="M0 0h24v24H0z" fill="none" />
12
+ <path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z" />
13
+ </svg>
14
14
  );
15
15
  export default SvgChevronLeft;
@@ -1,15 +1,15 @@
1
1
  import * as React from "react";
2
2
  import type { SVGProps } from "react";
3
3
  const SvgChevronRight = (props: SVGProps<SVGSVGElement>) => (
4
- <svg
5
- xmlns="http://www.w3.org/2000/svg"
6
- viewBox="0 0 24 24"
7
- fill="#000000"
8
- role="img"
9
- {...props}
10
- >
11
- <path d="M0 0h24v24H0z" fill="none" />
12
- <path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z" />
13
- </svg>
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ viewBox="0 0 24 24"
7
+ fill="#000000"
8
+ role="img"
9
+ {...props}
10
+ >
11
+ <path d="M0 0h24v24H0z" fill="none" />
12
+ <path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z" />
13
+ </svg>
14
14
  );
15
15
  export default SvgChevronRight;
@@ -1,15 +1,15 @@
1
1
  import * as React from "react";
2
2
  import type { SVGProps } from "react";
3
3
  const SvgClose = (props: SVGProps<SVGSVGElement>) => (
4
- <svg
5
- xmlns="http://www.w3.org/2000/svg"
6
- viewBox="0 0 24 24"
7
- fill="#000000"
8
- role="img"
9
- {...props}
10
- >
11
- <path d="M0 0h24v24H0z" fill="none" />
12
- <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" />
13
- </svg>
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ viewBox="0 0 24 24"
7
+ fill="#000000"
8
+ role="img"
9
+ {...props}
10
+ >
11
+ <path d="M0 0h24v24H0z" fill="none" />
12
+ <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" />
13
+ </svg>
14
14
  );
15
15
  export default SvgClose;
@@ -1,15 +1,15 @@
1
1
  import * as React from "react";
2
2
  import type { SVGProps } from "react";
3
3
  const SvgDescription = (props: SVGProps<SVGSVGElement>) => (
4
- <svg
5
- xmlns="http://www.w3.org/2000/svg"
6
- viewBox="0 0 24 24"
7
- fill="#000000"
8
- role="img"
9
- {...props}
10
- >
11
- <path d="M0 0h24v24H0z" fill="none" />
12
- <path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z" />
13
- </svg>
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ viewBox="0 0 24 24"
7
+ fill="#000000"
8
+ role="img"
9
+ {...props}
10
+ >
11
+ <path d="M0 0h24v24H0z" fill="none" />
12
+ <path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z" />
13
+ </svg>
14
14
  );
15
15
  export default SvgDescription;
@@ -1,13 +1,13 @@
1
1
  import * as React from "react";
2
2
  import type { SVGProps } from "react";
3
3
  const SvgDoubleChevronLeft = (props: SVGProps<SVGSVGElement>) => (
4
- <svg
5
- xmlns="http://www.w3.org/2000/svg"
6
- viewBox="0 0 24 24"
7
- role="img"
8
- {...props}
9
- >
10
- <path d="M19 16.6 17.6 18l-6-6 6-6L19 7.4 14.4 12l4.6 4.6Zm-6.6 0L11 18l-6-6 6-6 1.4 1.4L7.8 12l4.6 4.6Z" />
11
- </svg>
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ viewBox="0 0 24 24"
7
+ role="img"
8
+ {...props}
9
+ >
10
+ <path d="M19 16.6 17.6 18l-6-6 6-6L19 7.4 14.4 12l4.6 4.6Zm-6.6 0L11 18l-6-6 6-6 1.4 1.4L7.8 12l4.6 4.6Z" />
11
+ </svg>
12
12
  );
13
13
  export default SvgDoubleChevronLeft;
@@ -1,13 +1,13 @@
1
1
  import * as React from "react";
2
2
  import type { SVGProps } from "react";
3
3
  const SvgDoubleChevronRight = (props: SVGProps<SVGSVGElement>) => (
4
- <svg
5
- xmlns="http://www.w3.org/2000/svg"
6
- viewBox="0 0 24 24"
7
- role="img"
8
- {...props}
9
- >
10
- <path d="M9.6 12 5 7.4 6.4 6l6 6-6 6L5 16.6 9.6 12Zm6.6 0-4.6-4.6L13 6l6 6-6 6-1.4-1.4 4.6-4.6Z" />
11
- </svg>
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ viewBox="0 0 24 24"
7
+ role="img"
8
+ {...props}
9
+ >
10
+ <path d="M9.6 12 5 7.4 6.4 6l6 6-6 6L5 16.6 9.6 12Zm6.6 0-4.6-4.6L13 6l6 6-6 6-1.4-1.4 4.6-4.6Z" />
11
+ </svg>
12
12
  );
13
13
  export default SvgDoubleChevronRight;
@@ -1,15 +1,15 @@
1
1
  import * as React from "react";
2
2
  import type { SVGProps } from "react";
3
3
  const SvgError = (props: SVGProps<SVGSVGElement>) => (
4
- <svg
5
- xmlns="http://www.w3.org/2000/svg"
6
- viewBox="0 0 24 24"
7
- fill="#000000"
8
- role="img"
9
- {...props}
10
- >
11
- <path d="M0 0h24v24H0z" fill="none" />
12
- <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" />
13
- </svg>
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ viewBox="0 0 24 24"
7
+ fill="#000000"
8
+ role="img"
9
+ {...props}
10
+ >
11
+ <path d="M0 0h24v24H0z" fill="none" />
12
+ <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" />
13
+ </svg>
14
14
  );
15
15
  export default SvgError;
@@ -1,15 +1,15 @@
1
1
  import * as React from "react";
2
2
  import type { SVGProps } from "react";
3
3
  const SvgExpandLess = (props: SVGProps<SVGSVGElement>) => (
4
- <svg
5
- xmlns="http://www.w3.org/2000/svg"
6
- viewBox="0 0 24 24"
7
- fill="#000000"
8
- role="img"
9
- {...props}
10
- >
11
- <path d="M0 0h24v24H0z" fill="none" />
12
- <path d="M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z" />
13
- </svg>
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ viewBox="0 0 24 24"
7
+ fill="#000000"
8
+ role="img"
9
+ {...props}
10
+ >
11
+ <path d="M0 0h24v24H0z" fill="none" />
12
+ <path d="M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z" />
13
+ </svg>
14
14
  );
15
15
  export default SvgExpandLess;
@@ -1,15 +1,15 @@
1
1
  import * as React from "react";
2
2
  import type { SVGProps } from "react";
3
3
  const SvgExpandMore = (props: SVGProps<SVGSVGElement>) => (
4
- <svg
5
- xmlns="http://www.w3.org/2000/svg"
6
- viewBox="0 0 24 24"
7
- fill="#000000"
8
- role="img"
9
- {...props}
10
- >
11
- <path d="M0 0h24v24H0z" fill="none" />
12
- <path d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z" />
13
- </svg>
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ viewBox="0 0 24 24"
7
+ fill="#000000"
8
+ role="img"
9
+ {...props}
10
+ >
11
+ <path d="M0 0h24v24H0z" fill="none" />
12
+ <path d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z" />
13
+ </svg>
14
14
  );
15
15
  export default SvgExpandMore;
@@ -1,18 +1,18 @@
1
1
  import * as React from "react";
2
2
  import type { SVGProps } from "react";
3
3
  const SvgList = (props: SVGProps<SVGSVGElement>) => (
4
- <svg
5
- xmlns="http://www.w3.org/2000/svg"
6
- viewBox="0 0 24 24"
7
- fill="#000000"
8
- role="img"
9
- {...props}
10
- >
11
- <g fill="none">
12
- <path d="M0 0h24v24H0V0z" />
13
- <path d="M0 0h24v24H0V0z" opacity={0.87} />
14
- </g>
15
- <path d="M3 13h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2V7H3v2zm4 4h14v-2H7v2zm0 4h14v-2H7v2zM7 7v2h14V7H7zm-4 6h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2V7H3v2zm4 4h14v-2H7v2zm0 4h14v-2H7v2zM7 7v2h14V7H7z" />
16
- </svg>
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ viewBox="0 0 24 24"
7
+ fill="#000000"
8
+ role="img"
9
+ {...props}
10
+ >
11
+ <g fill="none">
12
+ <path d="M0 0h24v24H0V0z" />
13
+ <path d="M0 0h24v24H0V0z" opacity={0.87} />
14
+ </g>
15
+ <path d="M3 13h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2V7H3v2zm4 4h14v-2H7v2zm0 4h14v-2H7v2zM7 7v2h14V7H7zm-4 6h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2V7H3v2zm4 4h14v-2H7v2zm0 4h14v-2H7v2zM7 7v2h14V7H7z" />
16
+ </svg>
17
17
  );
18
18
  export default SvgList;
@@ -1,15 +1,15 @@
1
1
  import * as React from "react";
2
2
  import type { SVGProps } from "react";
3
3
  const SvgMenu = (props: SVGProps<SVGSVGElement>) => (
4
- <svg
5
- xmlns="http://www.w3.org/2000/svg"
6
- viewBox="0 0 24 24"
7
- fill="#000000"
8
- role="img"
9
- {...props}
10
- >
11
- <path d="M0 0h24v24H0z" fill="none" />
12
- <path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" />
13
- </svg>
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ viewBox="0 0 24 24"
7
+ fill="#000000"
8
+ role="img"
9
+ {...props}
10
+ >
11
+ <path d="M0 0h24v24H0z" fill="none" />
12
+ <path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" />
13
+ </svg>
14
14
  );
15
15
  export default SvgMenu;
@@ -1,16 +1,16 @@
1
1
  import * as React from "react";
2
2
  import type { SVGProps } from "react";
3
3
  const SvgPriorityHigh = (props: SVGProps<SVGSVGElement>) => (
4
- <svg
5
- xmlns="http://www.w3.org/2000/svg"
6
- viewBox="0 0 24 24"
7
- fill="#000000"
8
- role="img"
9
- {...props}
10
- >
11
- <path d="M0 0h24v24H0z" fill="none" />
12
- <circle cx={12} cy={19} r={2} />
13
- <path d="M10 3h4v12h-4z" />
14
- </svg>
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ viewBox="0 0 24 24"
7
+ fill="#000000"
8
+ role="img"
9
+ {...props}
10
+ >
11
+ <path d="M0 0h24v24H0z" fill="none" />
12
+ <circle cx={12} cy={19} r={2} />
13
+ <path d="M10 3h4v12h-4z" />
14
+ </svg>
15
15
  );
16
16
  export default SvgPriorityHigh;
@@ -1,15 +1,15 @@
1
1
  import * as React from "react";
2
2
  import type { SVGProps } from "react";
3
3
  const SvgSearch = (props: SVGProps<SVGSVGElement>) => (
4
- <svg
5
- xmlns="http://www.w3.org/2000/svg"
6
- viewBox="0 0 24 24"
7
- fill="#000000"
8
- role="img"
9
- {...props}
10
- >
11
- <path d="M0 0h24v24H0z" fill="none" />
12
- <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z" />
13
- </svg>
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ viewBox="0 0 24 24"
7
+ fill="#000000"
8
+ role="img"
9
+ {...props}
10
+ >
11
+ <path d="M0 0h24v24H0z" fill="none" />
12
+ <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z" />
13
+ </svg>
14
14
  );
15
15
  export default SvgSearch;
@@ -0,0 +1,40 @@
1
+ export type HeadingLevel = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
2
+ export type IconName = 'ArrowUpward' | 'CalendarToday' | 'Cancel' | 'CheckCircle' | 'ChevronLeft' | 'ChevronRight' | 'Close' | 'Description' | 'DoubleChevronLeft' | 'DoubleChevronRight' | 'Error' | 'ExpandLess' | 'ExpandMore' | 'List' | 'Menu' | 'PriorityHigh' | 'Search';
3
+ export type DocumentIconName = 'Audio' | 'Csv' | 'Excel' | 'File' | 'Generic' | 'Geodata' | 'Ical' | 'Ico' | 'Image' | 'Odf' | 'Odg' | 'Odp' | 'Ods' | 'Odt' | 'Pdf' | 'Ppt' | 'Rtf' | 'Text' | 'Video' | 'Word' | 'Xml' | 'Zip';
4
+ export type InputWidth = 'fixed-20' | 'fixed-10' | 'fixed-5' | 'fixed-4' | 'fixed-3' | 'fixed-2' | 'fluid-three-quarters' | 'fluid-two-thirds' | 'fluid-half' | 'fluid-one-third' | 'fluid-one-quarter';
5
+ export type TagColour = 'grey' | 'green' | 'teal' | 'blue' | 'purple' | 'pink' | 'red' | 'orange' | 'yellow';
6
+ export type TextInputType = 'date' | 'datetime-local' | 'email' | 'month' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url' | 'week';
7
+
8
+ export type LinkComponentProps = {
9
+ 'aria-label'?: React.AriaAttributes['aria-label'];
10
+ 'aria-current'?: React.AriaAttributes['aria-current'];
11
+ 'aria-describedby'?: React.AriaAttributes['aria-describedby'];
12
+ children?: React.ReactNode;
13
+ className?: string;
14
+ href?: string;
15
+ onClick?: React.EventHandler<React.MouseEvent>;
16
+ }
17
+
18
+ export type LinkComponent = (linkComponent: LinkComponentProps) => React.ReactNode;
19
+
20
+ export interface CheckboxRadioBase<T> extends React.InputHTMLAttributes<T> {
21
+ hintText?: string;
22
+ label: string;
23
+ onBlur?: React.FocusEventHandler<T>;
24
+ onChange?: React.ChangeEventHandler<T>;
25
+ isSmall?: boolean;
26
+ }
27
+
28
+ export interface FormFieldBase<T> extends React.AllHTMLAttributes <T> {
29
+ errorMessage?: string;
30
+ hasError?: boolean;
31
+ hintText?: string;
32
+ label: string;
33
+ onBlur?: React.FocusEventHandler<T>;
34
+ onChange?: React.ChangeEventHandler<T>;
35
+ }
36
+
37
+ export interface TextInputBase<T> extends FormFieldBase<T> {
38
+ countThreshold?: number;
39
+ maxlength?: number;
40
+ }
package/vite.config.ts CHANGED
@@ -1,4 +1,5 @@
1
- /// <reference types="vitest/config" />
1
+ import "vitest/config";
2
+
2
3
  import { defineConfig } from 'vitest/config';
3
4
  import react from "@vitejs/plugin-react-swc";
4
5
  import { playwright } from '@vitest/browser-playwright';
@@ -1,17 +0,0 @@
1
- declare namespace SGDS.Common {
2
- namespace AbstractNotificationBanner {
3
- interface Buttons extends React.AllHTMLAttributes<HTMLDivElement> {
4
- children: React.ReactNode
5
- }
6
- }
7
-
8
- interface AbstractNotificationBanner extends React.AllHTMLAttributes<HTMLDivElement> {
9
- hasIcon?: boolean,
10
- hasColourIcon?: boolean,
11
- hasInverseIcon?: boolean,
12
- icon?: IconName,
13
- isDismissable?: boolean,
14
- title: string,
15
- ref?: any
16
- }
17
- }
@@ -1,8 +0,0 @@
1
- declare namespace SGDS.Common {
2
- interface ActionLink extends React.AllHTMLAttributes<HTMLElement> {
3
- describedby?: string,
4
- href?: string,
5
- linkComponent?: SGDS.LinkComponent,
6
- onclick?: React.EventHandler<any>
7
- }
8
- }
@@ -1,6 +0,0 @@
1
- declare namespace SGDS.Common {
2
- interface ConditionalWrapper extends React.AllHTMLAttributes<HTMLElement> {
3
- condition: boolean,
4
- wrapper: any
5
- }
6
- }
@@ -1,7 +0,0 @@
1
- declare namespace SGDS.Common {
2
- interface FileIcon extends React.AllHTMLAttributes<SVGSVGElement> {
3
- ariaLabel?: React.AriaAttributes['aria-label'],
4
- className?: string,
5
- icon: DocumentIconName
6
- }
7
- }
@@ -1,6 +0,0 @@
1
- declare namespace SGDS.Common {
2
- interface HintText extends React.AllHTMLAttributes<HTMLElement> {
3
- id?: string,
4
- text?: string
5
- }
6
- }
@@ -1,9 +0,0 @@
1
- declare namespace SGDS.Common {
2
- interface Icon extends React.AllHTMLAttributes<SVGSVGElement> {
3
- ariaLabel?: React.AriaAttributes['aria-label'],
4
- className?: string,
5
- isFilled?: boolean,
6
- icon: IconName,
7
- iconSize?: string
8
- }
9
- }
@@ -1,4 +0,0 @@
1
- declare namespace SGDS.Common {
2
- interface ScreenReaderText extends React.AllHTMLAttributes<HTMLElement> {
3
- }
4
- }
@@ -1,5 +0,0 @@
1
- declare namespace SGDS.Common {
2
- interface WrapperTag extends React.AllHTMLAttributes<HTMLElement> {
3
- tagName?: string
4
- }
5
- }
@@ -1,15 +0,0 @@
1
- declare namespace SGDS.Component {
2
- namespace Accordion {
3
- interface Item extends React.AllHTMLAttributes<HTMLElement> {
4
- id?: string,
5
- heading: string | React.ReactNode
6
- isOpen?: boolean,
7
- }
8
- }
9
-
10
- interface Accordion extends React.AllHTMLAttributes<HTMLElement> {
11
- headingLevel?: SGDS.HeadingLevel,
12
- hideOpenAll?: boolean,
13
- isSmall?: boolean
14
- }
15
- }
@@ -1,5 +0,0 @@
1
- declare namespace SGDS.Component {
2
- interface AspectBox extends React.AllHTMLAttributes<HTMLElement> {
3
- ratio?: 'square' | '1:1' | '4:3' | '16:9' | '21:9';
4
- }
5
- }
@@ -1,5 +0,0 @@
1
- declare namespace SGDS.Component {
2
- interface BackToTop extends React.AllHTMLAttributes<HTMLElement> {
3
- href?: string;
4
- }
5
- }
@@ -1,11 +0,0 @@
1
- declare namespace SGDS.Component {
2
- namespace Breadcrumbs {
3
- interface Item extends React.AllHTMLAttributes<HTMLElement> {
4
- isHidden?: boolean,
5
- linkComponent?: SGDS.LinkComponent
6
- }
7
- }
8
-
9
- interface Breadcrumbs extends React.AllHTMLAttributes<HTMLElement> {
10
- }
11
- }