@scottish-government/designsystem-react 0.12.0 → 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 (457) hide show
  1. package/.storybook/main.ts +6 -6
  2. package/.storybook/sgdsArgTypes.ts +84 -43
  3. package/CHANGELOG.md +27 -1
  4. package/dist/common/AbstractNotificationBanner/AbstractNotificationBanner.d.ts +9 -0
  5. package/dist/common/AbstractNotificationBanner/AbstractNotificationBanner.jsx +62 -0
  6. package/dist/common/AbstractNotificationBanner/index.d.ts +1 -0
  7. package/dist/common/AbstractNotificationBanner/index.js +8 -0
  8. package/dist/common/ActionLink/ActionLink.d.ts +5 -0
  9. package/dist/common/ActionLink/ActionLink.jsx +19 -0
  10. package/dist/common/ActionLink/index.d.ts +1 -0
  11. package/dist/common/ActionLink/index.js +8 -0
  12. package/dist/common/ConditionalWrapper/ConditionalWrapper.d.ts +8 -0
  13. package/dist/common/ConditionalWrapper/ConditionalWrapper.jsx +8 -0
  14. package/dist/common/ConditionalWrapper/index.d.ts +1 -0
  15. package/dist/common/ConditionalWrapper/index.js +8 -0
  16. package/dist/common/FileIcon/FileIcon.d.ts +6 -0
  17. package/dist/common/FileIcon/FileIcon.jsx +46 -0
  18. package/dist/common/FileIcon/index.d.ts +1 -0
  19. package/dist/common/FileIcon/index.js +8 -0
  20. package/dist/common/HintText/HintText.d.ts +5 -0
  21. package/dist/common/HintText/HintText.jsx +9 -0
  22. package/dist/common/HintText/index.d.ts +1 -0
  23. package/dist/common/HintText/index.js +8 -0
  24. package/dist/common/Icon/Icon.d.ts +6 -0
  25. package/dist/common/Icon/Icon.jsx +51 -0
  26. package/dist/common/Icon/index.d.ts +1 -0
  27. package/dist/common/Icon/index.js +8 -0
  28. package/dist/common/ScreenReaderText/ScreenReaderText.d.ts +5 -0
  29. package/dist/common/ScreenReaderText/ScreenReaderText.jsx +9 -0
  30. package/dist/common/ScreenReaderText/index.d.ts +1 -0
  31. package/dist/common/ScreenReaderText/index.js +8 -0
  32. package/dist/common/WrapperTag/WrapperTag.d.ts +8 -0
  33. package/dist/common/WrapperTag/WrapperTag.jsx +11 -0
  34. package/dist/common/WrapperTag/index.d.ts +1 -0
  35. package/dist/common/WrapperTag/index.js +8 -0
  36. package/dist/common/index.d.ts +8 -0
  37. package/dist/common/index.js +22 -0
  38. package/dist/components/Accordion/index.d.ts +1 -0
  39. package/dist/components/Accordion/index.js +8 -0
  40. package/dist/components/AspectBox/index.d.ts +1 -0
  41. package/dist/components/AspectBox/index.js +8 -0
  42. package/dist/components/BackToTop/index.d.ts +1 -0
  43. package/dist/components/BackToTop/index.js +8 -0
  44. package/dist/components/Breadcrumbs/index.d.ts +1 -0
  45. package/dist/components/Breadcrumbs/index.js +8 -0
  46. package/dist/components/Button/ButtonGroup.d.ts +5 -0
  47. package/dist/components/Button/ButtonGroup.jsx +13 -0
  48. package/dist/components/Button/index.d.ts +2 -0
  49. package/dist/components/Button/index.js +10 -0
  50. package/dist/components/CategoryItem/index.d.ts +1 -0
  51. package/dist/components/CategoryItem/index.js +8 -0
  52. package/dist/components/CategoryList/index.d.ts +1 -0
  53. package/dist/components/CategoryList/index.js +8 -0
  54. package/dist/components/Checkbox/index.d.ts +2 -0
  55. package/dist/components/Checkbox/index.js +10 -0
  56. package/dist/components/ConfirmationMessage/index.d.ts +1 -0
  57. package/dist/components/ConfirmationMessage/index.js +8 -0
  58. package/dist/components/ContentsNav/index.d.ts +1 -0
  59. package/dist/components/ContentsNav/index.js +8 -0
  60. package/dist/components/CookieBanner/index.d.ts +1 -0
  61. package/dist/components/CookieBanner/index.js +8 -0
  62. package/dist/components/DatePicker/DatePicker.jsx +2 -2
  63. package/dist/components/DatePicker/index.d.ts +1 -0
  64. package/dist/components/DatePicker/index.js +8 -0
  65. package/dist/components/Details/index.d.ts +1 -0
  66. package/dist/components/Details/index.js +8 -0
  67. package/dist/components/ErrorMessage/index.d.ts +1 -0
  68. package/dist/components/ErrorMessage/index.js +8 -0
  69. package/dist/components/ErrorSummary/index.d.ts +1 -0
  70. package/dist/components/ErrorSummary/index.js +8 -0
  71. package/dist/components/FeatureHeader/FeatureHeader.d.ts +13 -0
  72. package/dist/components/FeatureHeader/FeatureHeader.jsx +70 -0
  73. package/dist/components/FeatureHeader/index.d.ts +1 -0
  74. package/dist/components/FeatureHeader/index.js +8 -0
  75. package/dist/components/FileDownload/index.d.ts +1 -0
  76. package/dist/components/FileDownload/index.js +8 -0
  77. package/dist/components/HideThisPage/index.d.ts +1 -0
  78. package/dist/components/HideThisPage/index.js +8 -0
  79. package/dist/components/InsetText/index.d.ts +1 -0
  80. package/dist/components/InsetText/index.js +8 -0
  81. package/dist/components/NotificationBanner/index.d.ts +1 -0
  82. package/dist/components/NotificationBanner/index.js +8 -0
  83. package/dist/components/NotificationPanel/index.d.ts +1 -0
  84. package/dist/components/NotificationPanel/index.js +8 -0
  85. package/dist/components/PageHeader/index.d.ts +1 -0
  86. package/dist/components/PageHeader/index.js +8 -0
  87. package/dist/components/PageMetadata/index.d.ts +1 -0
  88. package/dist/components/PageMetadata/index.js +8 -0
  89. package/dist/components/Pagination/index.d.ts +1 -0
  90. package/dist/components/Pagination/index.js +8 -0
  91. package/dist/components/PhaseBanner/index.d.ts +1 -0
  92. package/dist/components/PhaseBanner/index.js +8 -0
  93. package/dist/components/Question/Question.jsx +1 -1
  94. package/dist/components/Question/index.d.ts +1 -0
  95. package/dist/components/Question/index.js +8 -0
  96. package/dist/components/RadioButton/index.d.ts +2 -0
  97. package/dist/components/RadioButton/index.js +10 -0
  98. package/dist/components/SearchFacets/index.d.ts +1 -0
  99. package/dist/components/SearchFacets/index.js +8 -0
  100. package/dist/components/SearchFilters/SearchFilters.jsx +6 -6
  101. package/dist/components/SearchFilters/index.d.ts +1 -0
  102. package/dist/components/SearchFilters/index.js +8 -0
  103. package/dist/components/SearchResult/SearchResult.jsx +2 -2
  104. package/dist/components/SearchResult/index.d.ts +1 -0
  105. package/dist/components/SearchResult/index.js +8 -0
  106. package/dist/components/SearchSort/SearchSort.jsx +2 -2
  107. package/dist/components/SearchSort/index.d.ts +1 -0
  108. package/dist/components/SearchSort/index.js +8 -0
  109. package/dist/components/Select/Select.jsx +1 -1
  110. package/dist/components/Select/index.d.ts +1 -0
  111. package/dist/components/Select/index.js +8 -0
  112. package/dist/components/SequentialNavigation/index.d.ts +1 -0
  113. package/dist/components/SequentialNavigation/index.js +8 -0
  114. package/dist/components/SideNavigation/index.d.ts +1 -0
  115. package/dist/components/SideNavigation/index.js +8 -0
  116. package/dist/components/SiteFooter/index.d.ts +1 -0
  117. package/dist/components/SiteFooter/index.js +8 -0
  118. package/dist/components/SiteHeader/SiteHeader.jsx +1 -1
  119. package/dist/components/SiteHeader/index.d.ts +1 -0
  120. package/dist/components/SiteHeader/index.js +8 -0
  121. package/dist/components/SiteNavigation/index.d.ts +1 -0
  122. package/dist/components/SiteNavigation/index.js +8 -0
  123. package/dist/components/SiteSearch/SiteSearch.jsx +1 -1
  124. package/dist/components/SiteSearch/index.d.ts +1 -0
  125. package/dist/components/SiteSearch/index.js +8 -0
  126. package/dist/components/SkipLinks/index.d.ts +1 -0
  127. package/dist/components/SkipLinks/index.js +8 -0
  128. package/dist/components/SummaryCard/index.d.ts +1 -0
  129. package/dist/components/SummaryCard/index.js +8 -0
  130. package/dist/components/SummaryList/index.d.ts +1 -0
  131. package/dist/components/SummaryList/index.js +8 -0
  132. package/dist/components/Table/index.d.ts +1 -0
  133. package/dist/components/Table/index.js +8 -0
  134. package/dist/components/Tabs/index.d.ts +1 -0
  135. package/dist/components/Tabs/index.js +8 -0
  136. package/dist/components/Tag/index.d.ts +1 -0
  137. package/dist/components/Tag/index.js +8 -0
  138. package/dist/components/TaskList/TaskList.jsx +1 -1
  139. package/dist/components/TaskList/index.d.ts +1 -0
  140. package/dist/components/TaskList/index.js +8 -0
  141. package/dist/components/TextInput/TextInput.jsx +2 -2
  142. package/dist/components/TextInput/index.d.ts +1 -0
  143. package/dist/components/TextInput/index.js +8 -0
  144. package/dist/components/Textarea/Textarea.jsx +1 -1
  145. package/dist/components/Textarea/index.d.ts +1 -0
  146. package/dist/components/Textarea/index.js +8 -0
  147. package/dist/components/WarningText/index.d.ts +1 -0
  148. package/dist/components/WarningText/index.js +8 -0
  149. package/dist/components/index.d.ts +46 -0
  150. package/dist/components/index.js +101 -0
  151. package/dist/hooks/index.d.ts +1 -0
  152. package/dist/hooks/index.js +8 -0
  153. package/dist/hooks/useTracking/index.d.ts +1 -0
  154. package/dist/hooks/useTracking/index.js +8 -0
  155. package/dist/hooks/useTracking/useTracking.d.ts +1 -0
  156. package/dist/hooks/useTracking/useTracking.js +21 -0
  157. package/dist/images/index.d.ts +2 -0
  158. package/dist/images/index.js +38 -0
  159. package/eslint.config.mjs +32 -0
  160. package/package.json +29 -22
  161. package/src/common/{AbstractNotificationBanner.test.tsx → AbstractNotificationBanner/AbstractNotificationBanner.test.tsx} +1 -1
  162. package/src/common/{AbstractNotificationBanner.tsx → AbstractNotificationBanner/AbstractNotificationBanner.tsx} +7 -6
  163. package/src/common/AbstractNotificationBanner/index.ts +1 -0
  164. package/src/common/AbstractNotificationBanner/types.ts +15 -0
  165. package/src/common/{ActionLink.tsx → ActionLink/ActionLink.tsx} +3 -1
  166. package/src/common/ActionLink/index.ts +1 -0
  167. package/src/common/ActionLink/types.ts +8 -0
  168. package/src/common/ConditionalWrapper/ConditionalWrapper.tsx +17 -0
  169. package/src/common/ConditionalWrapper/index.ts +1 -0
  170. package/src/common/ConditionalWrapper/types.ts +4 -0
  171. package/src/common/{FileIcon.tsx → FileIcon/FileIcon.tsx} +3 -2
  172. package/src/common/FileIcon/index.ts +1 -0
  173. package/src/common/FileIcon/types.ts +7 -0
  174. package/src/common/{HintText.test.tsx → HintText/HintText.test.tsx} +3 -15
  175. package/src/common/{HintText.tsx → HintText/HintText.tsx} +4 -4
  176. package/src/common/HintText/index.ts +1 -0
  177. package/src/common/HintText/types.ts +4 -0
  178. package/src/common/{Icon.tsx → Icon/Icon.tsx} +3 -2
  179. package/src/common/Icon/index.ts +1 -0
  180. package/src/common/Icon/types.ts +9 -0
  181. package/src/common/{ScreenReaderText.tsx → ScreenReaderText/ScreenReaderText.tsx} +1 -1
  182. package/src/common/ScreenReaderText/index.ts +1 -0
  183. package/src/common/{WrapperTag.tsx → WrapperTag/WrapperTag.tsx} +5 -3
  184. package/src/common/WrapperTag/index.ts +1 -0
  185. package/src/common/WrapperTag/types.ts +3 -0
  186. package/src/common/index.ts +8 -0
  187. package/src/components/Accordion/Accordion.Item.stories.tsx +1 -5
  188. package/src/components/Accordion/Accordion.stories.tsx +5 -5
  189. package/src/components/Accordion/Accordion.tsx +5 -4
  190. package/src/components/Accordion/index.ts +1 -0
  191. package/src/components/Accordion/types.ts +13 -0
  192. package/src/components/AspectBox/AspectBox.stories.tsx +1 -2
  193. package/src/components/AspectBox/AspectBox.tsx +5 -4
  194. package/src/components/AspectBox/index.ts +1 -0
  195. package/src/components/AspectBox/types.ts +3 -0
  196. package/src/components/BackToTop/BackToTop.tsx +3 -2
  197. package/src/components/BackToTop/index.ts +1 -0
  198. package/src/components/BackToTop/types.ts +3 -0
  199. package/src/components/Breadcrumbs/Breadcrumbs.tsx +4 -2
  200. package/src/components/Breadcrumbs/index.ts +1 -0
  201. package/src/components/Breadcrumbs/types.ts +6 -0
  202. package/src/components/Button/Button.tsx +2 -1
  203. package/src/components/{ButtonGroup → Button}/ButtonGroup.stories.tsx +1 -1
  204. package/src/components/{ButtonGroup → Button}/ButtonGroup.tsx +3 -1
  205. package/src/components/Button/index.ts +2 -0
  206. package/src/components/Button/types.ts +21 -0
  207. package/src/components/CategoryItem/CategoryItem.tsx +7 -4
  208. package/src/components/CategoryItem/index.ts +1 -0
  209. package/src/components/CategoryItem/types.ts +10 -0
  210. package/src/components/CategoryList/CategoryList.stories.tsx +1 -1
  211. package/src/components/CategoryList/CategoryList.test.tsx +1 -1
  212. package/src/components/CategoryList/CategoryList.tsx +4 -2
  213. package/src/components/CategoryList/index.ts +1 -0
  214. package/src/components/CategoryList/types.ts +5 -0
  215. package/src/components/Checkbox/Checkbox.stories.tsx +3 -3
  216. package/src/components/Checkbox/Checkbox.tsx +5 -4
  217. package/src/components/Checkbox/CheckboxGroup.tsx +3 -3
  218. package/src/components/Checkbox/index.ts +2 -0
  219. package/src/components/Checkbox/types.ts +9 -0
  220. package/src/components/ConfirmationMessage/ConfirmationMessage.tsx +2 -1
  221. package/src/components/ConfirmationMessage/index.ts +1 -0
  222. package/src/components/ConfirmationMessage/types.ts +7 -0
  223. package/src/components/ContentsNav/ContentsNav.stories.tsx +5 -1
  224. package/src/components/ContentsNav/ContentsNav.tsx +3 -2
  225. package/src/components/ContentsNav/index.ts +1 -0
  226. package/src/components/ContentsNav/types.ts +11 -0
  227. package/src/components/CookieBanner/CookieBanner.Buttons.stories.tsx +4 -4
  228. package/src/components/CookieBanner/CookieBanner.stories.tsx +7 -7
  229. package/src/components/CookieBanner/CookieBanner.test.tsx +6 -0
  230. package/src/components/CookieBanner/CookieBanner.tsx +13 -3
  231. package/src/components/CookieBanner/index.ts +1 -0
  232. package/src/components/DatePicker/DatePicker.test.tsx +0 -5
  233. package/src/components/DatePicker/DatePicker.tsx +5 -4
  234. package/src/components/DatePicker/index.ts +1 -0
  235. package/src/components/DatePicker/types.ts +20 -0
  236. package/src/components/Details/Details.stories.tsx +1 -1
  237. package/src/components/Details/Details.tsx +3 -1
  238. package/src/components/Details/index.ts +1 -0
  239. package/src/components/Details/types.ts +4 -0
  240. package/src/components/ErrorMessage/ErrorMessage.tsx +3 -1
  241. package/src/components/ErrorMessage/index.ts +1 -0
  242. package/src/components/ErrorMessage/types.ts +3 -0
  243. package/src/components/ErrorSummary/ErrorSummary.test.tsx +1 -1
  244. package/src/components/ErrorSummary/ErrorSummary.tsx +3 -2
  245. package/src/components/ErrorSummary/index.ts +1 -0
  246. package/src/components/ErrorSummary/types.ts +11 -0
  247. package/src/components/FileDownload/FileDownload.tsx +2 -1
  248. package/src/components/FileDownload/index.ts +1 -0
  249. package/src/components/FileDownload/types.ts +11 -0
  250. package/src/components/HideThisPage/HideThisPage.tsx +3 -2
  251. package/src/components/HideThisPage/index.ts +1 -0
  252. package/src/components/HideThisPage/types.ts +3 -0
  253. package/src/components/InsetText/InsetText.tsx +1 -1
  254. package/src/components/InsetText/index.ts +1 -0
  255. package/src/components/NotificationBanner/NotificationBanner.stories.tsx +2 -2
  256. package/src/components/NotificationBanner/NotificationBanner.tsx +5 -4
  257. package/src/components/NotificationBanner/index.ts +1 -0
  258. package/src/components/NotificationPanel/NotificationPanel.tsx +2 -1
  259. package/src/components/NotificationPanel/index.ts +1 -0
  260. package/src/components/NotificationPanel/types.ts +7 -0
  261. package/src/components/PageHeader/PageHeader.stories.tsx +1 -1
  262. package/src/components/PageHeader/PageHeader.tsx +3 -1
  263. package/src/components/PageHeader/index.ts +1 -0
  264. package/src/components/PageHeader/types.ts +5 -0
  265. package/src/components/PageMetadata/PageMetadata.stories.tsx +1 -1
  266. package/src/components/PageMetadata/PageMetadata.tsx +5 -3
  267. package/src/components/PageMetadata/index.ts +1 -0
  268. package/src/components/PageMetadata/types.ts +7 -0
  269. package/src/components/Pagination/Pagination.tsx +5 -3
  270. package/src/components/Pagination/index.ts +1 -0
  271. package/src/components/Pagination/types.ts +20 -0
  272. package/src/components/PhaseBanner/PhaseBanner.stories.tsx +1 -4
  273. package/src/components/PhaseBanner/PhaseBanner.tsx +2 -1
  274. package/src/components/PhaseBanner/index.ts +1 -0
  275. package/src/components/PhaseBanner/types.ts +3 -0
  276. package/src/components/Question/Question.stories.tsx +2 -3
  277. package/src/components/Question/Question.tsx +5 -4
  278. package/src/components/Question/index.ts +1 -0
  279. package/src/components/Question/types.ts +9 -0
  280. package/src/components/RadioButton/RadioButton.tsx +5 -4
  281. package/src/components/RadioButton/RadioGroup.stories.tsx +1 -2
  282. package/src/components/RadioButton/RadioGroup.test.tsx +1 -2
  283. package/src/components/RadioButton/RadioGroup.tsx +2 -1
  284. package/src/components/RadioButton/index.ts +2 -0
  285. package/src/components/RadioButton/types.ts +12 -0
  286. package/src/components/SearchFacets/SearchFacets.Group.stories.tsx +2 -3
  287. package/src/components/SearchFacets/SearchFacets.stories.tsx +1 -1
  288. package/src/components/SearchFacets/SearchFacets.tsx +7 -6
  289. package/src/components/SearchFacets/index.ts +1 -0
  290. package/src/components/SearchFacets/types.ts +14 -0
  291. package/src/components/SearchFilters/SearchFilters.Panel.stories.tsx +20 -9
  292. package/src/components/SearchFilters/SearchFilters.stories.tsx +3 -3
  293. package/src/components/SearchFilters/SearchFilters.test.tsx +1 -1
  294. package/src/components/SearchFilters/SearchFilters.tsx +8 -7
  295. package/src/components/SearchFilters/index.ts +1 -0
  296. package/src/components/SearchFilters/types.ts +14 -0
  297. package/src/components/SearchResult/SearchResult.stories.tsx +9 -10
  298. package/src/components/SearchResult/SearchResult.tsx +11 -10
  299. package/src/components/SearchResult/index.ts +1 -0
  300. package/src/components/SearchResult/types.ts +13 -0
  301. package/src/components/SearchSort/SearchSort.stories.tsx +2 -1
  302. package/src/components/SearchSort/SearchSort.tsx +4 -3
  303. package/src/components/SearchSort/index.ts +1 -0
  304. package/src/components/SearchSort/types.ts +7 -0
  305. package/src/components/Select/Select.tsx +6 -5
  306. package/src/components/Select/index.ts +1 -0
  307. package/src/components/Select/types.ts +7 -0
  308. package/src/components/SequentialNavigation/SequentialNavigation.tsx +6 -4
  309. package/src/components/SequentialNavigation/index.ts +1 -0
  310. package/src/components/SequentialNavigation/types.ts +12 -0
  311. package/src/components/SideNavigation/SideNavigation.tsx +5 -4
  312. package/src/components/SideNavigation/index.ts +1 -0
  313. package/src/components/SideNavigation/types.ts +16 -0
  314. package/src/components/SiteFooter/SiteFooter.tsx +7 -6
  315. package/src/components/SiteFooter/index.ts +1 -0
  316. package/src/components/SiteFooter/types.ts +20 -0
  317. package/src/components/SiteHeader/SiteHeader.stories.tsx +7 -6
  318. package/src/components/SiteHeader/SiteHeader.test.tsx +3 -3
  319. package/src/components/SiteHeader/SiteHeader.tsx +11 -10
  320. package/src/components/SiteHeader/index.ts +1 -0
  321. package/src/components/SiteHeader/types.ts +22 -0
  322. package/src/components/SiteNavigation/SiteNavigation.tsx +4 -2
  323. package/src/components/SiteNavigation/index.ts +1 -0
  324. package/src/components/SiteNavigation/types.ts +11 -0
  325. package/src/components/SiteSearch/SiteSearch.stories.tsx +4 -2
  326. package/src/components/SiteSearch/SiteSearch.tsx +7 -6
  327. package/src/components/SiteSearch/index.ts +1 -0
  328. package/src/components/SiteSearch/types.ts +13 -0
  329. package/src/components/SkipLinks/SkipLinks.stories.tsx +3 -3
  330. package/src/components/SkipLinks/SkipLinks.tsx +4 -4
  331. package/src/components/SkipLinks/index.ts +1 -0
  332. package/src/components/SkipLinks/types.ts +9 -0
  333. package/src/components/SummaryCard/SummaryCard.stories.tsx +1 -1
  334. package/src/components/SummaryCard/SummaryCard.test.tsx +2 -13
  335. package/src/components/SummaryCard/SummaryCard.tsx +6 -4
  336. package/src/components/SummaryCard/index.ts +1 -0
  337. package/src/components/SummaryCard/types.ts +6 -0
  338. package/src/components/SummaryList/SummaryList.Item.stories.tsx +5 -5
  339. package/src/components/SummaryList/SummaryList.stories.tsx +1 -1
  340. package/src/components/SummaryList/SummaryList.test.tsx +1 -6
  341. package/src/components/SummaryList/SummaryList.tsx +8 -6
  342. package/src/components/SummaryList/index.ts +1 -0
  343. package/src/components/SummaryList/types.ts +7 -0
  344. package/src/components/Table/Table.tsx +3 -2
  345. package/src/components/Table/index.ts +1 -0
  346. package/src/components/Table/types.ts +6 -0
  347. package/src/components/Tabs/Tabs.Item.stories.tsx +7 -7
  348. package/src/components/Tabs/Tabs.stories.tsx +3 -3
  349. package/src/components/Tabs/Tabs.tsx +7 -5
  350. package/src/components/Tabs/index.ts +1 -0
  351. package/src/components/Tabs/types.ts +19 -0
  352. package/src/components/Tag/Tag.tsx +3 -1
  353. package/src/components/Tag/index.ts +1 -0
  354. package/src/components/Tag/types.ts +5 -0
  355. package/src/components/TaskList/TaskList.Group.stories.tsx +0 -5
  356. package/src/components/TaskList/TaskList.stories.tsx +0 -1
  357. package/src/components/TaskList/TaskList.tsx +13 -10
  358. package/src/components/TaskList/index.ts +1 -0
  359. package/src/components/TaskList/types.ts +20 -0
  360. package/src/components/TextInput/TextInput.tsx +8 -8
  361. package/src/components/TextInput/index.ts +1 -0
  362. package/src/components/TextInput/types.ts +12 -0
  363. package/src/components/Textarea/Textarea.tsx +7 -6
  364. package/src/components/Textarea/index.ts +1 -0
  365. package/src/components/WarningText/WarningText.tsx +1 -1
  366. package/src/components/WarningText/index.ts +1 -0
  367. package/src/components/index.ts +46 -0
  368. package/src/hooks/index.ts +1 -0
  369. package/src/hooks/useTracking/index.ts +1 -0
  370. package/src/hooks/{useTracking.test.tsx → useTracking/useTracking.test.tsx} +5 -7
  371. package/src/hooks/{useTracking.ts → useTracking/useTracking.ts} +1 -1
  372. package/src/images/icons/arrow_upward.tsx +10 -10
  373. package/src/images/icons/calendar_today.tsx +10 -10
  374. package/src/images/icons/cancel.tsx +8 -8
  375. package/src/images/icons/check_circle.tsx +10 -10
  376. package/src/images/icons/chevron_left.tsx +10 -10
  377. package/src/images/icons/chevron_right.tsx +10 -10
  378. package/src/images/icons/close.tsx +10 -10
  379. package/src/images/icons/description.tsx +10 -10
  380. package/src/images/icons/double_chevron_left.tsx +8 -8
  381. package/src/images/icons/double_chevron_right.tsx +8 -8
  382. package/src/images/icons/error.tsx +10 -10
  383. package/src/images/icons/expand_less.tsx +10 -10
  384. package/src/images/icons/expand_more.tsx +10 -10
  385. package/src/images/icons/list.tsx +13 -13
  386. package/src/images/icons/menu.tsx +10 -10
  387. package/src/images/icons/priority_high.tsx +11 -11
  388. package/src/images/icons/search.tsx +10 -10
  389. package/src/images/index.ts +2 -0
  390. package/src/index.ts +4 -0
  391. package/src/shared-types.ts +40 -0
  392. package/vite.config.ts +4 -2
  393. package/@types/common/AbstractNotificationBanner.d.ts +0 -17
  394. package/@types/common/ActionLink.d.ts +0 -8
  395. package/@types/common/ConditionalWrapper.d.ts +0 -6
  396. package/@types/common/FileIcon.d.ts +0 -7
  397. package/@types/common/HintText.d.ts +0 -6
  398. package/@types/common/Icon.d.ts +0 -9
  399. package/@types/common/ScreenReaderText.d.ts +0 -4
  400. package/@types/common/WrapperTag.d.ts +0 -5
  401. package/@types/components/Accordion.d.ts +0 -15
  402. package/@types/components/AspectBox.d.ts +0 -5
  403. package/@types/components/BackToTop.d.ts +0 -5
  404. package/@types/components/Breadcrumbs.d.ts +0 -11
  405. package/@types/components/Button.d.ts +0 -17
  406. package/@types/components/ButtonGroup.d.ts +0 -5
  407. package/@types/components/CategoryItem.d.ts +0 -10
  408. package/@types/components/CategoryList.d.ts +0 -7
  409. package/@types/components/Checkbox.d.ts +0 -11
  410. package/@types/components/ConfirmationMessage.d.ts +0 -7
  411. package/@types/components/ContentsNav.d.ts +0 -13
  412. package/@types/components/DatePicker.d.ts +0 -20
  413. package/@types/components/Details.d.ts +0 -6
  414. package/@types/components/ErrorMessage.d.ts +0 -5
  415. package/@types/components/ErrorSummary.d.ts +0 -12
  416. package/@types/components/FileDownload.d.ts +0 -11
  417. package/@types/components/HideThisPage.d.ts +0 -5
  418. package/@types/components/InsetText.d.ts +0 -5
  419. package/@types/components/Metadata.d.ts +0 -11
  420. package/@types/components/NotificationPanel.d.ts +0 -7
  421. package/@types/components/PageHeader.d.ts +0 -7
  422. package/@types/components/Pagination.d.ts +0 -22
  423. package/@types/components/PhaseBanner.d.ts +0 -5
  424. package/@types/components/Question.d.ts +0 -11
  425. package/@types/components/RadioButton.d.ts +0 -14
  426. package/@types/components/SearchFacets.d.ts +0 -18
  427. package/@types/components/SearchFilters.d.ts +0 -14
  428. package/@types/components/SearchResult.d.ts +0 -30
  429. package/@types/components/SearchSort.d.ts +0 -9
  430. package/@types/components/Select.d.ts +0 -7
  431. package/@types/components/SequentialNavigation.d.ts +0 -14
  432. package/@types/components/SideNavigation.d.ts +0 -18
  433. package/@types/components/SiteFooter.d.ts +0 -25
  434. package/@types/components/SiteHeader.d.ts +0 -20
  435. package/@types/components/SiteNavigation.d.ts +0 -13
  436. package/@types/components/SiteSearch.d.ts +0 -14
  437. package/@types/components/SkipLinks.d.ts +0 -13
  438. package/@types/components/SummaryCard.d.ts +0 -6
  439. package/@types/components/SummaryList.d.ts +0 -14
  440. package/@types/components/Table.d.ts +0 -8
  441. package/@types/components/Tabs.d.ts +0 -21
  442. package/@types/components/Tag.d.ts +0 -5
  443. package/@types/components/TaskList.d.ts +0 -22
  444. package/@types/components/TextInput.d.ts +0 -12
  445. package/@types/components/Textarea.d.ts +0 -4
  446. package/@types/components/WarningText.d.ts +0 -5
  447. package/@types/global.d.ts +0 -1
  448. package/@types/sgds.d.ts +0 -49
  449. package/dist/tsconfig.tsbuildinfo +0 -1
  450. package/src/common/ConditionalWrapper.tsx +0 -9
  451. /package/src/common/{ActionLink.test.tsx → ActionLink/ActionLink.test.tsx} +0 -0
  452. /package/src/common/{ConditionalWrapper.test.tsx → ConditionalWrapper/ConditionalWrapper.test.tsx} +0 -0
  453. /package/src/common/{FileIcon.test.tsx → FileIcon/FileIcon.test.tsx} +0 -0
  454. /package/src/common/{Icon.test.tsx → Icon/Icon.test.tsx} +0 -0
  455. /package/src/common/{ScreenReaderText.test.tsx → ScreenReaderText/ScreenReaderText.test.tsx} +0 -0
  456. /package/src/common/{WrapperTag.test.tsx → WrapperTag/WrapperTag.test.tsx} +0 -0
  457. /package/src/components/{ButtonGroup → Button}/ButtonGroup.test.tsx +0 -0
@@ -2,8 +2,8 @@ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import argTypes from '../../../.storybook/sgdsArgTypes';
3
3
 
4
4
  import Filters from './SearchFilters';
5
- import DatePicker from '../DatePicker/DatePicker';
6
- import Checkbox from '../Checkbox/Checkbox';
5
+ import DatePicker from '../DatePicker';
6
+ import Checkbox from '../Checkbox';
7
7
 
8
8
  const meta = {
9
9
  title: 'Components/Search results/Filters/Filter panel',
@@ -39,12 +39,22 @@ const meta = {
39
39
  name: 'number'
40
40
  }
41
41
  }
42
+ },
43
+ args: {
44
+ heading: 'Filter',
45
+ legend: 'Select which publication types you would like to see'
42
46
  }
43
47
  } satisfies Meta<typeof Filters.Panel>;
44
48
 
45
49
  export default meta;
46
50
  type Story = StoryObj<typeof meta>;
47
51
 
52
+ type ContentTypeType = {
53
+ label: string;
54
+ value: string;
55
+ checked?: boolean;
56
+ };
57
+
48
58
  const CONTENT_TYPES = [
49
59
  {
50
60
  label: 'Advice and guidance',
@@ -134,7 +144,7 @@ CONTENT_TYPES_WITH_SELECTED[4].checked = true;
134
144
  CONTENT_TYPES_WITH_SELECTED[7].checked = true;
135
145
 
136
146
  export const Default: Story = {
137
- render: (args: any) => (
147
+ render: () => (
138
148
  <Filters.Panel
139
149
  heading="Filter by date"
140
150
  legend="Filter by date"
@@ -155,12 +165,12 @@ export const Default: Story = {
155
165
  };
156
166
 
157
167
  export const Scrollable: Story = {
158
- render: (args: any) => (
168
+ render: ({ ...args }) => (
159
169
  <Filters.Panel
170
+ {...args}
160
171
  heading="Content type"
161
172
  isScrollable
162
173
  legend="Select which publication types you would like to see"
163
- {...args}
164
174
  >
165
175
  <Filters.CheckboxGroup>
166
176
  {CONTENT_TYPES.map((type) => (
@@ -177,16 +187,17 @@ export const Scrollable: Story = {
177
187
  };
178
188
 
179
189
  export const WithActiveFilterCount: Story = {
180
- render: (args: any) => (
190
+ args: {},
191
+ render: ({ ...args }) => (
181
192
  <Filters.Panel
182
- activeFilterCount={CONTENT_TYPES_WITH_SELECTED.filter((item: any) => item.checked).length}
193
+ {...args}
194
+ activeFilterCount={CONTENT_TYPES_WITH_SELECTED.filter((item: ContentTypeType) => item.checked).length}
183
195
  heading="Content type"
184
196
  isScrollable
185
197
  legend="Select which publication types you would like to see"
186
- {...args}
187
198
  >
188
199
  <Filters.CheckboxGroup>
189
- {CONTENT_TYPES_WITH_SELECTED.map((type: any) => (
200
+ {CONTENT_TYPES_WITH_SELECTED.map((type: ContentTypeType) => (
190
201
  <Checkbox
191
202
  checked={type.checked || false}
192
203
  key={type.value}
@@ -2,8 +2,8 @@ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import argTypes from '../../../.storybook/sgdsArgTypes';
3
3
 
4
4
  import Filters from './SearchFilters';
5
- import DatePicker from '../DatePicker/DatePicker';
6
- import Checkbox from '../Checkbox/Checkbox';
5
+ import DatePicker from '../DatePicker';
6
+ import Checkbox from '../Checkbox';
7
7
 
8
8
 
9
9
  const meta = {
@@ -104,7 +104,7 @@ const CONTENT_TYPES = [
104
104
  ];
105
105
 
106
106
  export const Default: Story = {
107
- render: (args: any) => (
107
+ render: ({ ...args }) => (
108
108
  <Filters {...args}>
109
109
  <Filters.Panel legend="Select which publication types you would like to see" heading="Content type">
110
110
  <Filters.CheckboxGroup>
@@ -1,7 +1,7 @@
1
1
  import { test, expect } from 'vitest';
2
2
  import { render, screen, within } from '@testing-library/react';
3
3
  import Filters from './SearchFilters';
4
- import Checkbox from '../Checkbox/Checkbox';
4
+ import Checkbox from '../Checkbox';
5
5
 
6
6
  test('search filters boilerplate renders correctly', () => {
7
7
  render(
@@ -1,8 +1,9 @@
1
- import Accordion from "../Accordion/Accordion";
2
- import Button from "../Button/Button";
3
- import SkipLinks from "../SkipLinks/SkipLinks";
1
+ import Accordion from "../Accordion";
2
+ import Button from "../Button";
3
+ import SkipLinks from "../SkipLinks";
4
4
  import ConditionalWrapper from "../../common/ConditionalWrapper";
5
- import CheckboxGroup from "../Checkbox/CheckboxGroup";
5
+ import { CheckboxGroup } from "../Checkbox";
6
+ import { SearchFiltersPanelProps, SearchFiltersCheckboxGroupProps, SearchFiltersProps } from "./types";
6
7
 
7
8
  export const FilterPanel = ({
8
9
  activeFilterCount = 0,
@@ -11,7 +12,7 @@ export const FilterPanel = ({
11
12
  legend,
12
13
  heading = 'Filter',
13
14
  ...props
14
- }: SGDS.Component.SearchFilters.Panel) => {
15
+ }: SearchFiltersPanelProps) => {
15
16
  const headingWithCount = <>
16
17
  {heading}
17
18
  {activeFilterCount > 0 && <div className="ds_search-filters__filter-count">({activeFilterCount} selected)</div>}
@@ -36,7 +37,7 @@ export const FilterPanel = ({
36
37
  const FilterCheckboxGroup = ({
37
38
  children,
38
39
  ...props
39
- }: any) => {
40
+ }: SearchFiltersCheckboxGroupProps) => {
40
41
  return (
41
42
  <CheckboxGroup
42
43
  className="ds_search-filters__checkboxes"
@@ -52,7 +53,7 @@ const Filters = ({
52
53
  children,
53
54
  searchResultsContainerId = 'search-results',
54
55
  ...props
55
- }: SGDS.Component.SearchFilters) => {
56
+ }: SearchFiltersProps) => {
56
57
  return (
57
58
  <div className="ds_search-filters" {...props}>
58
59
  <div className="ds_details ds_no-margin" data-module="ds-details">
@@ -0,0 +1 @@
1
+ export { default } from './SearchFilters';
@@ -0,0 +1,14 @@
1
+ export interface SearchFiltersPanelProps extends React.AllHTMLAttributes<HTMLElement> {
2
+ activeFilterCount?: number;
3
+ heading: string | React.ReactNode;
4
+ isScrollable?: boolean;
5
+ legend: string;
6
+ }
7
+
8
+ export interface SearchFiltersCheckboxGroupProps {
9
+ children: React.ReactNode,
10
+ }
11
+
12
+ export interface SearchFiltersProps extends React.AllHTMLAttributes<HTMLElement> {
13
+ searchResultsContainerId?: string;
14
+ }
@@ -1,9 +1,7 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import argTypes from '../../../.storybook/sgdsArgTypes';
3
-
4
3
  import SearchResult from './SearchResult';
5
-
6
- //@ts-ignore
4
+ // @ts-expect-error no types
7
5
  import coo from '../../../static/images/highland-cow.jpg';
8
6
 
9
7
  const meta = {
@@ -13,7 +11,8 @@ const meta = {
13
11
  children: argTypes.children()
14
12
  },
15
13
  args: {
16
- title: 'Application incomplete'
14
+ title: 'Greenhouse gas statistics 1990-2022',
15
+ href: '#foo'
17
16
  }
18
17
  } satisfies Meta<typeof SearchResult>;
19
18
 
@@ -22,7 +21,7 @@ type Story = StoryObj<typeof meta>;
22
21
 
23
22
  export const Default: Story = {
24
23
  render: (args) => (
25
- <SearchResult href="#foo" title="Greenhouse gas statistics 1990-2022" {...args}>
24
+ <SearchResult {...args}>
26
25
  <SearchResult.Content>
27
26
  Official statistics showing emissions of greenhouse gases in Scotland over the period 1990 to 2022.
28
27
  </SearchResult.Content>
@@ -32,7 +31,7 @@ export const Default: Story = {
32
31
 
33
32
  export const Metadata: Story = {
34
33
  render: (args) => (
35
- <SearchResult href="#foo" title="Greenhouse gas statistics 1990-2022" {...args}>
34
+ <SearchResult {...args}>
36
35
  <SearchResult.Content>
37
36
  Official statistics showing emissions of greenhouse gases in Scotland over the period 1990 to 2022.
38
37
  </SearchResult.Content>
@@ -50,7 +49,7 @@ export const Metadata: Story = {
50
49
 
51
50
  export const Context: Story = {
52
51
  render: (args) => (
53
- <SearchResult href="#foo" title="Greenhouse gas statistics 1990-2022" {...args}>
52
+ <SearchResult {...args}>
54
53
  <SearchResult.Content>
55
54
  Official statistics showing emissions of greenhouse gases in Scotland over the period 1990 to 2022.
56
55
  </SearchResult.Content>
@@ -64,7 +63,7 @@ export const Context: Story = {
64
63
 
65
64
  export const Media: Story = {
66
65
  render: (args) => (
67
- <SearchResult href="#foo" title="Application incomplete" {...args}>
66
+ <SearchResult {...args}>
68
67
  <SearchResult.Content>
69
68
  <SearchResult.Media>
70
69
  <img src={coo} alt="" />
@@ -77,7 +76,7 @@ export const Media: Story = {
77
76
 
78
77
  export const Promoted: Story = {
79
78
  render: (args) => (
80
- <SearchResult isPromoted href="#foo" title="Greenhouse gas statistics 1990-2022" {...args}>
79
+ <SearchResult isPromoted {...args}>
81
80
  <SearchResult.Content>
82
81
  Official statistics showing emissions of greenhouse gases in Scotland over the period 1990 to 2022.
83
82
  </SearchResult.Content>
@@ -87,7 +86,7 @@ export const Promoted: Story = {
87
86
 
88
87
  export const KitchenSink: Story = {
89
88
  render: (args) => (
90
- <SearchResult isPromoted href="#foo" title="Application incomplete" {...args}>
89
+ <SearchResult isPromoted {...args}>
91
90
  <SearchResult.Content>
92
91
  <SearchResult.Media>
93
92
  <img src={coo} alt="" />
@@ -1,19 +1,20 @@
1
1
  import { Children, createContext, useContext } from 'react';
2
2
  import ConditionalWrapper from '../../common/ConditionalWrapper';
3
- import AspectBox from '../AspectBox/AspectBox';
4
- import Metadata from '../PageMetadata/PageMetadata';
3
+ import AspectBox from '../AspectBox';
4
+ import Metadata from '../PageMetadata';
5
+ import { SearchResultContextProps, SearchResultProps } from './types';
5
6
 
6
7
  const SearchResultLinkHrefContext = createContext('');
7
8
 
8
9
  const SearchResultContent = ({
9
10
  children
10
- }: SGDS.Component.SearchResult.Content) => {
11
- const otherChildren: any[] = [];
11
+ }: React.AllHTMLAttributes<HTMLElement>) => {
12
+ const otherChildren: React.ReactNode[] = [];
12
13
  let imageChild: React.ReactNode = null;
13
14
 
14
15
  // assign to slots
15
16
  Children.forEach(children, (child: React.ReactNode) => {
16
- const thisChild = child as React.ReactElement<any>;
17
+ const thisChild = child as React.JSX.Element;
17
18
  if (thisChild && thisChild.type === SearchResultMedia) {
18
19
  imageChild = thisChild;
19
20
  } else {
@@ -37,7 +38,7 @@ const SearchResultContent = ({
37
38
  const SearchResultContext = ({
38
39
  children,
39
40
  title = 'Part of'
40
- }: SGDS.Component.SearchResult.Context) => {
41
+ }: SearchResultContextProps) => {
41
42
  return (
42
43
  <dl className="ds_search-result__context">
43
44
  <dt className="ds_search-result__context-key">{title}:</dt>
@@ -48,7 +49,7 @@ const SearchResultContext = ({
48
49
 
49
50
  const SearchResultContextItem = ({
50
51
  children
51
- }: SGDS.Component.SearchResult.ContextItem) => {
52
+ }: React.AllHTMLAttributes<HTMLElement>) => {
52
53
  return (
53
54
  <dd className="ds_search-result__context-value">
54
55
  {children}
@@ -58,7 +59,7 @@ const SearchResultContextItem = ({
58
59
 
59
60
  const SearchResultMedia = ({
60
61
  children
61
- }: SGDS.Component.SearchResult.Media) => {
62
+ }: React.AllHTMLAttributes<HTMLElement>) => {
62
63
  return (
63
64
  <div className="ds_search-result__media-wrapper">
64
65
  <a className="ds_search-result__media-link" href={useContext(SearchResultLinkHrefContext)} tabIndex={-1} aria-hidden="true">
@@ -72,7 +73,7 @@ const SearchResultMedia = ({
72
73
 
73
74
  const SearchResultMeta = ({
74
75
  children
75
- }: SGDS.Component.SearchResult.Meta) => {
76
+ }: React.AllHTMLAttributes<HTMLElement>) => {
76
77
  return (
77
78
  <Metadata className="ds_search-result__metadata" isInline>
78
79
  {children}
@@ -88,7 +89,7 @@ const SearchResult = ({
88
89
  promotedTitle = 'Recommended',
89
90
  title,
90
91
  ...props
91
- }: SGDS.Component.SearchResult) => {
92
+ }: SearchResultProps) => {
92
93
  const LINK_CLASS = 'ds_search-result__link';
93
94
 
94
95
  return (
@@ -0,0 +1 @@
1
+ export { default } from './SearchResult';
@@ -0,0 +1,13 @@
1
+ import { LinkComponent } from "../../shared-types";
2
+
3
+ export interface SearchResultContextProps extends React.AllHTMLAttributes<HTMLDListElement> {
4
+ title: string;
5
+ }
6
+
7
+ export interface SearchResultProps extends React.AllHTMLAttributes<HTMLElement> {
8
+ href: string;
9
+ isPromoted?: boolean;
10
+ linkComponent?: LinkComponent;
11
+ promotedTitle?: string;
12
+ title: string;
13
+ }
@@ -14,7 +14,8 @@ const meta = {
14
14
  },
15
15
  args: {
16
16
  id: 'sort-by',
17
- label: 'Sort by'
17
+ label: 'Sort by',
18
+ children: <></>
18
19
  }
19
20
  } satisfies Meta<typeof SearchSort>;
20
21
 
@@ -1,6 +1,7 @@
1
1
  import { AllHTMLAttributes } from "react";
2
- import Button from "../Button/Button";
3
- import Select from "../Select/Select";
2
+ import Button from "../Button";
3
+ import Select from "../Select";
4
+ import { SearchSortProps } from "./types";
4
5
 
5
6
  const Option = ({
6
7
  children,
@@ -20,7 +21,7 @@ const SearchSort = ({
20
21
  label = 'Sort by',
21
22
  onApply,
22
23
  ...props
23
- }: SGDS.Component.SearchSort) => {
24
+ }: SearchSortProps) => {
24
25
  return (
25
26
  <div
26
27
  className={[
@@ -0,0 +1 @@
1
+ export { default } from './SearchSort';
@@ -0,0 +1,7 @@
1
+ export interface SearchSortProps extends React.AllHTMLAttributes<HTMLElement> {
2
+ children: React.ReactNode;
3
+ className?: string;
4
+ id?: string;
5
+ label?: string;
6
+ onApply?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
7
+ }
@@ -1,5 +1,6 @@
1
- import ErrorMessage from '../ErrorMessage/ErrorMessage';
1
+ import ErrorMessage from '../ErrorMessage';
2
2
  import HintText from '../../common/HintText';
3
+ import { SelectProps } from './types';
3
4
 
4
5
  const Select = function ({
5
6
  children,
@@ -16,7 +17,7 @@ const Select = function ({
16
17
  placeholder,
17
18
  width,
18
19
  ...props
19
- }: SGDS.Component.Select) {
20
+ }: SelectProps) {
20
21
  const errorMessageId = `error-message-${id}`;
21
22
  const hintTextId = `hint-text-${id}`;
22
23
  const describedbys: string[] = [];
@@ -24,13 +25,13 @@ const Select = function ({
24
25
  if (hintText) { describedbys.push(hintTextId) };
25
26
  if (errorMessage) { describedbys.push(errorMessageId) };
26
27
 
27
- function handleBlur(event: React.FocusEvent) {
28
+ function handleBlur(event: React.FocusEvent<HTMLSelectElement>) {
28
29
  if (typeof onBlur === 'function') {
29
30
  onBlur(event);
30
31
  }
31
32
  }
32
33
 
33
- function handleChange(event: React.ChangeEvent) {
34
+ function handleChange(event: React.ChangeEvent<HTMLSelectElement>) {
34
35
  if (typeof onChange === 'function') {
35
36
  onChange(event);
36
37
  }
@@ -39,7 +40,7 @@ const Select = function ({
39
40
  return (
40
41
  <>
41
42
  <label className="ds_label" htmlFor={id}>{label}</label>
42
- {hintText && <HintText id={hintTextId} text={hintText} />}
43
+ {hintText && <HintText id={hintTextId}>{hintText}</HintText>}
43
44
  {errorMessage && <ErrorMessage id={errorMessageId}>{errorMessage}</ErrorMessage>}
44
45
  <div
45
46
  className={[
@@ -0,0 +1 @@
1
+ export { default } from './Select';
@@ -0,0 +1,7 @@
1
+ import { FormFieldBase, InputWidth } from "../../shared-types";
2
+
3
+ export interface SelectProps extends FormFieldBase<HTMLElement> {
4
+ defaultValue?: string;
5
+ placeholder?: string;
6
+ width?: InputWidth;
7
+ }
@@ -1,10 +1,12 @@
1
+ import { SequentialNavigationLinkProps, SequentialNavigationProps } from "./types";
2
+
1
3
  const SeqNavLink = ({
2
4
  children,
3
5
  href,
4
6
  isPrev,
5
7
  linkComponent,
6
8
  textLabel
7
- }: SGDS.Component.SequentialNavigation.Link) => {
9
+ }:SequentialNavigationLinkProps) => {
8
10
  const LINK_CLASSES = [
9
11
  'ds_sequential-nav__button',
10
12
  isPrev ? 'ds_sequential-nav__button--left' : 'ds_sequential-nav__button--right'
@@ -39,7 +41,7 @@ const NextLink = ({
39
41
  href,
40
42
  linkComponent,
41
43
  textLabel = 'Next'
42
- }: SGDS.Component.SequentialNavigation.Link) => {
44
+ }: SequentialNavigationLinkProps) => {
43
45
  return <SeqNavLink href={href} linkComponent={linkComponent} textLabel={textLabel}>{children}</SeqNavLink>
44
46
  };
45
47
 
@@ -48,7 +50,7 @@ const PreviousLink = ({
48
50
  href,
49
51
  linkComponent,
50
52
  textLabel = 'Previous'
51
- }: SGDS.Component.SequentialNavigation.Link) => {
53
+ }: SequentialNavigationLinkProps) => {
52
54
  return <SeqNavLink href={href} linkComponent={linkComponent} textLabel={textLabel} isPrev>{children}</SeqNavLink>
53
55
  };
54
56
 
@@ -57,7 +59,7 @@ const SequentialNavigation = ({
57
59
  children,
58
60
  className,
59
61
  ...props
60
- }: SGDS.Component.SequentialNavigation) => {
62
+ }: SequentialNavigationProps) => {
61
63
  return (
62
64
  <nav
63
65
  className={[
@@ -0,0 +1 @@
1
+ export { default } from './SequentialNavigation';
@@ -0,0 +1,12 @@
1
+ import { LinkComponent } from "../../shared-types";
2
+
3
+ export interface SequentialNavigationLinkProps extends React.AllHTMLAttributes<HTMLDivElement> {
4
+ href: string;
5
+ isPrev?: boolean;
6
+ linkComponent?: LinkComponent;
7
+ textLabel?: string;
8
+ }
9
+
10
+ export interface SequentialNavigationProps extends React.AllHTMLAttributes<HTMLElement> {
11
+ ariaLabel?: React.AriaAttributes['aria-label'];
12
+ }
@@ -1,11 +1,12 @@
1
1
  import { useEffect, useRef } from 'react';
2
- // @ts-ignore
2
+ // @ts-expect-error no types from core SGDS
3
3
  import DSSideNavigation from '@scottish-government/design-system/src/components/side-navigation/side-navigation';
4
+ import { SideNavigationItemProps, SideNavigationListProps, SideNavigationProps } from './types';
4
5
 
5
6
  const SideNavigationList = function ({
6
7
  children,
7
8
  isRoot
8
- }: SGDS.Component.SideNavigation.List) {
9
+ }: SideNavigationListProps) {
9
10
  return (
10
11
  <ul className="ds_side-navigation__list"
11
12
  id={isRoot ? 'side-navigation-root' : undefined }
@@ -21,7 +22,7 @@ const SideNavigationItem = function ({
21
22
  isCurrent = false,
22
23
  linkComponent,
23
24
  title
24
- }: SGDS.Component.SideNavigation.Item) {
25
+ }: SideNavigationItemProps) {
25
26
  const LINK_CLASS = 'ds_side-navigation__link';
26
27
 
27
28
  return (
@@ -47,7 +48,7 @@ const SideNavigation = function ({
47
48
  children,
48
49
  className,
49
50
  ...props
50
- }: SGDS.Component.SideNavigation) {
51
+ }: SideNavigationProps) {
51
52
  const ref = useRef(null);
52
53
 
53
54
  useEffect(() => {
@@ -0,0 +1 @@
1
+ export { default } from './SideNavigation';
@@ -0,0 +1,16 @@
1
+ import { LinkComponent } from "../../shared-types";
2
+
3
+ export interface SideNavigationListProps extends React.AllHTMLAttributes<HTMLUListElement> {
4
+ isRoot?: boolean;
5
+ }
6
+
7
+ export interface SideNavigationItemProps extends React.AllHTMLAttributes<HTMLLIElement> {
8
+ isCurrent?: boolean;
9
+ href: string;
10
+ linkComponent?: LinkComponent;
11
+ title: string;
12
+ }
13
+
14
+ export interface SideNavigationProps extends React.AllHTMLAttributes<HTMLElement> {
15
+ ariaLabel?: string;
16
+ }
@@ -1,10 +1,11 @@
1
1
  import React, { Children } from 'react';
2
2
  import ConditionalWrapper from '../../common/ConditionalWrapper';
3
+ import { SiteFooterLicenseProps, SiteFooterLinkProps, SiteFooterOrgProps, SiteFooterProps } from './types';
3
4
 
4
5
  const License = ({
5
6
  children,
6
7
  ...props
7
- }: SGDS.Component.SiteFooter.License) => {
8
+ }: SiteFooterLicenseProps) => {
8
9
  return (
9
10
  <div className="ds_site-footer__copyright" {...props}>
10
11
  {children}
@@ -15,7 +16,7 @@ const License = ({
15
16
  const Links = ({
16
17
  children,
17
18
  ...props
18
- }: SGDS.Component.SiteFooter.Links) => {
19
+ }: React.AllHTMLAttributes<HTMLUListElement>) => {
19
20
  return (
20
21
  <ul className="ds_site-footer__site-items" {...props}>
21
22
  {children}
@@ -28,7 +29,7 @@ const Link = ({
28
29
  href,
29
30
  linkComponent,
30
31
  ...props
31
- }: SGDS.Component.SiteFooter.Link) => {
32
+ }: SiteFooterLinkProps) => {
32
33
  function processChildren(children: React.ReactNode) {
33
34
  if (linkComponent) {
34
35
  return linkComponent({ href, children });
@@ -49,9 +50,9 @@ const Org = ({
49
50
  title,
50
51
  children,
51
52
  ...props
52
- }: SGDS.Component.SiteFooter.Org) => {
53
+ }: SiteFooterOrgProps) => {
53
54
  children = Children.map(children, child => {
54
- let thisChild = child as React.ReactElement<HTMLElement>;
55
+ const thisChild = child as React.ReactElement<HTMLElement>;
55
56
  if (thisChild && ['img', 'svg', 'picture'].includes(thisChild.type as string)) {
56
57
  return React.cloneElement(thisChild, { className: 'ds_site-footer__org-logo' });
57
58
  } else {
@@ -75,7 +76,7 @@ const SiteFooter = ({
75
76
  children,
76
77
  className,
77
78
  ...props
78
- }: SGDS.Component.SiteFooter) => {
79
+ }: SiteFooterProps) => {
79
80
  return (
80
81
  <footer
81
82
  className={[
@@ -0,0 +1 @@
1
+ export { default } from './SiteFooter';
@@ -0,0 +1,20 @@
1
+ import { LinkComponent } from "../../shared-types";
2
+
3
+ export interface SiteFooterLinkProps extends React.AllHTMLAttributes<HTMLLIElement> {
4
+ href?: string;
5
+ linkComponent?: LinkComponent;
6
+ }
7
+
8
+ export interface SiteFooterLicenseProps extends React.AllHTMLAttributes<HTMLDivElement> {
9
+ href?: string;
10
+ logoSrc?: string;
11
+ }
12
+
13
+ export interface SiteFooterOrgProps extends React.AllHTMLAttributes<HTMLDivElement> {
14
+ href?: string;
15
+ title: string;
16
+ }
17
+
18
+ export interface SiteFooterProps extends React.AllHTMLAttributes<HTMLElement> {
19
+ className?: string;
20
+ }
@@ -2,9 +2,9 @@ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import argTypes from '../../../.storybook/sgdsArgTypes';
3
3
 
4
4
  import SiteHeader from './SiteHeader';
5
- import SiteSearch from '../SiteSearch/SiteSearch';
6
- import SiteNavigation from '../SiteNavigation/SiteNavigation';
7
- import PhaseBanner from '../PhaseBanner/PhaseBanner';
5
+ import SiteSearch from '../SiteSearch';
6
+ import SiteNavigation from '../SiteNavigation';
7
+ import PhaseBanner from '../PhaseBanner';
8
8
 
9
9
  const meta = {
10
10
  title: 'Components/SiteHeader',
@@ -17,6 +17,7 @@ const meta = {
17
17
  <SiteHeader.Brand
18
18
  homeUrl="/"
19
19
  siteTitle="Design System React"
20
+ key="1"
20
21
  >
21
22
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 206.7 30.7">
22
23
  <title>The Scottish Government</title>
@@ -26,7 +27,7 @@ const meta = {
26
27
  <path fill="#333e48" d="M205.1 12.8c.8 0 1.3-.2 1.6-.5l-.4-1.3c-.1.2-.4.3-.8.3-.5 0-.8-.4-.8-1V6.1h1.6V4.6h-1.6V2.3H203v2.2h-1.3V6h1.3v4.7c0 1.4.7 2.1 2.1 2.1m-4.7-.2V6.9c0-1.7-.9-2.6-2.6-2.6-1.3 0-2.3.7-2.9 1.3v-1h-1.8v8.1h1.8V7c.4-.5 1.2-1.1 2.1-1.1 1 0 1.6.4 1.6 1.7v5.1h1.8zm-10.5-4.7h-4.5c.1-1 .8-2.1 2.3-2.1 1.5 0 2.1 1.2 2.2 2.1m-2.2 4.9c1.3 0 2.5-.4 3.3-1.2l-.8-1.2c-.6.6-1.5.9-2.3.9-1.5 0-2.4-1-2.6-2.2h6.2v-.4c0-2.5-1.5-4.4-4-4.4a4 4 0 0 0-4.1 4.2c.1 2.6 1.9 4.3 4.3 4.3m-5.9-.2V6.8c0-1.6-.9-2.4-2.3-2.4-1.2 0-2.3.8-2.7 1.5-.3-.9-1-1.5-2.2-1.5-1.2 0-2.3.8-2.6 1.3V4.6h-1.8v8.1h1.8V7c.4-.5 1.1-1.1 1.9-1.1 1 0 1.3.6 1.3 1.5v5.3h1.8V7c.4-.5 1.1-1.1 1.9-1.1 1 0 1.3.6 1.3 1.5v5.3h1.6zm-13.9 0V6.9c0-1.7-.9-2.6-2.6-2.6-1.3 0-2.3.7-2.9 1.3v-1h-1.8v8.1h1.8V7c.4-.5 1.2-1.1 2.1-1.1 1 0 1.6.4 1.6 1.7v5.1h1.8zm-11.1 0V7.1c.4-.6 1.3-1.1 2.1-1.1h.5V4.4c-1 0-2 .6-2.6 1.4V4.6H155v8.1h1.8zm-5.1-4.7h-4.5c.1-1 .8-2.1 2.3-2.1 1.5 0 2.1 1.2 2.2 2.1m-2.2 4.9c1.3 0 2.5-.4 3.3-1.2l-.8-1.2c-.6.6-1.5.9-2.3.9-1.5 0-2.4-1-2.6-2.2h6.2v-.4c0-2.5-1.5-4.4-4-4.4a4 4 0 0 0-4.1 4.2c.1 2.6 1.9 4.3 4.3 4.3m-7.8-.2 3.3-8.1h-1.9l-2.4 6.1-2.4-6.1h-1.9l3.3 8.1h2zm-9.7-1.3c-1.5 0-2.3-1.3-2.3-2.7 0-1.4.8-2.7 2.3-2.7 1.5 0 2.3 1.3 2.3 2.7 0 1.4-.8 2.7-2.3 2.7m0 1.5c2.6 0 4.1-1.9 4.1-4.2 0-2.3-1.6-4.2-4.1-4.2s-4.1 1.9-4.1 4.2a4 4 0 0 0 4.1 4.2m-10.7 0c3.5 0 5.6-2.4 5.6-6.2h-6.1v1.7h4a3.2 3.2 0 0 1-3.3 2.7c-2.2 0-3.8-1.7-3.8-4 0-2.4 1.6-4 3.8-4 1.2 0 2.3.7 2.9 1.5l1.6-.9a5.2 5.2 0 0 0-4.5-2.3 5.7 5.7 0 0 0-5.9 5.8c0 3.5 2.7 5.7 5.7 5.7m-11.5-.2V6.9c0-1.7-.9-2.6-2.6-2.6-1.3 0-2.3.7-2.8 1.3V1.5h-1.8v11.2h1.8V7c.4-.5 1.2-1.1 2.1-1.1 1 0 1.6.4 1.6 1.6v5.1h1.7zm-12.2.2c2.2 0 3.4-1.1 3.4-2.5 0-3.2-4.9-2.1-4.9-3.6 0-.6.6-1 1.5-1 1 0 1.9.4 2.4 1l.7-1.2a4.8 4.8 0 0 0-3.1-1.1c-2 0-3.2 1.1-3.2 2.4 0 3.1 4.9 2 4.9 3.6 0 .6-.6 1.1-1.6 1.1a4 4 0 0 1-2.7-1.1l-.8 1.3c.8.7 2 1.1 3.4 1.1m-5-8.2h-1.8v8.1h1.8V4.6zm-.9-1c.6 0 1.1-.5 1.1-1.1 0-.6-.5-1.1-1.1-1.1-.6 0-1.1.5-1.1 1.1 0 .6.5 1.1 1.1 1.1M88 12.8c.8 0 1.3-.2 1.6-.5l-.4-1.3c-.1.2-.4.3-.8.3-.5 0-.8-.4-.8-1V6.1h1.6V4.6h-1.6V2.3h-1.8v2.2h-1.3V6h1.3v4.7c.1 1.4.8 2.1 2.2 2.1m-5.6 0c.8 0 1.3-.2 1.6-.5l-.4-1.3c-.1.2-.4.3-.8.3-.5 0-.8-.4-.8-1V6.1h1.6V4.6H82V2.3h-1.8v2.2h-1.3V6h1.3v4.7c.1 1.4.8 2.1 2.2 2.1m-8.3-1.5c-1.5 0-2.3-1.3-2.3-2.7 0-1.4.8-2.7 2.3-2.7 1.5 0 2.3 1.3 2.3 2.7 0 1.4-.8 2.7-2.3 2.7m0 1.5c2.6 0 4.1-1.9 4.1-4.2 0-2.3-1.6-4.2-4.1-4.2-2.6 0-4.1 1.9-4.1 4.2a4 4 0 0 0 4.1 4.2m-8.1 0c1.6 0 2.5-.7 3.1-1.4L68 10.3c-.5.6-1.1 1-1.9 1-1.5 0-2.4-1.1-2.4-2.7s1-2.7 2.4-2.7c.8 0 1.4.3 1.9.9l1.2-1.1c-.6-.7-1.6-1.3-3.2-1.3a4.1 4.1 0 0 0-4.2 4.2c.1 2.4 1.8 4.2 4.2 4.2m-9.7 0c3 0 4.3-1.6 4.3-3.5 0-4.1-6.5-2.9-6.5-4.9.1-.8.8-1.4 1.9-1.4 1.2 0 2.4.4 3.2 1.3l1.1-1.5c-1-1-2.4-1.6-4.2-1.6-2.5 0-4.1 1.4-4.1 3.3 0 4.1 6.5 2.6 6.5 5 0 .8-.6 1.5-2.2 1.5s-2.8-.7-3.5-1.6l-1.1 1.5a6 6 0 0 0 4.6 1.9"/>
27
28
  </svg>
28
29
  </SiteHeader.Brand>,
29
- <SiteHeader.Navigation>
30
+ <SiteHeader.Navigation key="2">
30
31
  <SiteNavigation>
31
32
  <SiteNavigation.Item href="#about">
32
33
  About
@@ -51,10 +52,10 @@ const meta = {
51
52
  </SiteNavigation.Item>
52
53
  </SiteNavigation>
53
54
  </SiteHeader.Navigation>,
54
- <SiteHeader.Search>
55
+ <SiteHeader.Search key="3">
55
56
  <SiteSearch id="site-header-search" />
56
57
  </SiteHeader.Search>,
57
- <SiteHeader.Phase>
58
+ <SiteHeader.Phase key="4">
58
59
  <PhaseBanner phaseName="Beta">
59
60
  This is a new service. Your{' '}
60
61
  <a href="#feedback">