@scottish-government/designsystem-react 0.13.0 → 1.0.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 (332) hide show
  1. package/.storybook/sgdsArgTypes.ts +23 -0
  2. package/CHANGELOG.md +23 -0
  3. package/LICENSE.txt +21 -0
  4. package/README.md +3 -0
  5. package/dist/common/AbstractNotificationBanner/AbstractNotificationBanner.d.ts +3 -2
  6. package/dist/common/AbstractNotificationBanner/AbstractNotificationBanner.jsx +8 -7
  7. package/dist/common/AbstractNotificationBanner/types.d.ts +13 -0
  8. package/dist/common/AbstractNotificationBanner/types.js +2 -0
  9. package/dist/common/ActionLink/ActionLink.d.ts +2 -1
  10. package/dist/common/ActionLink/types.d.ts +7 -0
  11. package/dist/common/ActionLink/types.js +2 -0
  12. package/dist/common/ConditionalWrapper/ConditionalWrapper.d.ts +2 -1
  13. package/dist/common/ConditionalWrapper/ConditionalWrapper.jsx +4 -2
  14. package/dist/common/ConditionalWrapper/types.d.ts +4 -0
  15. package/dist/common/ConditionalWrapper/types.js +2 -0
  16. package/dist/common/FileIcon/FileIcon.d.ts +2 -1
  17. package/dist/common/FileIcon/types.d.ts +6 -0
  18. package/dist/common/FileIcon/types.js +2 -0
  19. package/dist/common/HintText/HintText.d.ts +2 -1
  20. package/dist/common/HintText/HintText.jsx +3 -3
  21. package/dist/common/HintText/types.d.ts +4 -0
  22. package/dist/common/HintText/types.js +2 -0
  23. package/dist/common/Icon/Icon.d.ts +2 -1
  24. package/dist/common/Icon/Icon.jsx +3 -2
  25. package/dist/common/Icon/types.d.ts +8 -0
  26. package/dist/common/Icon/types.js +2 -0
  27. package/dist/common/ScreenReaderText/ScreenReaderText.d.ts +1 -1
  28. package/dist/common/WrapperTag/WrapperTag.d.ts +385 -1
  29. package/dist/common/WrapperTag/WrapperTag.jsx +5 -2
  30. package/dist/common/WrapperTag/types.d.ts +3 -0
  31. package/dist/common/WrapperTag/types.js +2 -0
  32. package/dist/components/Accordion/Accordion.d.ts +3 -2
  33. package/dist/components/Accordion/Accordion.jsx +12 -11
  34. package/dist/components/Accordion/types.d.ts +11 -0
  35. package/dist/components/Accordion/types.js +2 -0
  36. package/dist/components/AspectBox/AspectBox.d.ts +2 -1
  37. package/dist/components/AspectBox/AspectBox.jsx +3 -9
  38. package/dist/components/AspectBox/types.d.ts +3 -0
  39. package/dist/components/AspectBox/types.js +2 -0
  40. package/dist/components/BackToTop/BackToTop.d.ts +2 -1
  41. package/dist/components/BackToTop/BackToTop.jsx +4 -3
  42. package/dist/components/BackToTop/types.d.ts +3 -0
  43. package/dist/components/BackToTop/types.js +2 -0
  44. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +3 -2
  45. package/dist/components/Breadcrumbs/Breadcrumbs.jsx +6 -2
  46. package/dist/components/Breadcrumbs/types.d.ts +5 -0
  47. package/dist/components/Breadcrumbs/types.js +2 -0
  48. package/dist/components/Button/Button.d.ts +2 -1
  49. package/dist/components/Button/Button.jsx +4 -3
  50. package/dist/components/Button/ButtonGroup.d.ts +2 -1
  51. package/dist/components/Button/ButtonGroup.jsx +9 -4
  52. package/dist/components/Button/types.d.ts +20 -0
  53. package/dist/components/Button/types.js +2 -0
  54. package/dist/components/Card/Card.d.ts +34 -0
  55. package/dist/components/Card/Card.jsx +118 -0
  56. package/dist/components/Card/index.d.ts +1 -0
  57. package/dist/components/Card/index.js +8 -0
  58. package/dist/components/Card/types.d.ts +26 -0
  59. package/dist/components/Card/types.js +2 -0
  60. package/dist/components/CategoryItem/CategoryItem.d.ts +2 -1
  61. package/dist/components/CategoryItem/CategoryItem.jsx +8 -5
  62. package/dist/components/CategoryItem/types.d.ts +9 -0
  63. package/dist/components/CategoryItem/types.js +2 -0
  64. package/dist/components/CategoryList/CategoryList.d.ts +2 -1
  65. package/dist/components/CategoryList/CategoryList.jsx +3 -2
  66. package/dist/components/CategoryList/types.d.ts +5 -0
  67. package/dist/components/CategoryList/types.js +2 -0
  68. package/dist/components/Checkbox/Checkbox.d.ts +2 -1
  69. package/dist/components/Checkbox/Checkbox.jsx +4 -3
  70. package/dist/components/Checkbox/CheckboxGroup.d.ts +2 -1
  71. package/dist/components/Checkbox/CheckboxGroup.jsx +5 -4
  72. package/dist/components/Checkbox/types.d.ts +7 -0
  73. package/dist/components/Checkbox/types.js +2 -0
  74. package/dist/components/ConfirmationMessage/ConfirmationMessage.d.ts +2 -1
  75. package/dist/components/ConfirmationMessage/ConfirmationMessage.jsx +3 -2
  76. package/dist/components/ConfirmationMessage/types.d.ts +6 -0
  77. package/dist/components/ConfirmationMessage/types.js +2 -0
  78. package/dist/components/ContentsNav/ContentsNav.d.ts +3 -2
  79. package/dist/components/ContentsNav/ContentsNav.jsx +7 -5
  80. package/dist/components/ContentsNav/types.d.ts +9 -0
  81. package/dist/components/ContentsNav/types.js +2 -0
  82. package/dist/components/CookieBanner/CookieBanner.d.ts +3 -2
  83. package/dist/components/CookieBanner/CookieBanner.jsx +13 -3
  84. package/dist/components/DatePicker/DatePicker.d.ts +2 -1
  85. package/dist/components/DatePicker/DatePicker.jsx +7 -7
  86. package/dist/components/DatePicker/types.d.ts +18 -0
  87. package/dist/components/DatePicker/types.js +2 -0
  88. package/dist/components/Details/Details.d.ts +2 -1
  89. package/dist/components/Details/Details.jsx +6 -2
  90. package/dist/components/Details/types.d.ts +4 -0
  91. package/dist/components/Details/types.js +2 -0
  92. package/dist/components/ErrorMessage/ErrorMessage.d.ts +2 -1
  93. package/dist/components/ErrorMessage/ErrorMessage.jsx +6 -2
  94. package/dist/components/ErrorMessage/types.d.ts +3 -0
  95. package/dist/components/ErrorMessage/types.js +2 -0
  96. package/dist/components/ErrorSummary/ErrorSummary.d.ts +3 -2
  97. package/dist/components/ErrorSummary/ErrorSummary.jsx +6 -2
  98. package/dist/components/ErrorSummary/types.d.ts +8 -0
  99. package/dist/components/ErrorSummary/types.js +2 -0
  100. package/dist/components/FeatureHeader/FeatureHeader.d.ts +7 -5
  101. package/dist/components/FeatureHeader/FeatureHeader.jsx +87 -50
  102. package/dist/components/FeatureHeader/types.d.ts +12 -0
  103. package/dist/components/FeatureHeader/types.js +2 -0
  104. package/dist/components/FileDownload/FileDownload.d.ts +2 -1
  105. package/dist/components/FileDownload/FileDownload.jsx +4 -3
  106. package/dist/components/FileDownload/types.d.ts +10 -0
  107. package/dist/components/FileDownload/types.js +2 -0
  108. package/dist/components/HideThisPage/HideThisPage.d.ts +2 -1
  109. package/dist/components/HideThisPage/HideThisPage.jsx +5 -4
  110. package/dist/components/HideThisPage/types.d.ts +3 -0
  111. package/dist/components/HideThisPage/types.js +2 -0
  112. package/dist/components/InsetText/InsetText.d.ts +1 -1
  113. package/dist/components/InsetText/InsetText.jsx +6 -2
  114. package/dist/components/NotificationBanner/NotificationBanner.d.ts +3 -2
  115. package/dist/components/NotificationBanner/NotificationBanner.jsx +5 -4
  116. package/dist/components/NotificationPanel/NotificationPanel.d.ts +2 -1
  117. package/dist/components/NotificationPanel/NotificationPanel.jsx +3 -2
  118. package/dist/components/NotificationPanel/types.d.ts +6 -0
  119. package/dist/components/NotificationPanel/types.js +2 -0
  120. package/dist/components/NotificationTag/NotificationTag.d.ts +6 -0
  121. package/dist/components/NotificationTag/NotificationTag.jsx +20 -0
  122. package/dist/components/NotificationTag/index.d.ts +1 -0
  123. package/dist/components/NotificationTag/index.js +8 -0
  124. package/dist/components/NotificationTag/types.d.ts +5 -0
  125. package/dist/components/NotificationTag/types.js +2 -0
  126. package/dist/components/PageHeader/PageHeader.d.ts +2 -1
  127. package/dist/components/PageHeader/PageHeader.jsx +6 -2
  128. package/dist/components/PageHeader/types.d.ts +5 -0
  129. package/dist/components/PageHeader/types.js +2 -0
  130. package/dist/components/PageMetadata/PageMetadata.d.ts +3 -2
  131. package/dist/components/PageMetadata/PageMetadata.jsx +8 -4
  132. package/dist/components/PageMetadata/types.d.ts +6 -0
  133. package/dist/components/PageMetadata/types.js +2 -0
  134. package/dist/components/Pagination/Pagination.d.ts +3 -2
  135. package/dist/components/Pagination/Pagination.jsx +7 -5
  136. package/dist/components/Pagination/types.d.ts +18 -0
  137. package/dist/components/Pagination/types.js +2 -0
  138. package/dist/components/PhaseBanner/PhaseBanner.d.ts +2 -1
  139. package/dist/components/PhaseBanner/PhaseBanner.jsx +3 -2
  140. package/dist/components/PhaseBanner/types.d.ts +3 -0
  141. package/dist/components/PhaseBanner/types.js +2 -0
  142. package/dist/components/Question/Question.d.ts +2 -1
  143. package/dist/components/Question/Question.jsx +4 -3
  144. package/dist/components/Question/types.d.ts +9 -0
  145. package/dist/components/Question/types.js +2 -0
  146. package/dist/components/RadioButton/RadioButton.d.ts +2 -1
  147. package/dist/components/RadioButton/RadioButton.jsx +4 -3
  148. package/dist/components/RadioButton/RadioGroup.d.ts +2 -1
  149. package/dist/components/RadioButton/RadioGroup.jsx +3 -2
  150. package/dist/components/RadioButton/types.d.ts +10 -0
  151. package/dist/components/RadioButton/types.js +2 -0
  152. package/dist/components/SearchFacets/SearchFacets.d.ts +4 -3
  153. package/dist/components/SearchFacets/SearchFacets.jsx +3 -2
  154. package/dist/components/SearchFacets/types.d.ts +12 -0
  155. package/dist/components/SearchFacets/types.js +2 -0
  156. package/dist/components/SearchFilters/SearchFilters.d.ts +5 -4
  157. package/dist/components/SearchFilters/types.d.ts +12 -0
  158. package/dist/components/SearchFilters/types.js +2 -0
  159. package/dist/components/SearchResult/SearchResult.d.ts +8 -11
  160. package/dist/components/SearchResult/SearchResult.jsx +6 -7
  161. package/dist/components/SearchResult/types.d.ts +11 -0
  162. package/dist/components/SearchResult/types.js +2 -0
  163. package/dist/components/SearchSort/SearchSort.d.ts +2 -1
  164. package/dist/components/SearchSort/SearchSort.jsx +3 -2
  165. package/dist/components/SearchSort/types.d.ts +7 -0
  166. package/dist/components/SearchSort/types.js +2 -0
  167. package/dist/components/Select/Select.d.ts +2 -1
  168. package/dist/components/Select/Select.jsx +4 -3
  169. package/dist/components/Select/types.d.ts +6 -0
  170. package/dist/components/Select/types.js +2 -0
  171. package/dist/components/SequentialNavigation/SequentialNavigation.d.ts +4 -3
  172. package/dist/components/SequentialNavigation/SequentialNavigation.jsx +10 -6
  173. package/dist/components/SequentialNavigation/types.d.ts +10 -0
  174. package/dist/components/SequentialNavigation/types.js +2 -0
  175. package/dist/components/SideNavigation/SideNavigation.d.ts +4 -3
  176. package/dist/components/SideNavigation/SideNavigation.jsx +10 -7
  177. package/dist/components/SideNavigation/types.d.ts +13 -0
  178. package/dist/components/SideNavigation/types.js +2 -0
  179. package/dist/components/SiteFooter/SiteFooter.d.ts +6 -5
  180. package/dist/components/SiteFooter/SiteFooter.jsx +4 -3
  181. package/dist/components/SiteFooter/types.d.ts +16 -0
  182. package/dist/components/SiteFooter/types.js +2 -0
  183. package/dist/components/SiteHeader/SiteHeader.d.ts +6 -5
  184. package/dist/components/SiteHeader/SiteHeader.jsx +1 -1
  185. package/dist/components/SiteHeader/types.d.ts +20 -0
  186. package/dist/components/SiteHeader/types.js +2 -0
  187. package/dist/components/SiteNavigation/SiteNavigation.d.ts +3 -2
  188. package/dist/components/SiteNavigation/SiteNavigation.jsx +12 -4
  189. package/dist/components/SiteNavigation/types.d.ts +9 -0
  190. package/dist/components/SiteNavigation/types.js +2 -0
  191. package/dist/components/SiteSearch/SiteSearch.d.ts +2 -1
  192. package/dist/components/SiteSearch/SiteSearch.jsx +12 -11
  193. package/dist/components/SiteSearch/types.d.ts +17 -0
  194. package/dist/components/SiteSearch/types.js +2 -0
  195. package/dist/components/SkipLinks/SkipLinks.d.ts +3 -2
  196. package/dist/components/SkipLinks/SkipLinks.jsx +4 -4
  197. package/dist/components/SkipLinks/types.d.ts +8 -0
  198. package/dist/components/SkipLinks/types.js +2 -0
  199. package/dist/components/SummaryCard/SummaryCard.d.ts +4 -2
  200. package/dist/components/SummaryCard/SummaryCard.jsx +5 -4
  201. package/dist/components/SummaryCard/types.d.ts +5 -0
  202. package/dist/components/SummaryCard/types.js +2 -0
  203. package/dist/components/SummaryList/SummaryList.d.ts +6 -4
  204. package/dist/components/SummaryList/SummaryList.jsx +5 -4
  205. package/dist/components/SummaryList/types.d.ts +6 -0
  206. package/dist/components/SummaryList/types.js +2 -0
  207. package/dist/components/Table/Table.d.ts +2 -1
  208. package/dist/components/Table/Table.jsx +5 -4
  209. package/dist/components/Table/types.d.ts +6 -0
  210. package/dist/components/Table/types.js +2 -0
  211. package/dist/components/Tabs/Tabs.d.ts +3 -2
  212. package/dist/components/Tabs/Tabs.jsx +6 -5
  213. package/dist/components/Tabs/types.d.ts +16 -0
  214. package/dist/components/Tabs/types.js +2 -0
  215. package/dist/components/Tag/Tag.d.ts +2 -1
  216. package/dist/components/Tag/Tag.jsx +7 -3
  217. package/dist/components/Tag/types.d.ts +4 -0
  218. package/dist/components/Tag/types.js +2 -0
  219. package/dist/components/TaskList/TaskList.d.ts +4 -3
  220. package/dist/components/TaskList/TaskList.jsx +11 -8
  221. package/dist/components/TaskList/types.d.ts +17 -0
  222. package/dist/components/TaskList/types.js +2 -0
  223. package/dist/components/TextInput/TextInput.d.ts +2 -1
  224. package/dist/components/TextInput/TextInput.jsx +10 -9
  225. package/dist/components/TextInput/types.d.ts +11 -0
  226. package/dist/components/TextInput/types.js +2 -0
  227. package/dist/components/Textarea/Textarea.d.ts +2 -1
  228. package/dist/components/Textarea/Textarea.jsx +6 -5
  229. package/dist/components/WarningText/WarningText.d.ts +1 -1
  230. package/dist/components/WarningText/WarningText.jsx +6 -2
  231. package/dist/hooks/useTracking/useTracking.js +0 -1
  232. package/package.json +5 -3
  233. package/src/common/AbstractNotificationBanner/AbstractNotificationBanner.tsx +8 -6
  234. package/src/common/Icon/Icon.tsx +3 -2
  235. package/src/components/Accordion/Accordion.test.tsx +11 -0
  236. package/src/components/Accordion/Accordion.tsx +11 -10
  237. package/src/components/AspectBox/AspectBox.tsx +4 -11
  238. package/src/components/BackToTop/BackToTop.test.tsx +21 -1
  239. package/src/components/BackToTop/BackToTop.tsx +4 -3
  240. package/src/components/Breadcrumbs/Breadcrumbs.tsx +3 -2
  241. package/src/components/Button/Button.tsx +4 -3
  242. package/src/components/Button/ButtonGroup.stories.tsx +22 -0
  243. package/src/components/Button/ButtonGroup.test.tsx +21 -0
  244. package/src/components/Button/ButtonGroup.tsx +6 -3
  245. package/src/components/Button/types.ts +1 -0
  246. package/src/components/Card/Card.stories.tsx +446 -0
  247. package/src/components/Card/Card.test.tsx +282 -0
  248. package/src/components/Card/Card.tsx +208 -0
  249. package/src/components/Card/index.ts +1 -0
  250. package/src/components/Card/types.ts +30 -0
  251. package/src/components/CategoryItem/CategoryItem.tsx +3 -2
  252. package/src/components/CategoryList/CategoryList.tsx +3 -2
  253. package/src/components/Checkbox/Checkbox.test.tsx +30 -0
  254. package/src/components/Checkbox/Checkbox.tsx +3 -3
  255. package/src/components/Checkbox/CheckboxGroup.test.tsx +10 -0
  256. package/src/components/Checkbox/CheckboxGroup.tsx +5 -4
  257. package/src/components/ConfirmationMessage/ConfirmationMessage.tsx +3 -2
  258. package/src/components/ContentsNav/ContentsNav.tsx +8 -5
  259. package/src/components/CookieBanner/CookieBanner.test.tsx +18 -1
  260. package/src/components/CookieBanner/CookieBanner.tsx +4 -3
  261. package/src/components/DatePicker/DatePicker.test.tsx +52 -14
  262. package/src/components/DatePicker/DatePicker.tsx +6 -7
  263. package/src/components/DatePicker/types.ts +2 -3
  264. package/src/components/Details/Details.tsx +3 -2
  265. package/src/components/ErrorMessage/ErrorMessage.tsx +3 -2
  266. package/src/components/ErrorSummary/ErrorSummary.tsx +3 -2
  267. package/src/components/FeatureHeader/FeatureHeader.stories.tsx +223 -0
  268. package/src/components/FeatureHeader/FeatureHeader.test.tsx +298 -0
  269. package/src/components/FeatureHeader/FeatureHeader.tsx +119 -0
  270. package/src/components/FeatureHeader/index.ts +1 -0
  271. package/src/components/FeatureHeader/types.ts +13 -0
  272. package/src/components/FileDownload/FileDownload.test.tsx +1 -5
  273. package/src/components/FileDownload/FileDownload.tsx +4 -3
  274. package/src/components/HideThisPage/HideThisPage.test.tsx +12 -1
  275. package/src/components/HideThisPage/HideThisPage.tsx +5 -4
  276. package/src/components/InsetText/InsetText.tsx +4 -2
  277. package/src/components/NotificationBanner/NotificationBanner.test.tsx +10 -0
  278. package/src/components/NotificationBanner/NotificationBanner.tsx +4 -3
  279. package/src/components/NotificationPanel/NotificationPanel.tsx +3 -2
  280. package/src/components/NotificationTag/NotificationTag.stories.tsx +68 -0
  281. package/src/components/NotificationTag/NotificationTag.test.tsx +70 -0
  282. package/src/components/NotificationTag/NotificationTag.tsx +32 -0
  283. package/src/components/NotificationTag/index.ts +1 -0
  284. package/src/components/NotificationTag/types.ts +5 -0
  285. package/src/components/PageHeader/PageHeader.tsx +3 -2
  286. package/src/components/PageMetadata/PageMetadata.tsx +5 -4
  287. package/src/components/Pagination/Pagination.test.tsx +20 -0
  288. package/src/components/Pagination/Pagination.tsx +7 -5
  289. package/src/components/PhaseBanner/PhaseBanner.tsx +3 -2
  290. package/src/components/Question/Question.tsx +3 -2
  291. package/src/components/Question/types.ts +2 -2
  292. package/src/components/RadioButton/RadioButton.test.tsx +30 -0
  293. package/src/components/RadioButton/RadioButton.tsx +3 -3
  294. package/src/components/RadioButton/RadioGroup.tsx +3 -2
  295. package/src/components/SearchFacets/SearchFacets.stories.tsx +1 -1
  296. package/src/components/SearchFacets/SearchFacets.tsx +3 -2
  297. package/src/components/SearchResult/SearchResult.stories.tsx +14 -13
  298. package/src/components/SearchResult/SearchResult.test.tsx +5 -4
  299. package/src/components/SearchResult/SearchResult.tsx +6 -7
  300. package/src/components/SearchSort/SearchSort.tsx +3 -2
  301. package/src/components/Select/Select.test.tsx +42 -0
  302. package/src/components/Select/Select.tsx +3 -2
  303. package/src/components/SequentialNavigation/SequentialNavigation.tsx +7 -6
  304. package/src/components/SideNavigation/SideNavigation.test.tsx +24 -0
  305. package/src/components/SideNavigation/SideNavigation.tsx +10 -7
  306. package/src/components/SiteFooter/SiteFooter.tsx +3 -2
  307. package/src/components/SiteHeader/SiteHeader.test.tsx +29 -16
  308. package/src/components/SiteHeader/SiteHeader.tsx +1 -1
  309. package/src/components/SiteNavigation/SiteNavigation.test.tsx +16 -1
  310. package/src/components/SiteNavigation/SiteNavigation.tsx +9 -4
  311. package/src/components/SiteSearch/SiteSearch.test.tsx +22 -0
  312. package/src/components/SiteSearch/SiteSearch.tsx +10 -9
  313. package/src/components/SiteSearch/types.ts +7 -1
  314. package/src/components/SkipLinks/SkipLinks.tsx +4 -4
  315. package/src/components/SummaryCard/SummaryCard.tsx +3 -2
  316. package/src/components/SummaryList/SummaryList.tsx +3 -3
  317. package/src/components/Table/Table.test.tsx +36 -0
  318. package/src/components/Table/Table.tsx +5 -4
  319. package/src/components/Tabs/Tabs.test.tsx +14 -0
  320. package/src/components/Tabs/Tabs.tsx +6 -5
  321. package/src/components/Tag/Tag.tsx +4 -3
  322. package/src/components/TaskList/TaskList.tsx +5 -4
  323. package/src/components/TextInput/TextInput.test.tsx +53 -1
  324. package/src/components/TextInput/TextInput.tsx +12 -7
  325. package/src/components/Textarea/Textarea.test.tsx +53 -1
  326. package/src/components/Textarea/Textarea.tsx +5 -4
  327. package/src/components/WarningText/WarningText.tsx +4 -2
  328. package/src/hooks/useTracking/useTracking.ts +0 -1
  329. package/src/shared-types.ts +3 -3
  330. package/static/images/illustration.svg +502 -0
  331. package/tsconfig.json +0 -3
  332. package/vite.config.ts +4 -0
@@ -0,0 +1,68 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import argTypes from '../../../.storybook/sgdsArgTypes';
3
+
4
+ import NotificationTag from './NotificationTag';
5
+
6
+ const meta = {
7
+ title: 'Components/Notification Tag',
8
+ component: NotificationTag,
9
+ argTypes: {
10
+ children: argTypes.children(),
11
+ description: {
12
+ description: 'Additional description for screen readers',
13
+ type: 'string'
14
+ },
15
+ label: {
16
+ description: 'Visible label, leave blank for a dot notification tag',
17
+ type: 'string'
18
+ },
19
+ isHidden: {
20
+ description: 'Hides the tag from screen readers',
21
+ control: 'boolean',
22
+ },
23
+ },
24
+ args: {
25
+ label: '99+',
26
+ description: 'Unread notifications'
27
+ }
28
+ } satisfies Meta<typeof NotificationTag>;
29
+
30
+ export default meta;
31
+ type Story = StoryObj<typeof meta>;
32
+
33
+ export const Default: Story = {
34
+ render: (args) => (
35
+ <NotificationTag {...args}
36
+ >
37
+ <svg className="ds_icon ds_icon--40" aria-hidden="true" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 40" width="30" height="40" fill="none">
38
+ <path d="m2.77792 35c-.75 0-1.40056-.2754-1.95167-.8262-.550833-.5512-.82625-1.2017-.82625-1.9517v-24.44418c0-.75.275417-1.40056.82625-1.95167.55111-.55083 1.20167-.82625 1.95167-.82625h24.44418c.75 0 1.4005.27542 1.9517.82625.5508.55111.8262 1.20167.8262 1.95167v24.44418c0 .75-.2754 1.4005-.8262 1.9517-.5512.5508-1.2017.8262-1.9517.8262zm5.19416-6.6387h8.75002c.3936 0 .7235-.1337.9896-.4009.2664-.2672.3995-.5982.3995-.9929 0-.395-.1331-.7244-.3995-.9883-.2661-.2639-.596-.3959-.9896-.3959h-8.75002c-.39333 0-.72319.1336-.98958.4009-.26611.2669-.39917.5979-.39917.9929s.13306.7244.39917.9883c.26639.2639.59625.3959.98958.3959zm0-6.9726h14.05582c.3933 0 .7232-.1334.9896-.4004.2661-.2672.3992-.5983.3992-.9933 0-.3947-.1331-.724-.3992-.9879-.2664-.2639-.5963-.3959-.9896-.3959h-14.05582c-.39333 0-.72319.1335-.98958.4005-.26611.2672-.39917.5983-.39917.9933 0 .3947.13306.724.39917.9879.26639.2639.59625.3958.98958.3958zm0-6.972h14.05582c.3933 0 .7232-.1336.9896-.4009.2661-.2669.3992-.5979.3992-.9929s-.1331-.7244-.3992-.9883c-.2664-.2639-.5963-.3958-.9896-.3958h-14.05582c-.39333 0-.72319.1336-.98958.4008-.26611.2672-.39917.5982-.39917.9929 0 .395.13306.7244.39917.9883.26639.2639.59625.3959.98958.3959z" />
39
+ </svg>
40
+ </NotificationTag>
41
+ )
42
+ };
43
+
44
+ export const Dot: Story = {
45
+ args: {
46
+ label: ''
47
+ },
48
+ render: (args) => (
49
+ <NotificationTag {...args}
50
+ >
51
+ <svg className="ds_icon ds_icon--40" aria-hidden="true" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 40" width="30" height="40" fill="none">
52
+ <path d="m2.77792 35c-.75 0-1.40056-.2754-1.95167-.8262-.550833-.5512-.82625-1.2017-.82625-1.9517v-24.44418c0-.75.275417-1.40056.82625-1.95167.55111-.55083 1.20167-.82625 1.95167-.82625h24.44418c.75 0 1.4005.27542 1.9517.82625.5508.55111.8262 1.20167.8262 1.95167v24.44418c0 .75-.2754 1.4005-.8262 1.9517-.5512.5508-1.2017.8262-1.9517.8262zm5.19416-6.6387h8.75002c.3936 0 .7235-.1337.9896-.4009.2664-.2672.3995-.5982.3995-.9929 0-.395-.1331-.7244-.3995-.9883-.2661-.2639-.596-.3959-.9896-.3959h-8.75002c-.39333 0-.72319.1336-.98958.4009-.26611.2669-.39917.5979-.39917.9929s.13306.7244.39917.9883c.26639.2639.59625.3959.98958.3959zm0-6.9726h14.05582c.3933 0 .7232-.1334.9896-.4004.2661-.2672.3992-.5983.3992-.9933 0-.3947-.1331-.724-.3992-.9879-.2664-.2639-.5963-.3959-.9896-.3959h-14.05582c-.39333 0-.72319.1335-.98958.4005-.26611.2672-.39917.5983-.39917.9933 0 .3947.13306.724.39917.9879.26639.2639.59625.3958.98958.3958zm0-6.972h14.05582c.3933 0 .7232-.1336.9896-.4009.2661-.2669.3992-.5979.3992-.9929s-.1331-.7244-.3992-.9883c-.2664-.2639-.5963-.3958-.9896-.3958h-14.05582c-.39333 0-.72319.1336-.98958.4008-.26611.2672-.39917.5982-.39917.9929 0 .395.13306.7244.39917.9883.26639.2639.59625.3959.98958.3959z" />
53
+ </svg>
54
+ </NotificationTag>
55
+ )
56
+ };
57
+
58
+ export const Hidden: Story = {
59
+ render: (args) => (
60
+ <NotificationTag {...args}
61
+ isHidden
62
+ >
63
+ <svg className="ds_icon ds_icon--40" aria-hidden="true" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 40" width="30" height="40" fill="none">
64
+ <path d="m2.77792 35c-.75 0-1.40056-.2754-1.95167-.8262-.550833-.5512-.82625-1.2017-.82625-1.9517v-24.44418c0-.75.275417-1.40056.82625-1.95167.55111-.55083 1.20167-.82625 1.95167-.82625h24.44418c.75 0 1.4005.27542 1.9517.82625.5508.55111.8262 1.20167.8262 1.95167v24.44418c0 .75-.2754 1.4005-.8262 1.9517-.5512.5508-1.2017.8262-1.9517.8262zm5.19416-6.6387h8.75002c.3936 0 .7235-.1337.9896-.4009.2664-.2672.3995-.5982.3995-.9929 0-.395-.1331-.7244-.3995-.9883-.2661-.2639-.596-.3959-.9896-.3959h-8.75002c-.39333 0-.72319.1336-.98958.4009-.26611.2669-.39917.5979-.39917.9929s.13306.7244.39917.9883c.26639.2639.59625.3959.98958.3959zm0-6.9726h14.05582c.3933 0 .7232-.1334.9896-.4004.2661-.2672.3992-.5983.3992-.9933 0-.3947-.1331-.724-.3992-.9879-.2664-.2639-.5963-.3959-.9896-.3959h-14.05582c-.39333 0-.72319.1335-.98958.4005-.26611.2672-.39917.5983-.39917.9933 0 .3947.13306.724.39917.9879.26639.2639.59625.3958.98958.3958zm0-6.972h14.05582c.3933 0 .7232-.1336.9896-.4009.2661-.2669.3992-.5979.3992-.9929s-.1331-.7244-.3992-.9883c-.2664-.2639-.5963-.3958-.9896-.3958h-14.05582c-.39333 0-.72319.1336-.98958.4008-.26611.2672-.39917.5982-.39917.9929 0 .395.13306.7244.39917.9883.26639.2639.59625.3959.98958.3959z" />
65
+ </svg>
66
+ </NotificationTag>
67
+ )
68
+ };
@@ -0,0 +1,70 @@
1
+ import { test, expect } from 'vitest';
2
+ import { render, screen } from '@testing-library/react';
3
+ import NotificationTag from './NotificationTag';
4
+
5
+ const NOTIFICATION_TAG_LABEL = '11';
6
+ const NOTIFICATION_TAG_DESCRIPTION = 'new messages';
7
+ const NOTIFICATION_TAG_ICON = 'SVG icon';
8
+
9
+ test('notification tag renders correctly', () => {
10
+ render(
11
+ <NotificationTag label={NOTIFICATION_TAG_LABEL} description={NOTIFICATION_TAG_DESCRIPTION} data-testid="notification-tag">{NOTIFICATION_TAG_ICON}</NotificationTag>
12
+ );
13
+
14
+ const notificationTag = screen.getByTestId('notification-tag');
15
+ const notificationTagWrapper = notificationTag.parentElement;
16
+ const notificationTagDescription = notificationTag.lastChild;
17
+
18
+ expect(notificationTag).toHaveClass('ds_notification-tag');
19
+ expect(notificationTag.nodeName).toEqual('SPAN');
20
+ expect(notificationTag).not.toHaveAttribute('aria-hidden');
21
+ expect(notificationTagWrapper).toHaveClass('ds_notification-tag__wrapper');
22
+ expect(notificationTagWrapper?.nodeName).toEqual('SPAN');
23
+ expect(notificationTagDescription).toHaveClass('visually-hidden');
24
+ expect(notificationTagDescription?.nodeName).toEqual('SPAN');
25
+ });
26
+
27
+ test('notification tag with dot', () => {
28
+ render(
29
+ <NotificationTag data-testid="notification-tag">
30
+ {NOTIFICATION_TAG_ICON}
31
+ </NotificationTag>
32
+ );
33
+
34
+ const notificationTag = screen.getByTestId('notification-tag');
35
+
36
+ expect(notificationTag).toHaveClass('ds_notification-tag--dot');
37
+ });
38
+
39
+ test('aria-hidden on notification tag', () => {
40
+ render(
41
+ <NotificationTag isHidden data-testid="notification-tag">
42
+ {NOTIFICATION_TAG_ICON}
43
+ </NotificationTag>
44
+ );
45
+
46
+ const notificationTag = screen.getByTestId('notification-tag');
47
+ expect(notificationTag.getAttribute('aria-hidden')).toEqual('true');
48
+ });
49
+
50
+ test('passing additional props', () => {
51
+ render(
52
+ <NotificationTag data-test="foo" data-testid="notification-tag">
53
+ {NOTIFICATION_TAG_ICON}
54
+ </NotificationTag>
55
+ );
56
+
57
+ const notificationTag = screen.getByTestId('notification-tag');
58
+ expect(notificationTag?.dataset.test).toEqual('foo');
59
+ });
60
+
61
+ test('passing additional CSS class', () => {
62
+ render(
63
+ <NotificationTag className="foo" data-testid="notification-tag">
64
+ {NOTIFICATION_TAG_ICON}
65
+ </NotificationTag>
66
+ );
67
+
68
+ const notificationTag = screen.getByTestId('notification-tag');
69
+ expect(notificationTag).toHaveClass('foo', 'ds_notification-tag');
70
+ });
@@ -0,0 +1,32 @@
1
+ import { NotificationTagProps } from "./types";
2
+ import clsx from 'clsx';
3
+
4
+ const NotificationTag = ({
5
+ children,
6
+ className,
7
+ description,
8
+ isHidden,
9
+ label,
10
+ ...props
11
+ }: NotificationTagProps) => {
12
+ return (
13
+ <span className="ds_notification-tag__wrapper">
14
+ {children}
15
+ <span
16
+ aria-hidden={isHidden ? "true" : undefined}
17
+ className={clsx([
18
+ 'ds_notification-tag',
19
+ !label && 'ds_notification-tag--dot',
20
+ className
21
+ ])}
22
+ {...props}
23
+ >
24
+ {label} {description && <span className="visually-hidden">{description}</span>}
25
+ </span>
26
+ </span>
27
+ )
28
+ };
29
+
30
+ NotificationTag.displayName = 'NotificationTag';
31
+
32
+ export default NotificationTag;
@@ -0,0 +1 @@
1
+ export { default } from './NotificationTag';
@@ -0,0 +1,5 @@
1
+ export interface NotificationTagProps extends React.AllHTMLAttributes<HTMLElement> {
2
+ description?: string
3
+ isHidden?: boolean
4
+ label?: string
5
+ }
@@ -1,4 +1,5 @@
1
1
  import { PageHeaderProps } from "./types";
2
+ import clsx from 'clsx';
2
3
 
3
4
  const PageHeader = ({
4
5
  children,
@@ -10,10 +11,10 @@ const PageHeader = ({
10
11
  }: PageHeaderProps) => {
11
12
  return (
12
13
  <header
13
- className={[
14
+ className={clsx([
14
15
  'ds_page-header',
15
16
  className
16
- ].join(' ')}
17
+ ])}
17
18
  {...props}
18
19
  >
19
20
  {label && <span className="ds_page-header__label ds_content-label">{label}</span>}
@@ -1,4 +1,5 @@
1
1
  import { MetdataItemProps, MetadataProps } from "./types";
2
+ import clsx from 'clsx';
2
3
 
3
4
  const MetadataItem = ({
4
5
  children,
@@ -7,10 +8,10 @@ const MetadataItem = ({
7
8
  ...props
8
9
  }: MetdataItemProps) => {
9
10
  return (
10
- <div className={[
11
+ <div className={clsx([
11
12
  'ds_metadata__item',
12
13
  className
13
- ].join(' ')}
14
+ ])}
14
15
  {...props}
15
16
  >
16
17
  <dt className="ds_metadata__key">{name}</dt>{' '}
@@ -29,11 +30,11 @@ const Metadata = ({
29
30
  }: MetadataProps) => {
30
31
  return (
31
32
  <dl
32
- className={[
33
+ className={clsx([
33
34
  'ds_metadata',
34
35
  isInline && 'ds_metadata--inline',
35
36
  className
36
- ].join(' ')}
37
+ ])}
37
38
  {...props}
38
39
  >
39
40
  {children}
@@ -84,6 +84,26 @@ test('pagination page with click event', () => {
84
84
  expect(ONCLICK_FUNCTION).toHaveBeenCalled();
85
85
  });
86
86
 
87
+ test('pagination page with onClick that is not a function', () => {
88
+ render(
89
+ <Page
90
+ ariaLabel={PAGE_ARIA_LABEL}
91
+ href={PAGE_HREF}
92
+ // @ts-expect-error onClick is not a function
93
+ onClick='foo'
94
+ >{PAGE_LABEL}</Page>
95
+ );
96
+
97
+ const item = screen.getByRole('listitem');
98
+ const link = within(item).getByRole('link');
99
+
100
+ fireEvent.click(link);
101
+
102
+ // todo: assertion
103
+ // success indicated by no errors thrown
104
+ // error would be thrown on an untestable thread
105
+ });
106
+
87
107
  test('Ellipsis item renders correctly', () => {
88
108
  render(
89
109
  <Ellipsis/>
@@ -1,6 +1,7 @@
1
1
  import Icon from "../../common/Icon";
2
2
  import { PaginationPageProps, PaginationProps } from "./types";
3
3
  import { LinkComponentProps } from "../../shared-types";
4
+ import clsx from 'clsx';
4
5
 
5
6
  export const Page = ({
6
7
  ariaLabel,
@@ -12,17 +13,18 @@ export const Page = ({
12
13
  onClick
13
14
  }: PaginationPageProps) => {
14
15
  function handleClick(event: React.MouseEvent) {
16
+ /* istanbul ignore else */
15
17
  if (typeof onClick === 'function') {
16
18
  onClick(event);
17
19
  }
18
20
  }
19
21
 
20
22
  function processChildren(children: React.ReactNode) {
21
- const classNames = [
23
+ const classNames = clsx([
22
24
  'ds_pagination__link',
23
25
  className,
24
- isCurrent ? 'ds_current' : undefined
25
- ].join(' ');
26
+ isCurrent && 'ds_current'
27
+ ]);
26
28
 
27
29
  const linkProps: LinkComponentProps = {
28
30
  'aria-label': ariaLabel,
@@ -107,10 +109,10 @@ const Pagination = ({
107
109
  }
108
110
 
109
111
  return (
110
- <nav className={[
112
+ <nav className={clsx([
111
113
  'ds_pagination',
112
114
  className
113
- ].join(' ')}
115
+ ])}
114
116
  aria-label={ariaLabel}
115
117
  {...props}
116
118
  >
@@ -1,5 +1,6 @@
1
1
  import Tag from "../Tag/Tag";
2
2
  import { PhaseBannerProps } from "./types";
3
+ import clsx from 'clsx';
3
4
 
4
5
  const PhaseBanner = ({
5
6
  children,
@@ -9,10 +10,10 @@ const PhaseBanner = ({
9
10
  }: PhaseBannerProps) => {
10
11
  return (
11
12
  <div
12
- className={[
13
+ className={clsx([
13
14
  'ds_phase-banner',
14
15
  className
15
- ].join(' ')}
16
+ ])}
16
17
  {...props}
17
18
  >
18
19
  <div className="ds_wrapper">
@@ -2,6 +2,7 @@ import ErrorMessage from '../ErrorMessage';
2
2
  import HintText from '../../common/HintText'
3
3
  import WrapperTag from '../../common/WrapperTag';
4
4
  import { QuestionProps } from './types';
5
+ import clsx from 'clsx';
5
6
 
6
7
  const Question = function ({
7
8
  children,
@@ -16,11 +17,11 @@ const Question = function ({
16
17
  return (
17
18
  <WrapperTag
18
19
  tagName={tagName}
19
- className={[
20
+ className={clsx([
20
21
  'ds_question',
21
22
  hasError && 'ds_question--error',
22
23
  className
23
- ].join(' ')}
24
+ ])}
24
25
  {...props}
25
26
  >
26
27
  {legend && <legend>{legend}</legend>}
@@ -1,9 +1,9 @@
1
1
  type QuestionTags = 'div' | 'fieldset';
2
2
 
3
3
  export interface QuestionProps extends React.AllHTMLAttributes<HTMLElement> {
4
- errorMessage?: string;
4
+ errorMessage?: string | React.ReactNode;
5
5
  hasError?: boolean;
6
- hintText?: string;
6
+ hintText?: string | React.ReactNode;
7
7
  legend?: string;
8
8
  tagName: QuestionTags;
9
9
  }
@@ -61,6 +61,36 @@ test('radio with change fn', () => {
61
61
  expect(ONCHANGE_FUNCTION).toHaveBeenCalled();
62
62
  });
63
63
 
64
+ test('radio with onBlur that is not a function', () => {
65
+ render(
66
+ // @ts-expect-error onBlur is not a function
67
+ <RadioButton onBlur='foo' name="benefitType" label="Pension Credit" id="pensioncredit" />
68
+ );
69
+
70
+ const radio = screen.getByRole('radio');
71
+
72
+ fireEvent.blur(radio);
73
+
74
+ // todo: assertion
75
+ // success indicated by no errors thrown
76
+ // error would be thrown on an untestable thread
77
+ });
78
+
79
+ test('radio with onChange that is not a function', () => {
80
+ render(
81
+ // @ts-expect-error onChange is not a function
82
+ <RadioButton onChange='foo' name="benefitType" label="Pension Credit" id="pensioncredit" />
83
+ );
84
+
85
+ const radio = screen.getByRole('radio');
86
+
87
+ fireEvent.click(radio);
88
+
89
+ // todo: assertion
90
+ // success indicated by no errors thrown
91
+ // error would be thrown on an untestable thread
92
+ });
93
+
64
94
  test('radio with hint text', () => {
65
95
  render(
66
96
  <RadioButton hintText="hint text" name="benefitType" label="Pension Credit" id="pensioncredit" />
@@ -1,8 +1,8 @@
1
1
  import { useContext } from 'react';
2
-
3
2
  import HintText from '../../common/HintText';
4
3
  import { CheckboxRadioContext } from '../../utils/context';
5
4
  import { RadioButtonProps } from './types';
5
+ import clsx from 'clsx';
6
6
 
7
7
  const RadioButton = ({
8
8
  checked,
@@ -33,10 +33,10 @@ const RadioButton = ({
33
33
 
34
34
  return (
35
35
  <div
36
- className={[
36
+ className={clsx([
37
37
  'ds_radio',
38
38
  isSmall && 'ds_radio--small'
39
- ].join(' ')}>
39
+ ])}>
40
40
  <input
41
41
  aria-describedby={hintText ? hintTextId : undefined}
42
42
  className="ds_radio__input"
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { CheckboxRadioContext } from '../../utils/context';
3
3
  import { RadioGroupProps } from './types';
4
+ import clsx from 'clsx';
4
5
 
5
6
  const RadioGroup = ({
6
7
  children,
@@ -12,12 +13,12 @@ const RadioGroup = ({
12
13
  }: RadioGroupProps) => {
13
14
  return (
14
15
  <div
15
- className={[
16
+ className={clsx([
16
17
  'ds_radios',
17
18
  'ds_field-group',
18
19
  isInline && 'ds_field-group--inline',
19
20
  className
20
- ].join(' ')}
21
+ ])}
21
22
  {...props}
22
23
  >
23
24
  <CheckboxRadioContext value={{ isSmall: !!isSmall, name}}>
@@ -10,7 +10,7 @@ const meta = {
10
10
  children: argTypes.children()
11
11
  },
12
12
  args: {
13
- title: 'Application incomplete'
13
+
14
14
  }
15
15
  } satisfies Meta<typeof Facets>;
16
16
 
@@ -2,6 +2,7 @@ import React, { Children } from 'react';
2
2
  import Icon from "../../common/Icon";
3
3
  import { Cancel } from '../../../src/images/icons';
4
4
  import { SearchFacetsGroupProps, SearchFacetsItemProps, SearchFacetsProps } from './types';
5
+ import clsx from 'clsx';
5
6
 
6
7
  const FacetsItem = ({
7
8
  accessibleName,
@@ -71,10 +72,10 @@ const Facets = ({
71
72
  });
72
73
 
73
74
  return (
74
- <div className={[
75
+ <div className={clsx([
75
76
  "ds_facets",
76
77
  className
77
- ].join(' ')}
78
+ ])}
78
79
  {...props}
79
80
  >
80
81
  <p className="visually-hidden">There {facetCount === 1 ? 'is' : 'are'} {facetCount} search {facetCount === 1 ? 'filter' : 'filters'} applied</p>
@@ -1,6 +1,7 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import argTypes from '../../../.storybook/sgdsArgTypes';
3
3
  import SearchResult from './SearchResult';
4
+ import Metadata from '../PageMetadata';
4
5
  // @ts-expect-error no types
5
6
  import coo from '../../../static/images/highland-cow.jpg';
6
7
 
@@ -29,20 +30,20 @@ export const Default: Story = {
29
30
  )
30
31
  };
31
32
 
32
- export const Metadata: Story = {
33
+ export const WithMetadata: Story = {
33
34
  render: (args) => (
34
35
  <SearchResult {...args}>
35
36
  <SearchResult.Content>
36
37
  Official statistics showing emissions of greenhouse gases in Scotland over the period 1990 to 2022.
37
38
  </SearchResult.Content>
38
- <SearchResult.Meta>
39
- <SearchResult.MetaItem name="Publication type">
39
+ <SearchResult.Metadata>
40
+ <Metadata.Item name="Publication type">
40
41
  Statistics
41
- </SearchResult.MetaItem>
42
- <SearchResult.MetaItem name="Date">
42
+ </Metadata.Item>
43
+ <Metadata.Item name="Date">
43
44
  18 June 2024
44
- </SearchResult.MetaItem>
45
- </SearchResult.Meta>
45
+ </Metadata.Item>
46
+ </SearchResult.Metadata>
46
47
  </SearchResult>
47
48
  )
48
49
  };
@@ -93,14 +94,14 @@ export const KitchenSink: Story = {
93
94
  </SearchResult.Media>
94
95
  Official statistics showing emissions of greenhouse gases in Scotland over the period 1990 to 2022.
95
96
  </SearchResult.Content>
96
- <SearchResult.Meta>
97
- <SearchResult.MetaItem name="Publication type">
97
+ <SearchResult.Metadata>
98
+ <Metadata.Item name="Publication type">
98
99
  Statistics
99
- </SearchResult.MetaItem>
100
- <SearchResult.MetaItem name="Date">
100
+ </Metadata.Item>
101
+ <Metadata.Item name="Date">
101
102
  18 June 2024
102
- </SearchResult.MetaItem>
103
- </SearchResult.Meta>
103
+ </Metadata.Item>
104
+ </SearchResult.Metadata>
104
105
  <SearchResult.Context title="Part of">
105
106
  <SearchResult.ContextItem><a href="#">Environment statistics</a></SearchResult.ContextItem>
106
107
  <SearchResult.ContextItem><a href="#">Energy statistics</a></SearchResult.ContextItem>
@@ -1,6 +1,7 @@
1
1
  import { test, expect } from 'vitest';
2
2
  import { render, screen, within } from '@testing-library/react';
3
3
  import SearchResult from './SearchResult';
4
+ import Metadata from '../PageMetadata';
4
5
 
5
6
  const RESULT_TITLE = 'My title';
6
7
  const RESULT_HREF = '#foo';
@@ -15,11 +16,11 @@ test('search result renders correctly', () => {
15
16
  <SearchResult.Content>
16
17
  {RESULT_CONTENT}
17
18
  </SearchResult.Content>
18
- <SearchResult.Meta>
19
- <SearchResult.MetaItem name={META_KEY}>
19
+ <SearchResult.Metadata>
20
+ <Metadata.Item name={META_KEY}>
20
21
  {META_VALUE}
21
- </SearchResult.MetaItem>
22
- </SearchResult.Meta>
22
+ </Metadata.Item>
23
+ </SearchResult.Metadata>
23
24
  <SearchResult.Context>
24
25
  <SearchResult.ContextItem>{CONTEXT_VALUE}</SearchResult.ContextItem>
25
26
  </SearchResult.Context>
@@ -3,6 +3,7 @@ import ConditionalWrapper from '../../common/ConditionalWrapper';
3
3
  import AspectBox from '../AspectBox';
4
4
  import Metadata from '../PageMetadata';
5
5
  import { SearchResultContextProps, SearchResultProps } from './types';
6
+ import clsx from 'clsx';
6
7
 
7
8
  const SearchResultLinkHrefContext = createContext('');
8
9
 
@@ -93,10 +94,10 @@ const SearchResult = ({
93
94
  const LINK_CLASS = 'ds_search-result__link';
94
95
 
95
96
  return (
96
- <div className={[
97
+ <div className={clsx([
97
98
  'ds_search-result',
98
- isPromoted ? 'ds_search-result--promoted' : ''
99
- ].join(' ')}
99
+ isPromoted && 'ds_search-result--promoted'
100
+ ])}
100
101
  {...props}
101
102
  >
102
103
  <ConditionalWrapper
@@ -125,14 +126,12 @@ SearchResult.Content = SearchResultContent;
125
126
  SearchResult.Context = SearchResultContext;
126
127
  SearchResult.ContextItem = SearchResultContextItem;
127
128
  SearchResult.Media = SearchResultMedia;
128
- SearchResult.Meta = SearchResultMeta;
129
- SearchResult.MetaItem = Metadata.Item;
129
+ SearchResult.Metadata = SearchResultMeta;
130
130
 
131
131
  SearchResultContent.displayName = 'SearchResult.Content';
132
132
  SearchResultContext.displayName = 'SearchResult.Context';
133
133
  SearchResultContextItem.displayName = 'SearchResult.ContextItem';
134
134
  SearchResultMedia.displayName = 'SearchResult.Media';
135
- SearchResultMeta.displayName = 'SearchResult.Meta';
136
- SearchResult.MetaItem.displayName = 'SearchResult.MetaItem';
135
+ SearchResultMeta.displayName = 'SearchResult.Metadata';
137
136
 
138
137
  export default SearchResult;
@@ -2,6 +2,7 @@ import { AllHTMLAttributes } from "react";
2
2
  import Button from "../Button";
3
3
  import Select from "../Select";
4
4
  import { SearchSortProps } from "./types";
5
+ import clsx from 'clsx';
5
6
 
6
7
  const Option = ({
7
8
  children,
@@ -24,10 +25,10 @@ const SearchSort = ({
24
25
  }: SearchSortProps) => {
25
26
  return (
26
27
  <div
27
- className={[
28
+ className={clsx([
28
29
  'ds_sort-options',
29
30
  className
30
- ].join(' ')}
31
+ ])}
31
32
  {...props}
32
33
  >
33
34
  <Select id={id} label={label}>