@scottish-government/designsystem-react 0.10.2 → 0.11.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 (419) hide show
  1. package/@types/components/Accordion.d.ts +3 -2
  2. package/@types/components/ButtonGroup.d.ts +5 -0
  3. package/@types/components/PageHeader.d.ts +2 -1
  4. package/@types/components/RadioButton.d.ts +2 -2
  5. package/@types/components/SearchFacets.d.ts +18 -0
  6. package/@types/components/SearchFilters.d.ts +14 -0
  7. package/@types/components/SearchResult.d.ts +30 -0
  8. package/@types/components/SearchSort.d.ts +9 -0
  9. package/@types/components/SideNavigation.d.ts +1 -1
  10. package/CHANGELOG.md +39 -5
  11. package/dist/common/AbstractNotificationBanner/AbstractNotificationBanner.d.ts +9 -0
  12. package/dist/common/AbstractNotificationBanner/AbstractNotificationBanner.jsx +62 -0
  13. package/dist/common/AbstractNotificationBanner/index.d.ts +1 -0
  14. package/dist/common/AbstractNotificationBanner/index.js +8 -0
  15. package/dist/common/ActionLink/ActionLink.d.ts +5 -0
  16. package/dist/common/ActionLink/ActionLink.jsx +19 -0
  17. package/dist/common/ActionLink/index.d.ts +1 -0
  18. package/dist/common/ActionLink/index.js +8 -0
  19. package/dist/common/ConditionalWrapper/ConditionalWrapper.d.ts +8 -0
  20. package/dist/common/ConditionalWrapper/ConditionalWrapper.jsx +8 -0
  21. package/dist/common/ConditionalWrapper/index.d.ts +1 -0
  22. package/dist/common/ConditionalWrapper/index.js +8 -0
  23. package/dist/common/FileIcon/FileIcon.d.ts +6 -0
  24. package/dist/common/FileIcon/FileIcon.jsx +46 -0
  25. package/dist/common/FileIcon/index.d.ts +1 -0
  26. package/dist/common/FileIcon/index.js +8 -0
  27. package/dist/common/HintText/HintText.d.ts +5 -0
  28. package/dist/common/HintText/HintText.jsx +9 -0
  29. package/dist/common/HintText/index.d.ts +1 -0
  30. package/dist/common/HintText/index.js +8 -0
  31. package/dist/common/Icon/Icon.d.ts +6 -0
  32. package/dist/common/Icon/Icon.jsx +51 -0
  33. package/dist/common/Icon/index.d.ts +1 -0
  34. package/dist/common/Icon/index.js +8 -0
  35. package/dist/common/ScreenReaderText/ScreenReaderText.d.ts +5 -0
  36. package/dist/common/ScreenReaderText/ScreenReaderText.jsx +9 -0
  37. package/dist/common/ScreenReaderText/index.d.ts +1 -0
  38. package/dist/common/ScreenReaderText/index.js +8 -0
  39. package/dist/common/WrapperTag/WrapperTag.d.ts +8 -0
  40. package/dist/common/WrapperTag/WrapperTag.jsx +11 -0
  41. package/dist/common/WrapperTag/index.d.ts +1 -0
  42. package/dist/common/WrapperTag/index.js +8 -0
  43. package/dist/common/index.d.ts +8 -0
  44. package/dist/common/index.js +22 -0
  45. package/dist/components/Accordion/Accordion.d.ts +10 -0
  46. package/dist/components/Accordion/Accordion.jsx +8 -3
  47. package/dist/components/Accordion/index.d.ts +1 -0
  48. package/dist/components/Accordion/index.js +8 -0
  49. package/dist/components/AspectBox/AspectBox.d.ts +6 -0
  50. package/dist/components/AspectBox/index.d.ts +1 -0
  51. package/dist/components/AspectBox/index.js +8 -0
  52. package/dist/components/BackToTop/BackToTop.d.ts +5 -0
  53. package/dist/components/BackToTop/index.d.ts +1 -0
  54. package/dist/components/BackToTop/index.js +8 -0
  55. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +9 -0
  56. package/dist/components/Breadcrumbs/index.d.ts +1 -0
  57. package/dist/components/Breadcrumbs/index.js +8 -0
  58. package/dist/components/Button/Button.d.ts +5 -0
  59. package/dist/components/Button/ButtonGroup.d.ts +5 -0
  60. package/dist/components/Button/ButtonGroup.jsx +13 -0
  61. package/dist/components/Button/index.d.ts +2 -0
  62. package/dist/components/Button/index.js +10 -0
  63. package/dist/components/ButtonGroup/ButtonGroup.jsx +13 -0
  64. package/dist/components/CategoryItem/CategoryItem.d.ts +5 -0
  65. package/dist/components/CategoryItem/index.d.ts +1 -0
  66. package/dist/components/CategoryItem/index.js +8 -0
  67. package/dist/components/CategoryList/CategoryList.d.ts +6 -0
  68. package/dist/components/CategoryList/index.d.ts +1 -0
  69. package/dist/components/CategoryList/index.js +8 -0
  70. package/dist/components/Checkbox/Checkbox.d.ts +5 -0
  71. package/dist/components/Checkbox/CheckboxGroup.d.ts +6 -0
  72. package/dist/components/Checkbox/index.d.ts +2 -0
  73. package/dist/components/Checkbox/index.js +10 -0
  74. package/dist/components/ConfirmationMessage/ConfirmationMessage.d.ts +5 -0
  75. package/dist/components/ConfirmationMessage/index.d.ts +1 -0
  76. package/dist/components/ConfirmationMessage/index.js +8 -0
  77. package/dist/components/ContentsNav/ContentsNav.d.ts +10 -0
  78. package/dist/components/ContentsNav/index.d.ts +1 -0
  79. package/dist/components/ContentsNav/index.js +8 -0
  80. package/dist/components/CookieBanner/CookieBanner.d.ts +9 -0
  81. package/dist/components/CookieBanner/index.d.ts +1 -0
  82. package/dist/components/CookieBanner/index.js +8 -0
  83. package/dist/components/DatePicker/DatePicker.d.ts +5 -0
  84. package/dist/components/DatePicker/DatePicker.jsx +2 -2
  85. package/dist/components/DatePicker/index.d.ts +1 -0
  86. package/dist/components/DatePicker/index.js +8 -0
  87. package/dist/components/Details/Details.d.ts +5 -0
  88. package/dist/components/Details/index.d.ts +1 -0
  89. package/dist/components/Details/index.js +8 -0
  90. package/dist/components/ErrorMessage/ErrorMessage.d.ts +5 -0
  91. package/dist/components/ErrorMessage/index.d.ts +1 -0
  92. package/dist/components/ErrorMessage/index.js +8 -0
  93. package/dist/components/ErrorSummary/ErrorSummary.d.ts +9 -0
  94. package/dist/components/ErrorSummary/index.d.ts +1 -0
  95. package/dist/components/ErrorSummary/index.js +8 -0
  96. package/dist/components/FeatureHeader/FeatureHeader.d.ts +13 -0
  97. package/dist/components/FeatureHeader/FeatureHeader.jsx +70 -0
  98. package/dist/components/FeatureHeader/index.d.ts +1 -0
  99. package/dist/components/FeatureHeader/index.js +8 -0
  100. package/dist/components/FileDownload/FileDownload.d.ts +5 -0
  101. package/dist/components/FileDownload/index.d.ts +1 -0
  102. package/dist/components/FileDownload/index.js +8 -0
  103. package/dist/components/HideThisPage/HideThisPage.d.ts +6 -0
  104. package/dist/components/HideThisPage/index.d.ts +1 -0
  105. package/dist/components/HideThisPage/index.js +8 -0
  106. package/dist/components/InsetText/InsetText.d.ts +5 -0
  107. package/dist/components/InsetText/index.d.ts +1 -0
  108. package/dist/components/InsetText/index.js +8 -0
  109. package/dist/components/NotificationBanner/NotificationBanner.d.ts +9 -0
  110. package/dist/components/NotificationBanner/index.d.ts +1 -0
  111. package/dist/components/NotificationBanner/index.js +8 -0
  112. package/dist/components/NotificationPanel/NotificationPanel.d.ts +5 -0
  113. package/dist/components/NotificationPanel/index.d.ts +1 -0
  114. package/dist/components/NotificationPanel/index.js +8 -0
  115. package/dist/components/PageHeader/PageHeader.d.ts +5 -0
  116. package/dist/components/PageHeader/PageHeader.jsx +2 -2
  117. package/dist/components/PageHeader/index.d.ts +1 -0
  118. package/dist/components/PageHeader/index.js +8 -0
  119. package/dist/components/PageMetadata/PageMetadata.d.ts +9 -0
  120. package/dist/components/PageMetadata/index.d.ts +1 -0
  121. package/dist/components/PageMetadata/index.js +8 -0
  122. package/dist/components/Pagination/Pagination.d.ts +7 -0
  123. package/dist/components/Pagination/index.d.ts +1 -0
  124. package/dist/components/Pagination/index.js +8 -0
  125. package/dist/components/PhaseBanner/PhaseBanner.d.ts +5 -0
  126. package/dist/components/PhaseBanner/index.d.ts +1 -0
  127. package/dist/components/PhaseBanner/index.js +8 -0
  128. package/dist/components/Question/Question.d.ts +5 -0
  129. package/dist/components/Question/Question.jsx +1 -1
  130. package/dist/components/Question/index.d.ts +1 -0
  131. package/dist/components/Question/index.js +8 -0
  132. package/dist/components/RadioButton/RadioButton.d.ts +5 -0
  133. package/dist/components/RadioButton/RadioGroup.d.ts +6 -0
  134. package/dist/components/RadioButton/RadioGroup.jsx +1 -1
  135. package/dist/components/RadioButton/index.d.ts +2 -0
  136. package/dist/components/RadioButton/index.js +10 -0
  137. package/dist/components/SearchFacets/SearchFacets.d.ts +14 -0
  138. package/dist/components/SearchFacets/SearchFacets.jsx +101 -0
  139. package/dist/components/SearchFacets/index.d.ts +1 -0
  140. package/dist/components/SearchFacets/index.js +8 -0
  141. package/dist/components/SearchFilters/SearchFilters.d.ts +16 -0
  142. package/dist/components/SearchFilters/SearchFilters.jsx +63 -0
  143. package/dist/components/SearchFilters/index.d.ts +1 -0
  144. package/dist/components/SearchFilters/index.js +8 -0
  145. package/dist/components/SearchResult/SearchResult.d.ts +28 -0
  146. package/dist/components/SearchResult/SearchResult.jsx +93 -0
  147. package/dist/components/SearchResult/index.d.ts +1 -0
  148. package/dist/components/SearchResult/index.js +8 -0
  149. package/dist/components/SearchSort/SearchSort.d.ts +10 -0
  150. package/dist/components/SearchSort/SearchSort.jsx +28 -0
  151. package/dist/components/SearchSort/index.d.ts +1 -0
  152. package/dist/components/SearchSort/index.js +8 -0
  153. package/dist/components/Select/Select.d.ts +5 -0
  154. package/dist/components/Select/Select.jsx +1 -1
  155. package/dist/components/Select/index.d.ts +1 -0
  156. package/dist/components/Select/index.js +8 -0
  157. package/dist/components/SequentialNavigation/SequentialNavigation.d.ts +13 -0
  158. package/dist/components/SequentialNavigation/SequentialNavigation.jsx +0 -1
  159. package/dist/components/SequentialNavigation/index.d.ts +1 -0
  160. package/dist/components/SequentialNavigation/index.js +8 -0
  161. package/dist/components/SideNavigation/SideNavigation.d.ts +13 -0
  162. package/dist/components/SideNavigation/SideNavigation.jsx +2 -2
  163. package/dist/components/SideNavigation/index.d.ts +1 -0
  164. package/dist/components/SideNavigation/index.js +8 -0
  165. package/dist/components/SiteFooter/SiteFooter.d.ts +22 -0
  166. package/dist/components/SiteFooter/index.d.ts +1 -0
  167. package/dist/components/SiteFooter/index.js +8 -0
  168. package/dist/components/SiteHeader/SiteHeader.d.ts +22 -0
  169. package/dist/components/SiteHeader/SiteHeader.jsx +1 -2
  170. package/dist/components/SiteHeader/index.d.ts +1 -0
  171. package/dist/components/SiteHeader/index.js +8 -0
  172. package/dist/components/SiteNavigation/SiteNavigation.d.ts +9 -0
  173. package/dist/components/SiteNavigation/index.d.ts +1 -0
  174. package/dist/components/SiteNavigation/index.js +8 -0
  175. package/dist/components/SiteSearch/SiteSearch.d.ts +5 -0
  176. package/dist/components/SiteSearch/SiteSearch.jsx +1 -1
  177. package/dist/components/SiteSearch/index.d.ts +1 -0
  178. package/dist/components/SiteSearch/index.js +8 -0
  179. package/dist/components/SkipLinks/SkipLinks.d.ts +10 -0
  180. package/dist/components/SkipLinks/SkipLinks.jsx +42 -0
  181. package/dist/components/SkipLinks/index.d.ts +1 -0
  182. package/dist/components/SkipLinks/index.js +8 -0
  183. package/dist/components/SummaryCard/SummaryCard.d.ts +10 -0
  184. package/dist/components/SummaryCard/index.d.ts +1 -0
  185. package/dist/components/SummaryCard/index.js +8 -0
  186. package/dist/components/SummaryList/SummaryList.d.ts +18 -0
  187. package/dist/components/SummaryList/index.d.ts +1 -0
  188. package/dist/components/SummaryList/index.js +8 -0
  189. package/dist/components/Table/Table.d.ts +5 -0
  190. package/dist/components/Table/index.d.ts +1 -0
  191. package/dist/components/Table/index.js +8 -0
  192. package/dist/components/Tabs/Tabs.d.ts +10 -0
  193. package/dist/components/Tabs/index.d.ts +1 -0
  194. package/dist/components/Tabs/index.js +8 -0
  195. package/dist/components/Tag/Tag.d.ts +5 -0
  196. package/dist/components/Tag/index.d.ts +1 -0
  197. package/dist/components/Tag/index.js +8 -0
  198. package/dist/components/TaskList/TaskList.d.ts +13 -0
  199. package/dist/components/TaskList/TaskList.jsx +1 -1
  200. package/dist/components/TaskList/index.d.ts +1 -0
  201. package/dist/components/TaskList/index.js +8 -0
  202. package/dist/components/TextInput/TextInput.d.ts +5 -0
  203. package/dist/components/TextInput/TextInput.jsx +2 -2
  204. package/dist/components/TextInput/index.d.ts +1 -0
  205. package/dist/components/TextInput/index.js +8 -0
  206. package/dist/components/Textarea/Textarea.d.ts +5 -0
  207. package/dist/components/Textarea/Textarea.jsx +1 -1
  208. package/dist/components/Textarea/index.d.ts +1 -0
  209. package/dist/components/Textarea/index.js +8 -0
  210. package/dist/components/WarningText/WarningText.d.ts +5 -0
  211. package/dist/components/WarningText/index.d.ts +1 -0
  212. package/dist/components/WarningText/index.js +8 -0
  213. package/dist/components/index.d.ts +46 -0
  214. package/dist/components/index.js +101 -0
  215. package/dist/hooks/index.d.ts +1 -0
  216. package/dist/hooks/index.js +8 -0
  217. package/dist/hooks/useTracking/index.d.ts +1 -0
  218. package/dist/hooks/useTracking/index.js +8 -0
  219. package/dist/hooks/useTracking/useTracking.d.ts +1 -0
  220. package/dist/hooks/useTracking/useTracking.js +21 -0
  221. package/dist/images/documents/audio.d.ts +4 -0
  222. package/dist/images/documents/csv.d.ts +4 -0
  223. package/dist/images/documents/excel.d.ts +4 -0
  224. package/dist/images/documents/file.d.ts +4 -0
  225. package/dist/images/documents/generic.d.ts +4 -0
  226. package/dist/images/documents/geodata.d.ts +4 -0
  227. package/dist/images/documents/ical.d.ts +4 -0
  228. package/dist/images/documents/ico.d.ts +4 -0
  229. package/dist/images/documents/image.d.ts +4 -0
  230. package/dist/images/documents/index.d.ts +22 -0
  231. package/dist/images/documents/odf.d.ts +4 -0
  232. package/dist/images/documents/odg.d.ts +4 -0
  233. package/dist/images/documents/odp.d.ts +4 -0
  234. package/dist/images/documents/ods.d.ts +4 -0
  235. package/dist/images/documents/odt.d.ts +4 -0
  236. package/dist/images/documents/pdf.d.ts +4 -0
  237. package/dist/images/documents/ppt.d.ts +4 -0
  238. package/dist/images/documents/rtf.d.ts +4 -0
  239. package/dist/images/documents/text.d.ts +4 -0
  240. package/dist/images/documents/video.d.ts +4 -0
  241. package/dist/images/documents/word.d.ts +4 -0
  242. package/dist/images/documents/xml.d.ts +4 -0
  243. package/dist/images/documents/zip.d.ts +4 -0
  244. package/dist/images/icons/arrow_upward.d.ts +4 -0
  245. package/dist/images/icons/calendar_today.d.ts +4 -0
  246. package/dist/images/icons/cancel.d.ts +4 -0
  247. package/dist/images/icons/check_circle.d.ts +4 -0
  248. package/dist/images/icons/chevron_left.d.ts +4 -0
  249. package/dist/images/icons/chevron_right.d.ts +4 -0
  250. package/dist/images/icons/close.d.ts +4 -0
  251. package/dist/images/icons/description.d.ts +4 -0
  252. package/dist/images/icons/double_chevron_left.d.ts +4 -0
  253. package/dist/images/icons/double_chevron_right.d.ts +4 -0
  254. package/dist/images/icons/error.d.ts +4 -0
  255. package/dist/images/icons/expand_less.d.ts +4 -0
  256. package/dist/images/icons/expand_more.d.ts +4 -0
  257. package/dist/images/icons/index.d.ts +17 -0
  258. package/dist/images/icons/list.d.ts +4 -0
  259. package/dist/images/icons/menu.d.ts +4 -0
  260. package/dist/images/icons/priority_high.d.ts +4 -0
  261. package/dist/images/icons/search.d.ts +4 -0
  262. package/dist/images/index.d.ts +2 -0
  263. package/dist/images/index.js +38 -0
  264. package/dist/index.d.ts +4 -0
  265. package/dist/index.js +40 -0
  266. package/dist/tsconfig.tsbuildinfo +1 -1
  267. package/dist/utils/context.d.ts +4 -0
  268. package/package.json +25 -23
  269. package/src/common/{AbstractNotificationBanner.test.tsx → AbstractNotificationBanner/AbstractNotificationBanner.test.tsx} +1 -1
  270. package/src/common/{AbstractNotificationBanner.tsx → AbstractNotificationBanner/AbstractNotificationBanner.tsx} +2 -2
  271. package/src/common/AbstractNotificationBanner/index.ts +1 -0
  272. package/src/common/ActionLink/index.ts +1 -0
  273. package/src/common/ConditionalWrapper/index.ts +1 -0
  274. package/src/common/{FileIcon.tsx → FileIcon/FileIcon.tsx} +1 -1
  275. package/src/common/FileIcon/index.ts +1 -0
  276. package/src/common/HintText/index.ts +1 -0
  277. package/src/common/{Icon.tsx → Icon/Icon.tsx} +1 -1
  278. package/src/common/Icon/index.ts +1 -0
  279. package/src/common/ScreenReaderText/index.ts +1 -0
  280. package/src/common/WrapperTag/index.ts +1 -0
  281. package/src/common/index.ts +8 -0
  282. package/src/components/Accordion/Accordion.Item.stories.tsx +10 -9
  283. package/src/components/Accordion/Accordion.stories.tsx +4 -4
  284. package/src/components/Accordion/Accordion.test.tsx +48 -14
  285. package/src/components/Accordion/Accordion.tsx +12 -1
  286. package/src/components/Accordion/index.ts +1 -0
  287. package/src/components/AspectBox/index.ts +1 -0
  288. package/src/components/BackToTop/index.ts +1 -0
  289. package/src/components/Breadcrumbs/Breadcrumbs.Item.stories.tsx +8 -1
  290. package/src/components/Breadcrumbs/index.ts +1 -0
  291. package/src/components/Button/Button.stories.tsx +1 -1
  292. package/src/components/Button/ButtonGroup.stories.tsx +41 -0
  293. package/src/components/Button/ButtonGroup.test.tsx +45 -0
  294. package/src/components/Button/ButtonGroup.tsx +20 -0
  295. package/src/components/Button/index.ts +2 -0
  296. package/src/components/CategoryItem/index.ts +1 -0
  297. package/src/components/CategoryList/CategoryList.stories.tsx +1 -1
  298. package/src/components/CategoryList/CategoryList.test.tsx +1 -1
  299. package/src/components/CategoryList/index.ts +1 -0
  300. package/src/components/Checkbox/index.ts +2 -0
  301. package/src/components/ConfirmationMessage/index.ts +1 -0
  302. package/src/components/ContentsNav/ContentsNav.Item.stories.tsx +8 -0
  303. package/src/components/ContentsNav/index.ts +1 -0
  304. package/src/components/CookieBanner/CookieBanner.Buttons.stories.tsx +1 -1
  305. package/src/components/CookieBanner/CookieBanner.stories.tsx +1 -1
  306. package/src/components/CookieBanner/index.ts +1 -0
  307. package/src/components/DatePicker/DatePicker.tsx +2 -2
  308. package/src/components/DatePicker/index.ts +1 -0
  309. package/src/components/Details/index.ts +1 -0
  310. package/src/components/ErrorMessage/index.ts +1 -0
  311. package/src/components/ErrorSummary/ErrorSummary.Item.stories.tsx +7 -0
  312. package/src/components/ErrorSummary/index.ts +1 -0
  313. package/src/components/FeatureHeader/FeatureHeader.stories.tsx +60 -0
  314. package/src/components/FeatureHeader/FeatureHeader.tsx +94 -0
  315. package/src/components/FeatureHeader/index.ts +1 -0
  316. package/src/components/FileDownload/index.ts +1 -0
  317. package/src/components/HideThisPage/index.ts +1 -0
  318. package/src/components/InsetText/index.ts +1 -0
  319. package/src/components/NotificationBanner/index.ts +1 -0
  320. package/src/components/NotificationPanel/index.ts +1 -0
  321. package/src/components/PageHeader/PageHeader.stories.tsx +1 -1
  322. package/src/components/PageHeader/PageHeader.tsx +2 -1
  323. package/src/components/PageHeader/index.ts +1 -0
  324. package/src/components/PageMetadata/PageMetadata.Item.stories.tsx +9 -0
  325. package/src/components/PageMetadata/index.ts +1 -0
  326. package/src/components/Pagination/index.ts +1 -0
  327. package/src/components/PhaseBanner/index.ts +1 -0
  328. package/src/components/Question/Question.stories.tsx +2 -3
  329. package/src/components/Question/Question.tsx +2 -2
  330. package/src/components/Question/index.ts +1 -0
  331. package/src/components/RadioButton/RadioGroup.stories.tsx +1 -2
  332. package/src/components/RadioButton/RadioGroup.test.tsx +1 -2
  333. package/src/components/RadioButton/RadioGroup.tsx +2 -2
  334. package/src/components/RadioButton/index.ts +2 -0
  335. package/src/components/SearchFacets/SearchFacets.Group.stories.tsx +56 -0
  336. package/src/components/SearchFacets/SearchFacets.Item.stories.tsx +53 -0
  337. package/src/components/SearchFacets/SearchFacets.stories.tsx +38 -0
  338. package/src/components/SearchFacets/SearchFacets.test.tsx +214 -0
  339. package/src/components/SearchFacets/SearchFacets.tsx +99 -0
  340. package/src/components/SearchFacets/index.ts +1 -0
  341. package/src/components/SearchFilters/SearchFilters.Panel.stories.tsx +201 -0
  342. package/src/components/SearchFilters/SearchFilters.stories.tsx +137 -0
  343. package/src/components/SearchFilters/SearchFilters.test.tsx +161 -0
  344. package/src/components/SearchFilters/SearchFilters.tsx +89 -0
  345. package/src/components/SearchFilters/index.ts +1 -0
  346. package/src/components/SearchResult/SearchResult.stories.tsx +111 -0
  347. package/src/components/SearchResult/SearchResult.test.tsx +215 -0
  348. package/src/components/SearchResult/SearchResult.tsx +137 -0
  349. package/src/components/SearchResult/index.ts +1 -0
  350. package/src/components/SearchSort/SearchSort.stories.tsx +32 -0
  351. package/src/components/SearchSort/SearchSort.test.tsx +129 -0
  352. package/src/components/SearchSort/SearchSort.tsx +45 -0
  353. package/src/components/SearchSort/index.ts +1 -0
  354. package/src/components/Select/Select.tsx +1 -1
  355. package/src/components/Select/index.ts +1 -0
  356. package/src/components/SequentialNavigation/SequentialNavigation.Next.stories.tsx +1 -1
  357. package/src/components/SequentialNavigation/SequentialNavigation.Previous.stories.tsx +1 -1
  358. package/src/components/SequentialNavigation/SequentialNavigation.tsx +0 -1
  359. package/src/components/SequentialNavigation/index.ts +1 -0
  360. package/src/components/SideNavigation/SideNavigation.Item.stories.tsx +9 -0
  361. package/src/components/SideNavigation/SideNavigation.List.stories.tsx +7 -0
  362. package/src/components/SideNavigation/SideNavigation.tsx +2 -1
  363. package/src/components/SideNavigation/index.ts +1 -0
  364. package/src/components/SiteFooter/SiteFooter.License.stories.tsx +7 -0
  365. package/src/components/SiteFooter/SiteFooter.Link.stories.tsx +9 -0
  366. package/src/components/SiteFooter/SiteFooter.Org.stories.tsx +7 -0
  367. package/src/components/SiteFooter/index.ts +1 -0
  368. package/src/components/SiteHeader/SiteHeader.stories.tsx +3 -3
  369. package/src/components/SiteHeader/SiteHeader.test.tsx +3 -3
  370. package/src/components/SiteHeader/SiteHeader.tsx +1 -3
  371. package/src/components/SiteHeader/index.ts +1 -0
  372. package/src/components/SiteNavigation/SiteNavigation.Item.stories.tsx +10 -0
  373. package/src/components/SiteNavigation/index.ts +1 -0
  374. package/src/components/SiteSearch/SiteSearch.tsx +1 -1
  375. package/src/components/SiteSearch/index.ts +1 -0
  376. package/src/components/SkipLinks/SkipLinks.Item.stories.tsx +11 -1
  377. package/src/components/SkipLinks/SkipLinks.tsx +10 -0
  378. package/src/components/SkipLinks/index.ts +1 -0
  379. package/src/components/SummaryCard/SummaryCard.Action.stories.tsx +7 -0
  380. package/src/components/SummaryCard/SummaryCard.stories.tsx +8 -1
  381. package/src/components/SummaryCard/SummaryCard.test.tsx +2 -2
  382. package/src/components/SummaryCard/index.ts +1 -0
  383. package/src/components/SummaryList/SummaryList.Item.stories.tsx +15 -0
  384. package/src/components/SummaryList/SummaryList.Value.stories.tsx +5 -2
  385. package/src/components/SummaryList/index.ts +1 -0
  386. package/src/components/Table/index.ts +1 -0
  387. package/src/components/Tabs/Tabs.Item.stories.tsx +4 -1
  388. package/src/components/Tabs/index.ts +1 -0
  389. package/src/components/Tag/index.ts +1 -0
  390. package/src/components/TaskList/TaskList.Group.stories.tsx +9 -0
  391. package/src/components/TaskList/TaskList.Item.stories.tsx +7 -0
  392. package/src/components/TaskList/TaskList.tsx +1 -1
  393. package/src/components/TaskList/index.ts +1 -0
  394. package/src/components/TextInput/TextInput.tsx +2 -2
  395. package/src/components/TextInput/index.ts +1 -0
  396. package/src/components/Textarea/Textarea.tsx +1 -1
  397. package/src/components/Textarea/index.ts +1 -0
  398. package/src/components/WarningText/index.ts +1 -0
  399. package/src/components/index.ts +46 -0
  400. package/src/hooks/index.ts +1 -0
  401. package/src/hooks/useTracking/index.ts +1 -0
  402. package/src/images/index.ts +2 -0
  403. package/src/index.ts +4 -0
  404. package/tsconfig.json +14 -14
  405. package/vite.config.ts +2 -1
  406. /package/src/common/{ActionLink.test.tsx → ActionLink/ActionLink.test.tsx} +0 -0
  407. /package/src/common/{ActionLink.tsx → ActionLink/ActionLink.tsx} +0 -0
  408. /package/src/common/{ConditionalWrapper.test.tsx → ConditionalWrapper/ConditionalWrapper.test.tsx} +0 -0
  409. /package/src/common/{ConditionalWrapper.tsx → ConditionalWrapper/ConditionalWrapper.tsx} +0 -0
  410. /package/src/common/{FileIcon.test.tsx → FileIcon/FileIcon.test.tsx} +0 -0
  411. /package/src/common/{HintText.test.tsx → HintText/HintText.test.tsx} +0 -0
  412. /package/src/common/{HintText.tsx → HintText/HintText.tsx} +0 -0
  413. /package/src/common/{Icon.test.tsx → Icon/Icon.test.tsx} +0 -0
  414. /package/src/common/{ScreenReaderText.test.tsx → ScreenReaderText/ScreenReaderText.test.tsx} +0 -0
  415. /package/src/common/{ScreenReaderText.tsx → ScreenReaderText/ScreenReaderText.tsx} +0 -0
  416. /package/src/common/{WrapperTag.test.tsx → WrapperTag/WrapperTag.test.tsx} +0 -0
  417. /package/src/common/{WrapperTag.tsx → WrapperTag/WrapperTag.tsx} +0 -0
  418. /package/src/hooks/{useTracking.test.tsx → useTracking/useTracking.test.tsx} +0 -0
  419. /package/src/hooks/{useTracking.ts → useTracking/useTracking.ts} +0 -0
@@ -1,4 +1,4 @@
1
- import { test, expect } from 'vitest';
1
+ import { test, expect, vi } from 'vitest';
2
2
  import { render, screen, within } from '@testing-library/react';
3
3
  import Accordion from './Accordion';
4
4
 
@@ -13,17 +13,17 @@ test('accordion renders correctly', () => {
13
13
 
14
14
  render(
15
15
  <Accordion id={ACCORDION_ID} data-testid={ACCORDION_ID}>
16
- <Accordion.Item id="accordion-1" title="Healthcare for veterans">
16
+ <Accordion.Item id="accordion-1" heading="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>
19
19
  <p>If you have a health condition that’s related to your service, you’re
20
20
  entitled to priority treatment based on clinical need.</p>
21
21
  </Accordion.Item>
22
- <Accordion.Item isOpen id="accordion-2" title="Employability for veterans">
22
+ <Accordion.Item isOpen id="accordion-2" heading="Employability for veterans">
23
23
  <p>If you&apos;re looking for a job, there are several organisations that can help
24
24
  you <a href="#accordion-link">find a job or develop new skills</a>.</p>
25
25
  </Accordion.Item>
26
- <Accordion.Item id="accordion-3" title="Housing for veterans">
26
+ <Accordion.Item id="accordion-3" heading="Housing for veterans">
27
27
  <p>If you need <a href="#accordion-link">help finding a place to live</a>{' '}
28
28
  there&apos;s support specifically for veterans.</p>
29
29
  </Accordion.Item>
@@ -48,17 +48,17 @@ test('accordion renders correctly', () => {
48
48
  test('accordion without open all', () => {
49
49
  render(
50
50
  <Accordion id={ACCORDION_ID} data-testid={ACCORDION_ID} hideOpenAll>
51
- <Accordion.Item id="accordion-1" title="Healthcare for veterans">
51
+ <Accordion.Item id="accordion-1" heading="Healthcare for veterans">
52
52
  <p>Veterans are entitled to the same healthcare as any citizen. And there
53
53
  are health care options and support available specifically for veterans.</p>
54
54
  <p>If you have a health condition that’s related to your service, you’re
55
55
  entitled to priority treatment based on clinical need.</p>
56
56
  </Accordion.Item>
57
- <Accordion.Item id="accordion-2" title="Employability for veterans">
57
+ <Accordion.Item id="accordion-2" heading="Employability for veterans">
58
58
  <p>If you&apos;re looking for a job, there are several organisations that can help
59
59
  you <a href="#accordion-link">find a job or develop new skills</a>.</p>
60
60
  </Accordion.Item>
61
- <Accordion.Item id="accordion-3" title="Housing for veterans">
61
+ <Accordion.Item id="accordion-3" heading="Housing for veterans">
62
62
  <p>If you need <a href="#accordion-link">help finding a place to live</a>{' '}
63
63
  there&apos;s support specifically for veterans.</p>
64
64
  </Accordion.Item>
@@ -86,7 +86,7 @@ test('accordion with custom heading level', () => {
86
86
 
87
87
  render(
88
88
  <Accordion id={ACCORDION_ID} data-testid={ACCORDION_ID} headingLevel={HEADING_LEVEL}>
89
- <Accordion.Item id="accordion-1" title="Healthcare for veterans">
89
+ <Accordion.Item id="accordion-1" heading="Healthcare for veterans">
90
90
  <p>Veterans are entitled to the same healthcare as any citizen. And there
91
91
  are health care options and support available specifically for veterans.</p>
92
92
  <p>If you have a health condition that’s related to your service, you’re
@@ -121,7 +121,7 @@ test('passing additional CSS classes', () => {
121
121
 
122
122
  test('accordion item renders correctly', () => {
123
123
  render(
124
- <Accordion.Item id={ACCORDION_ITEM_ID} data-testid={ACCORDION_ITEM_ID} title={TITLE_TEXT}>
124
+ <Accordion.Item id={ACCORDION_ITEM_ID} data-testid={ACCORDION_ITEM_ID} heading={TITLE_TEXT}>
125
125
  <p>{CONTENT_TEXT}</p>
126
126
  </Accordion.Item>
127
127
  );
@@ -159,13 +159,13 @@ test('accordion item renders correctly', () => {
159
159
  test('accordion items without ID are given unique IDs', () => {
160
160
  render(
161
161
  <Accordion id={ACCORDION_ID} data-testid={ACCORDION_ID} hideOpenAll>
162
- <Accordion.Item data-testid="item1" title="Healthcare for veterans">
162
+ <Accordion.Item data-testid="item1" heading="Healthcare for veterans">
163
163
  <p>Veterans are entitled to the same healthcare as any citizen. And there
164
164
  are health care options and support available specifically for veterans.</p>
165
165
  <p>If you have a health condition that’s related to your service, you’re
166
166
  entitled to priority treatment based on clinical need.</p>
167
167
  </Accordion.Item>
168
- <Accordion.Item data-testid="item2" title="Employability for veterans">
168
+ <Accordion.Item data-testid="item2" heading="Employability for veterans">
169
169
  <p>If you&apos;re looking for a job, there are several organisations that can help
170
170
  you <a href="#accordion-link">find a job or develop new skills</a>.</p>
171
171
  </Accordion.Item>
@@ -182,7 +182,7 @@ test('accordion items without ID are given unique IDs', () => {
182
182
 
183
183
  test('open accordion item', () => {
184
184
  render(
185
- <Accordion.Item isOpen id={ACCORDION_ITEM_ID} data-testid={ACCORDION_ITEM_ID} title={TITLE_TEXT}>
185
+ <Accordion.Item isOpen id={ACCORDION_ITEM_ID} data-testid={ACCORDION_ITEM_ID} heading={TITLE_TEXT}>
186
186
  <p>{CONTENT_TEXT}</p>
187
187
  </Accordion.Item>
188
188
  );
@@ -193,9 +193,43 @@ test('open accordion item', () => {
193
193
  expect(input).toHaveAttribute('checked');
194
194
  });
195
195
 
196
+ test('small accordion item', () => {
197
+ render(
198
+ <Accordion isSmall data-testid={ACCORDION_ID}>
199
+ <Accordion.Item id={ACCORDION_ITEM_ID} heading={TITLE_TEXT}>
200
+ <p>{CONTENT_TEXT}</p>
201
+ </Accordion.Item>
202
+ </Accordion>
203
+ );
204
+
205
+ const accordionItem = screen.getByTestId(ACCORDION_ID);
206
+
207
+ expect(accordionItem).toHaveClass('ds_accordion--small');
208
+ });
209
+
210
+ test('deprecated title prop still works with warning', () => {
211
+ const consoleWarnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
212
+
213
+ render(
214
+ <Accordion.Item id={ACCORDION_ITEM_ID} data-testid={ACCORDION_ITEM_ID} title={TITLE_TEXT}>
215
+ <p>{CONTENT_TEXT}</p>
216
+ </Accordion.Item>
217
+ );
218
+
219
+ const header = document.querySelector('.ds_accordion-item__header');
220
+ const title = header?.querySelector('.ds_accordion-item__title');
221
+
222
+ expect(title?.textContent).toEqual(TITLE_TEXT);
223
+ expect(consoleWarnSpy).toHaveBeenCalledWith(
224
+ 'Warning: Using the `title` prop for heading text on an Accordion.Item is deprecated and will be removed in a future release. Please use the `heading` prop instead.'
225
+ );
226
+
227
+ consoleWarnSpy.mockRestore();
228
+ });
229
+
196
230
  test('passing additional props to accordion item', () => {
197
231
  render(
198
- <Accordion.Item id={ACCORDION_ITEM_ID} data-testid={ACCORDION_ITEM_ID} title="Healthcare for veterans" data-test="foo">
232
+ <Accordion.Item id={ACCORDION_ITEM_ID} data-testid={ACCORDION_ITEM_ID} heading="Healthcare for veterans" data-test="foo">
199
233
  <p>Veterans are entitled to the same healthcare as any citizen. And there
200
234
  are health care options and support available specifically for veterans.</p>
201
235
  <p>If you have a health condition that’s related to your service, you’re
@@ -209,7 +243,7 @@ test('passing additional props to accordion item', () => {
209
243
 
210
244
  test('passing additional CSS classes', () => {
211
245
  render(
212
- <Accordion.Item id={ACCORDION_ITEM_ID} data-testid={ACCORDION_ITEM_ID} title="Healthcare for veterans" className="foo">
246
+ <Accordion.Item id={ACCORDION_ITEM_ID} data-testid={ACCORDION_ITEM_ID} heading="Healthcare for veterans" className="foo">
213
247
  <p>Veterans are entitled to the same healthcare as any citizen. And there
214
248
  are health care options and support available specifically for veterans.</p>
215
249
  <p>If you have a health condition that’s related to your service, you’re
@@ -11,6 +11,7 @@ const AccordionItem = ({
11
11
  className,
12
12
  id: rawId,
13
13
  isOpen = false,
14
+ heading,
14
15
  title,
15
16
  ...props
16
17
  }: SGDS.Component.Accordion.Item) => {
@@ -19,6 +20,14 @@ const AccordionItem = ({
19
20
 
20
21
  let headingLevel = useContext(AccordionHeadingLevelContext);
21
22
 
23
+ if (title) {
24
+ console.warn(
25
+ 'Warning: Using the `title` prop for heading text on an Accordion.Item is deprecated and will be removed in a future release. Please use the `heading` prop instead.'
26
+ );
27
+
28
+ heading = heading || title;
29
+ }
30
+
22
31
  return (
23
32
  <div
24
33
  className={[
@@ -44,7 +53,7 @@ const AccordionItem = ({
44
53
  className="ds_accordion-item__title"
45
54
  tagName={headingLevel}
46
55
  >
47
- {title}
56
+ {heading}
48
57
  </WrapperTag>
49
58
  <span className="ds_accordion-item__indicator" />
50
59
  <label
@@ -66,6 +75,7 @@ const Accordion = ({
66
75
  className,
67
76
  headingLevel = 'h3',
68
77
  hideOpenAll,
78
+ isSmall,
69
79
  ...props
70
80
  }: SGDS.Component.Accordion) => {
71
81
  const ref = useRef(null);
@@ -84,6 +94,7 @@ const Accordion = ({
84
94
  <div
85
95
  className={[
86
96
  'ds_accordion',
97
+ isSmall ? 'ds_accordion--small' : '',
87
98
  className
88
99
  ].join(' ')}
89
100
  ref={ref}
@@ -0,0 +1 @@
1
+ export { default } from './Accordion';
@@ -0,0 +1 @@
1
+ export { default } from './AspectBox';
@@ -0,0 +1 @@
1
+ export { default } from './BackToTop';
@@ -6,8 +6,15 @@ import Breadcrumbs from './Breadcrumbs';
6
6
  const meta = {
7
7
  title: 'Components/Breadcrumbs/Breadcrumb.Item',
8
8
  component: Breadcrumbs.Item,
9
+ decorators: [
10
+ Story => (
11
+ <Breadcrumbs>
12
+ <Story />
13
+ </Breadcrumbs>
14
+ )
15
+ ],
9
16
  argTypes: {
10
- href: argTypes.href(),
17
+ href: argTypes.href({type: {name: 'string', required: true}}),
11
18
  isHidden: {
12
19
  description: 'Applies a visually-hidden CSS class',
13
20
  control: 'boolean'
@@ -0,0 +1 @@
1
+ export { default } from './Breadcrumbs';
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import Button from './Button';
3
3
 
4
4
  const meta = {
5
- title: 'Components/Button',
5
+ title: 'Components/Buttons/Button',
6
6
  component: Button,
7
7
  parameters: {
8
8
  controls: { sort: 'alpha' }
@@ -0,0 +1,41 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import ButtonGroup from './ButtonGroup';
3
+ import Button from '../Button';
4
+
5
+ const meta = {
6
+ title: 'Components/Buttons/ButtonGroup',
7
+ component: ButtonGroup,
8
+ parameters: {
9
+ controls: { sort: 'alpha' }
10
+ },
11
+ argTypes: {
12
+ isInline: {
13
+ description: 'Force inline buttons on small screens',
14
+ control: 'boolean',
15
+ table: {
16
+ type: {
17
+ summary: 'boolean'
18
+ }
19
+ }
20
+ }
21
+ },
22
+ args: {
23
+ children: <>
24
+ <Button buttonStyle="secondary">Button one</Button>
25
+ <Button buttonStyle="secondary">Button two</Button>
26
+ <Button buttonStyle="secondary">Button three</Button>
27
+ </>
28
+ }
29
+ } satisfies Meta<typeof ButtonGroup>;
30
+
31
+ export default meta;
32
+ type Story = StoryObj<typeof meta>;
33
+
34
+ export const Default: Story = {
35
+ };
36
+
37
+ export const Inline: Story = {
38
+ args: {
39
+ isInline: true
40
+ }
41
+ };
@@ -0,0 +1,45 @@
1
+ import { test, expect } from 'vitest';
2
+ import { render, screen } from '@testing-library/react';
3
+ import ButtonGroup from './ButtonGroup';
4
+
5
+ test('renders correctly', () => {
6
+ render(
7
+ <ButtonGroup data-testid="button-group">
8
+ </ButtonGroup>
9
+ );
10
+
11
+ const buttonGroup = screen.getByTestId('button-group');
12
+ expect(buttonGroup).toBeInTheDocument();
13
+ expect(buttonGroup).toHaveClass('ds_button-group');
14
+ expect(buttonGroup.tagName).toEqual('DIV');
15
+ });
16
+
17
+ test('inline button group', () => {
18
+ render(
19
+ <ButtonGroup isInline data-testid="button-group">
20
+
21
+ </ButtonGroup>
22
+ );
23
+ const buttonGroup = screen.getByTestId('button-group');
24
+ expect(buttonGroup).toHaveClass('ds_button-group--inline');
25
+ });
26
+
27
+ test('passing additional props', () => {
28
+ render(
29
+ <ButtonGroup data-test="foo" data-testid="button-group">
30
+ </ButtonGroup>
31
+ );
32
+
33
+ const buttonGroup = screen.getByTestId('button-group');
34
+ expect(buttonGroup.dataset.test).toEqual('foo');
35
+ });
36
+
37
+ test('passing additional CSS classes', () => {
38
+ render(
39
+ <ButtonGroup className="foo" data-testid="button-group">
40
+ </ButtonGroup>
41
+ );
42
+
43
+ const buttonGroup = screen.getByTestId('button-group');
44
+ expect(buttonGroup).toHaveClass('foo', 'ds_button-group');
45
+ });
@@ -0,0 +1,20 @@
1
+ const ButtonGroup = ({
2
+ children,
3
+ className,
4
+ isInline,
5
+ ...props
6
+ }: SGDS.Component.ButtonGroup) => {
7
+ return (
8
+ <div className={[
9
+ "ds_button-group",
10
+ isInline ? "ds_button-group--inline" : undefined,
11
+ className
12
+ ].join(' ')} { ...props } >
13
+ {children}
14
+ </div>
15
+ );
16
+ };
17
+
18
+ ButtonGroup.displayName = 'ButtonGroup';
19
+
20
+ export default ButtonGroup;
@@ -0,0 +1,2 @@
1
+ export { default } from './Button';
2
+ export { default as ButtonGroup } from './ButtonGroup';
@@ -0,0 +1 @@
1
+ export { default } from './CategoryItem';
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import argTypes from '../../../.storybook/sgdsArgTypes';
3
3
 
4
4
  import CategoryList from './CategoryList';
5
- import CategoryItem from '../CategoryItem/CategoryItem';
5
+ import CategoryItem from '../CategoryItem';
6
6
 
7
7
  const meta = {
8
8
  title: 'Components/CategoryList',
@@ -1,7 +1,7 @@
1
1
  import { test, expect } from 'vitest';
2
2
  import { render, screen, within } from '@testing-library/react';
3
3
  import CategoryList from './CategoryList';
4
- import CategoryItem from '../CategoryItem/CategoryItem';
4
+ import CategoryItem from '../CategoryItem';
5
5
 
6
6
  test('category list renders correctly', () => {
7
7
  render(
@@ -0,0 +1 @@
1
+ export { default } from './CategoryList';
@@ -0,0 +1,2 @@
1
+ export { default } from './Checkbox';
2
+ export { default as CheckboxGroup } from './CheckboxGroup';
@@ -0,0 +1 @@
1
+ export { default } from './ConfirmationMessage';
@@ -6,7 +6,15 @@ import ContentsNav from './ContentsNav';
6
6
  const meta = {
7
7
  title: 'Components/ContentsNav/ContentsNav.Item',
8
8
  component: ContentsNav.Item,
9
+ decorators: [
10
+ Story => (
11
+ <ul className="ds_contents-nav__list">
12
+ <Story />
13
+ </ul>
14
+ )
15
+ ],
9
16
  argTypes: {
17
+ href: argTypes.href({type: {name: 'string', required: true}}),
10
18
  isCurrent: argTypes.isCurrent(),
11
19
  linkComponent: argTypes.linkComponent(),
12
20
  children: argTypes.children()
@@ -0,0 +1 @@
1
+ export { default } from './ContentsNav';
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import argTypes from '../../../.storybook/sgdsArgTypes';
3
3
 
4
4
  import CookieBanner from './CookieBanner';
5
- import Button from '../Button/Button';
5
+ import Button from '../Button';
6
6
 
7
7
  const meta = {
8
8
  title: 'Components/CookieBanner/CookieBanner.Buttons',
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import argTypes from '../../../.storybook/sgdsArgTypes';
3
3
 
4
4
  import CookieBanner from './CookieBanner';
5
- import Button from '../Button/Button';
5
+ import Button from '../Button';
6
6
 
7
7
  const meta = {
8
8
  title: 'Components/CookieBanner',
@@ -0,0 +1 @@
1
+ export { default } from './CookieBanner';
@@ -1,8 +1,8 @@
1
1
  import { useEffect, useRef } from 'react';
2
2
  // @ts-ignore
3
3
  import DSDatePicker from '@scottish-government/design-system/src/components/date-picker/date-picker';
4
- import ErrorMessage from '../ErrorMessage/ErrorMessage';
5
- import TextInput from '../TextInput/TextInput';
4
+ import ErrorMessage from '../ErrorMessage';
5
+ import TextInput from '../TextInput';
6
6
 
7
7
  const DatePicker = ({
8
8
  className,
@@ -0,0 +1 @@
1
+ export { default } from './DatePicker';
@@ -0,0 +1 @@
1
+ export { default } from './Details';
@@ -0,0 +1 @@
1
+ export { default } from './ErrorMessage';
@@ -6,6 +6,13 @@ import ErrorSummary from './ErrorSummary';
6
6
  const meta = {
7
7
  title: 'Components/ErrorSummary/ErrorSummary.Item',
8
8
  component: ErrorSummary.Item,
9
+ decorators: [
10
+ Story => (
11
+ <ul className="ds_error-summary__list">
12
+ <Story />
13
+ </ul>
14
+ )
15
+ ],
9
16
  argTypes: {
10
17
  fragmentId: {
11
18
  description: 'ID of the question or field to link to',
@@ -0,0 +1 @@
1
+ export { default } from './ErrorSummary';
@@ -0,0 +1,60 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import argTypes from '../../../.storybook/sgdsArgTypes';
3
+
4
+ import FeatureHeader from './FeatureHeader';
5
+
6
+ //@ts-ignore
7
+ import coo from '../../../static/images/highland-cow.jpg';
8
+
9
+ const meta = {
10
+ title: 'Components/Feature header',
11
+ component: FeatureHeader,
12
+ argTypes: {
13
+ children: argTypes.children()
14
+ },
15
+ args: {
16
+ children: <>
17
+ <FeatureHeader.Content>
18
+ <h1>Design standards</h1>
19
+ <p>The patterns included here have been developed for use by government, public sector and third sector non-commercial organisations in Scotland.</p>
20
+ </FeatureHeader.Content>
21
+ <FeatureHeader.Media>
22
+ <img
23
+ className="ds_feature-header__image"
24
+ alt="A highland cow nuzzling its calf"
25
+ src={coo}
26
+ />
27
+ </FeatureHeader.Media>
28
+ </>
29
+ }
30
+ } satisfies Meta<typeof FeatureHeader>;
31
+
32
+ export default meta;
33
+ type Story = StoryObj<typeof meta>;
34
+
35
+ export const Default: Story = {
36
+ args: {
37
+ backgroundColour: 'TERTIARY'
38
+ }
39
+ };
40
+
41
+ export const FullWidth: Story = {
42
+ args: {
43
+ backgroundColour: 'TERTIARY',
44
+ isFullWidth: true
45
+ }
46
+ };
47
+
48
+ export const TopAlign: Story = {
49
+ args: {
50
+ backgroundColour: 'TERTIARY',
51
+ isTopAligned: true
52
+ }
53
+ };
54
+
55
+ export const WideText: Story = {
56
+ args: {
57
+ backgroundColour: 'TERTIARY',
58
+ isWideText: true
59
+ }
60
+ };
@@ -0,0 +1,94 @@
1
+ import ConditionalWrapper from "../../common/ConditionalWrapper";
2
+
3
+ const Content = ({ children, className, ...props }: any /* SGDS.Component.FeatureHeader.Primary*/) => {
4
+ return (
5
+ <div className={['ds_feature-header__primary', className].join(' ')} {...props}>
6
+ {children}
7
+ </div>
8
+ );
9
+ }
10
+
11
+ const Media = ({ children, className, isCover, noPadding, ...props }: any /* SGDS.Component.FeatureHeader.Secondary*/) => {
12
+ return (
13
+ <div className={[
14
+ 'ds_feature-header__secondary',
15
+ isCover && 'ds_feature-header__secondary--cover',
16
+ noPadding && 'ds_feature-header__secondary--no-padding',
17
+ className
18
+ ].join(' ')} {...props}>
19
+ {children}
20
+ </div>
21
+ );
22
+ }
23
+
24
+ const FeatureHeader = ({
25
+ backgroundColour = 'NONE',
26
+ children,
27
+ className,
28
+ isFullWidth,
29
+ isTopAligned,
30
+ isWideText,
31
+ ...props
32
+ }: any /* SGDS.Component.FeatureHeader*/) => {
33
+ let backgroundColorClass = '';
34
+
35
+ switch (backgroundColour) {
36
+ case 'BRAND':
37
+ backgroundColorClass = 'ds_feature-header--background';
38
+ break;
39
+ case 'SECONDARY':
40
+ backgroundColorClass = 'ds_feature-header--background-secondary';
41
+ break;
42
+ case 'TERTIARY':
43
+ backgroundColorClass = 'ds_feature-header--background-tertiary';
44
+ break;
45
+ case 'NONE':
46
+ break;
47
+ default:
48
+ backgroundColorClass = '';
49
+ break;
50
+ }
51
+
52
+ return (
53
+ <header
54
+ className={[
55
+ 'ds_feature-header',
56
+ isFullWidth && 'ds_feature-header--fullwidth',
57
+ isTopAligned && 'ds_feature-header--top',
58
+ isWideText && 'ds_feature-header--wide',
59
+ backgroundColorClass,
60
+ className
61
+ ].join(' ')}
62
+ {...props}
63
+ >
64
+ <ConditionalWrapper
65
+ condition={isFullWidth}
66
+ wrapper={(children: React.JSX.Element) => <div className="ds_wrapper">{children}</div>}
67
+ >
68
+ {children}
69
+ </ConditionalWrapper>
70
+ </header>
71
+ );
72
+ };
73
+
74
+ FeatureHeader.displayName = 'FeatureHeader';
75
+ Content.displayName = 'FeatureHeader.Content';
76
+ Media.displayName = 'FeatureHeader.Media';
77
+ FeatureHeader.Content = Content;
78
+ FeatureHeader.Media = Media;
79
+
80
+ export default FeatureHeader;
81
+
82
+
83
+ /*
84
+
85
+ <FeatureHeader backgroundColour="NONE/BRAND/SECONDARY/TERTIARY" isFullWidth isWideText isTopAligned>
86
+ <FeatureHeader.Content>
87
+ {children}
88
+ </FeatureHeader.Content>
89
+ <FeatureHeader.Media noPadding isCover>
90
+ {children}
91
+ </FeatureHeader.Media>
92
+ </FeatureHeader>
93
+
94
+ */
@@ -0,0 +1 @@
1
+ export { default } from './FeatureHeader';
@@ -0,0 +1 @@
1
+ export { default } from './FileDownload';
@@ -0,0 +1 @@
1
+ export { default } from './HideThisPage';
@@ -0,0 +1 @@
1
+ export { default } from './InsetText';
@@ -0,0 +1 @@
1
+ export { default } from './NotificationBanner';
@@ -0,0 +1 @@
1
+ export { default } from './NotificationPanel';
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import argTypes from '../../../.storybook/sgdsArgTypes';
3
3
 
4
4
  import PageHeader from './PageHeader';
5
- import Metadata from '../PageMetadata/PageMetadata';
5
+ import Metadata from '../PageMetadata';
6
6
 
7
7
  const meta = {
8
8
  title: 'Components/PageHeader',