uikit-react-public 0.11.24 → 0.17.4

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 (301) hide show
  1. package/README.md +4 -2
  2. package/dist/components/Accordion/Accordion.Heading.d.ts +4 -4
  3. package/dist/components/Accordion/Accordion.Panel.d.ts +2 -2
  4. package/dist/components/Accordion/Accordion.d.ts +1 -1
  5. package/dist/components/Accordion/Accordion.stories.d.ts +57 -0
  6. package/dist/components/Accordion/index.d.ts +2 -0
  7. package/dist/components/Avatar/Avatar.stories.d.ts +107 -1
  8. package/dist/components/Badge/Badge.d.ts +6 -0
  9. package/dist/components/Badge/Badge.stories.d.ts +15 -0
  10. package/dist/components/Badge/index.d.ts +2 -0
  11. package/dist/components/Button/Button.d.ts +3 -1
  12. package/dist/components/Calendar/index.d.ts +1 -1
  13. package/dist/components/CookieNotice/CookieNotice.d.ts +16 -0
  14. package/dist/components/CookieNotice/index.d.ts +2 -0
  15. package/dist/components/Datepicker/Datepicker.d.ts +1 -1
  16. package/dist/components/Datepicker/Datepicker.stories.d.ts +4 -3
  17. package/dist/components/Datepicker/Datepicker.types.d.ts +4 -5
  18. package/dist/components/Datepicker/subcomponents/CustomDatepicker.d.ts +4 -1
  19. package/dist/components/Datepicker/subcomponents/DatepickerInput.d.ts +15 -2
  20. package/dist/components/Datepicker/subcomponents/Panel.d.ts +1 -1
  21. package/dist/components/Datepicker/subcomponents/VisibleField.d.ts +6 -1
  22. package/dist/components/Datepicker/subcomponents/index.d.ts +0 -1
  23. package/dist/components/Datepicker/utils/index.d.ts +0 -1
  24. package/dist/components/Dialog/BaseDialog.d.ts +8 -2
  25. package/dist/components/Dialog/Dialog.d.ts +2 -0
  26. package/dist/components/FileInput/FileInput.d.ts +8 -0
  27. package/dist/components/FileInput/FileInput.stories.d.ts +16 -0
  28. package/dist/components/FileInput/index.d.ts +2 -0
  29. package/dist/components/Header/Header.d.ts +7 -1
  30. package/dist/components/Header/Header.stories.d.ts +40 -0
  31. package/dist/components/Heading/Heading.d.ts +1 -1
  32. package/dist/components/Link/BaseLink.d.ts +10 -0
  33. package/dist/components/Link/Link.d.ts +5 -10
  34. package/dist/components/Link/Link.stories.d.ts +1 -1
  35. package/dist/components/Link/index.d.ts +1 -1
  36. package/dist/components/Main/Main.d.ts +21 -0
  37. package/dist/components/Main/Main.stories.d.ts +15 -0
  38. package/dist/components/Main/__tests__/Main.test.d.ts +1 -0
  39. package/dist/components/Main/index.d.ts +2 -0
  40. package/dist/components/Menu/MenuContent.d.ts +1 -1
  41. package/dist/components/Menu/MenuItem.d.ts +2 -0
  42. package/dist/components/Menu/MenuSection.d.ts +1 -1
  43. package/dist/components/NativeDatepicker/NativeDatepicker.d.ts +3 -0
  44. package/dist/components/NativeDatepicker/NativeDatepicker.stories.d.ts +36 -0
  45. package/dist/components/NativeDatepicker/NativeDatepicker.types.d.ts +10 -0
  46. package/dist/components/NativeDatepicker/index.d.ts +2 -0
  47. package/dist/components/{Datepicker → NativeDatepicker}/utils/dateToLocaleISOString/dateToLocaleISOString.d.ts +1 -1
  48. package/dist/components/NativeDatepicker/utils/dateToLocaleISOString/dateToLocaleISOString.test.d.ts +1 -0
  49. package/dist/components/NativeDatepicker/utils/index.d.ts +1 -0
  50. package/dist/components/Search/Search.d.ts +16 -0
  51. package/dist/components/Search/Search.stories.d.ts +34 -0
  52. package/dist/components/Search/__tests__/Search.test.d.ts +1 -0
  53. package/dist/components/Search/index.d.ts +2 -0
  54. package/dist/components/Select/Select.d.ts +1 -1
  55. package/dist/components/Select/Select.stories.d.ts +157 -9
  56. package/dist/components/Select/Select.types.d.ts +66 -32
  57. package/dist/components/Select/subcomponents/CustomOption.d.ts +1 -1
  58. package/dist/components/Select/subcomponents/CustomSelect.d.ts +3 -3
  59. package/dist/components/Select/subcomponents/FilterInput.d.ts +14 -0
  60. package/dist/components/Select/subcomponents/NativeSelect.d.ts +5 -1
  61. package/dist/components/Select/subcomponents/Panel.d.ts +1 -1
  62. package/dist/components/Select/subcomponents/VisibleField.d.ts +6 -4
  63. package/dist/components/Select/subcomponents/index.d.ts +1 -0
  64. package/dist/components/StandaloneLink/StandaloneLink.d.ts +12 -0
  65. package/dist/components/StandaloneLink/StandaloneLink.stories.d.ts +13 -0
  66. package/dist/components/StandaloneLink/__tests__/StandaloneLink.test.d.ts +1 -0
  67. package/dist/components/StandaloneLink/index.d.ts +2 -0
  68. package/dist/components/Table/Table.d.ts +10 -8
  69. package/dist/components/Table/Table.stories.d.ts +21 -0
  70. package/dist/components/Table/Table.types.d.ts +11 -0
  71. package/dist/components/Table/__tests__/Table.test.d.ts +1 -0
  72. package/dist/components/Table/index.d.ts +2 -1
  73. package/dist/components/Table/subcomponents/Body.d.ts +4 -0
  74. package/dist/components/Table/subcomponents/Cell/Cell.d.ts +12 -0
  75. package/dist/components/Table/subcomponents/Cell/Cell.stories.d.ts +313 -0
  76. package/dist/components/Table/subcomponents/Cell/CellContent.d.ts +10 -0
  77. package/dist/components/Table/subcomponents/Cell/__tests__/Cell.test.d.ts +1 -0
  78. package/dist/components/Table/subcomponents/Head.d.ts +4 -0
  79. package/dist/components/Table/subcomponents/HeadCell/HeadCell.d.ts +13 -0
  80. package/dist/components/Table/subcomponents/HeadCell/HeadCell.stories.d.ts +312 -0
  81. package/dist/components/Table/subcomponents/HeadCell/HeadCellContent.d.ts +10 -0
  82. package/dist/components/Table/subcomponents/HeadCell/__tests__/HeadCell.test.d.ts +1 -0
  83. package/dist/components/Table/subcomponents/Row.d.ts +5 -0
  84. package/dist/components/Table/subcomponents/SortIcon.d.ts +7 -0
  85. package/dist/components/Table/subcomponents/index.d.ts +10 -0
  86. package/dist/components/Tabs/Tab.d.ts +1 -1
  87. package/dist/components/Tabs/TabContext.d.ts +1 -0
  88. package/dist/components/Tabs/Tabs.d.ts +3 -1
  89. package/dist/components/Tabs/Tabs.stories.d.ts +3 -0
  90. package/dist/components/Timepicker/Timepicker.d.ts +10 -0
  91. package/dist/components/Timepicker/Timepicker.stories.d.ts +7 -0
  92. package/dist/components/Timepicker/__tests__/Timepicker.test.d.ts +1 -0
  93. package/dist/components/Timepicker/index.d.ts +2 -0
  94. package/dist/components/Timepicker/utils/convertDateToTimeString.d.ts +2 -0
  95. package/dist/components/Timepicker/utils/convertDateToTimeString.test.d.ts +1 -0
  96. package/dist/components/Timepicker/utils/index.d.ts +1 -0
  97. package/dist/components/WeekPicker/WeekPicker.d.ts +3 -0
  98. package/dist/components/WeekPicker/WeekPicker.stories.d.ts +41 -0
  99. package/dist/components/WeekPicker/WeekPicker.types.d.ts +16 -0
  100. package/dist/components/WeekPicker/index.d.ts +2 -0
  101. package/dist/components/WeekPicker/subcomponents/CustomDatepicker.d.ts +17 -0
  102. package/dist/components/WeekPicker/subcomponents/DatepickerInput.d.ts +13 -0
  103. package/dist/components/WeekPicker/subcomponents/VisibleField.d.ts +15 -0
  104. package/dist/components/WeekPicker/subcomponents/index.d.ts +3 -0
  105. package/dist/components/index.d.ts +19 -0
  106. package/dist/hooks/index.d.ts +2 -0
  107. package/dist/hooks/useFocusTrap.d.ts +10 -0
  108. package/dist/index.d.ts +2 -0
  109. package/dist/index.js +6460 -4607
  110. package/dist/theme/defaultTheme.d.ts +7 -0
  111. package/dist/theme/useTheme.d.ts +14 -0
  112. package/dist/utils/__tests__/announce.test.d.ts +1 -0
  113. package/dist/utils/__tests__/capitalise.test.d.ts +1 -0
  114. package/dist/utils/announce.d.ts +6 -0
  115. package/dist/utils/capitalise.d.ts +2 -0
  116. package/dist/utils/index.d.ts +1 -0
  117. package/lib/components/Accordion/Accordion.Heading.tsx +27 -8
  118. package/lib/components/Accordion/Accordion.Panel.tsx +11 -3
  119. package/lib/components/Accordion/Accordion.stories.tsx +139 -0
  120. package/lib/components/Accordion/Accordion.tsx +10 -8
  121. package/lib/components/Accordion/__tests__/__snapshots__/Accordion.test.tsx.snap +7 -7
  122. package/lib/components/Accordion/index.ts +2 -0
  123. package/lib/components/Alert/Alert.stories.tsx +1 -1
  124. package/lib/components/Alert/Alert.tsx +7 -1
  125. package/lib/components/Alert/__tests__/__snapshots__/Alert.test.tsx.snap +4 -0
  126. package/lib/components/Avatar/Avatar.mdx +117 -0
  127. package/lib/components/Avatar/Avatar.stories.tsx +110 -2
  128. package/lib/components/Badge/Badge.stories.tsx +19 -0
  129. package/lib/components/Badge/Badge.tsx +48 -0
  130. package/lib/components/Badge/index.ts +2 -0
  131. package/lib/components/Blanket/Blanket.stories.tsx +1 -1
  132. package/lib/components/Breadcrumbs/__tests__/__snapshots__/Breadcrumbs.test.tsx.snap +4 -4
  133. package/lib/components/Button/Button.stories.tsx +1 -1
  134. package/lib/components/Button/Button.tsx +6 -2
  135. package/lib/components/Calendar/Calendar.stories.tsx +12 -32
  136. package/lib/components/Calendar/__tests__/Calendar.test.tsx +23 -15
  137. package/lib/components/Calendar/index.ts +1 -5
  138. package/lib/components/Calendar/subcomponents/AcademicWeeks.tsx +2 -1
  139. package/lib/components/Calendar/subcomponents/ColumnHeading.tsx +5 -1
  140. package/lib/components/Calendar/subcomponents/EventDot.tsx +2 -1
  141. package/lib/components/Calendar/subcomponents/Grid.tsx +0 -1
  142. package/lib/components/Calendar/subcomponents/index.ts +1 -1
  143. package/lib/components/Calendar/utils/getDatesForCalendarGrid/getDatesForCalendarGrid.ts +43 -11
  144. package/lib/components/Calendar/utils/normaliseMonth/normaliseMonth.test.ts +5 -5
  145. package/lib/components/CookieNotice/CookieNotice.tsx +114 -0
  146. package/lib/components/CookieNotice/index.ts +2 -0
  147. package/lib/components/Datepicker/Datepicker.lld.md +108 -0
  148. package/lib/components/Datepicker/Datepicker.stories.tsx +44 -5
  149. package/lib/components/Datepicker/Datepicker.tsx +14 -36
  150. package/lib/components/Datepicker/Datepicker.types.ts +5 -14
  151. package/lib/components/Datepicker/__tests__/Datepicker.test.tsx +150 -8
  152. package/lib/components/Datepicker/__tests__/__snapshots__/Datepicker.test.tsx.snap +10 -4
  153. package/lib/components/Datepicker/subcomponents/CustomDatepicker.tsx +39 -5
  154. package/lib/components/Datepicker/subcomponents/DatepickerInput.tsx +30 -17
  155. package/lib/components/Datepicker/subcomponents/Panel.tsx +6 -2
  156. package/lib/components/Datepicker/subcomponents/VisibleField.tsx +40 -3
  157. package/lib/components/Datepicker/subcomponents/index.ts +0 -1
  158. package/lib/components/Datepicker/utils/index.ts +0 -1
  159. package/lib/components/Dialog/BaseDialog.tsx +55 -4
  160. package/lib/components/Dialog/Dialog.tsx +8 -1
  161. package/lib/components/Dialog/DialogBody.tsx +5 -1
  162. package/lib/components/Dialog/DialogHeader.tsx +2 -1
  163. package/lib/components/Divider/Divider.stories.tsx +1 -1
  164. package/lib/components/Field/ErrorText.tsx +1 -0
  165. package/lib/components/Field/Field.stories.tsx +1 -1
  166. package/lib/components/Field/__tests__/Field.test.tsx +161 -148
  167. package/lib/components/FileInput/FileInput.stories.tsx +70 -0
  168. package/lib/components/FileInput/FileInput.tsx +68 -0
  169. package/lib/components/FileInput/__tests__/FileInput.test.tsx +99 -0
  170. package/lib/components/FileInput/__tests__/__snapshots__/FileInput.test.tsx.snap +91 -0
  171. package/lib/components/FileInput/index.ts +2 -0
  172. package/lib/components/Footer/Footer.stories.tsx +1 -1
  173. package/lib/components/Footer/__tests__/__snapshots__/Footer.test.tsx.snap +28 -28
  174. package/lib/components/Header/Header.mdx +52 -0
  175. package/lib/components/Header/Header.stories.tsx +98 -0
  176. package/lib/components/Header/Header.tsx +65 -3
  177. package/lib/components/Header/__tests__/Header.test.tsx +17 -1
  178. package/lib/components/Header/__tests__/__snapshots__/Header.test.tsx.snap +4 -4
  179. package/lib/components/Heading/Documentation.mdx +1 -1
  180. package/lib/components/Heading/Heading.stories.tsx +1 -1
  181. package/lib/components/Heading/Heading.tsx +1 -1
  182. package/lib/components/Heading/__tests__/Heading.test.tsx +7 -19
  183. package/lib/components/Heading/__tests__/__snapshots__/Heading.test.tsx.snap +7 -7
  184. package/lib/components/Icon/Icon.stories.tsx +1 -1
  185. package/lib/components/IconButton/IconButton.stories.tsx +1 -1
  186. package/lib/components/Input/Input.stories.tsx +1 -1
  187. package/lib/components/Label/Label.stories.tsx +1 -1
  188. package/lib/components/Label/Label.tsx +0 -2
  189. package/lib/components/Label/__tests__/__snapshots__/Label.test.tsx.snap +7 -7
  190. package/lib/components/Link/BaseLink.tsx +84 -0
  191. package/lib/components/Link/Link.tsx +72 -32
  192. package/lib/components/Link/__tests__/__snapshots__/link.test.tsx.snap +3 -3
  193. package/lib/components/Link/__tests__/link.test.tsx +6 -13
  194. package/lib/components/Link/index.ts +1 -1
  195. package/lib/components/Main/Main.stories.tsx +36 -0
  196. package/lib/components/Main/Main.tsx +46 -0
  197. package/lib/components/Main/__tests__/Main.test.tsx +80 -0
  198. package/lib/components/Main/__tests__/__snapshots__/Main.test.tsx.snap +33 -0
  199. package/lib/components/Main/index.ts +2 -0
  200. package/lib/components/Menu/Menu.context.tsx +3 -1
  201. package/lib/components/Menu/Menu.tsx +2 -2
  202. package/lib/components/Menu/MenuContent.tsx +5 -5
  203. package/lib/components/Menu/MenuItem.tsx +20 -3
  204. package/lib/components/Menu/MenuSection.tsx +4 -3
  205. package/lib/components/NativeDatepicker/NativeDatepicker.stories.tsx +100 -0
  206. package/lib/components/{Datepicker/subcomponents → NativeDatepicker}/NativeDatepicker.tsx +14 -15
  207. package/lib/components/NativeDatepicker/NativeDatepicker.types.ts +19 -0
  208. package/lib/components/NativeDatepicker/index.ts +2 -0
  209. package/lib/components/{Datepicker → NativeDatepicker}/utils/dateToLocaleISOString/dateToLocaleISOString.ts +1 -1
  210. package/lib/components/NativeDatepicker/utils/index.ts +1 -0
  211. package/lib/components/Pagination/PaginationControls.tsx +56 -15
  212. package/lib/components/Pagination/PaginationInfo.tsx +5 -1
  213. package/lib/components/Paragraph/Paragraph.stories.tsx +1 -1
  214. package/lib/components/Search/Search.stories.tsx +41 -0
  215. package/lib/components/Search/Search.tsx +170 -0
  216. package/lib/components/Search/__tests__/Search.test.tsx +112 -0
  217. package/lib/components/Search/__tests__/__snapshots__/Search.test.tsx.snap +179 -0
  218. package/lib/components/Search/index.ts +2 -0
  219. package/lib/components/Select/Select.mdx +169 -0
  220. package/lib/components/Select/Select.stories.tsx +198 -77
  221. package/lib/components/Select/Select.tsx +37 -13
  222. package/lib/components/Select/Select.types.ts +77 -54
  223. package/lib/components/Select/__tests__/Select.test.tsx +448 -7
  224. package/lib/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +3 -3
  225. package/lib/components/Select/subcomponents/CustomOption.tsx +24 -10
  226. package/lib/components/Select/subcomponents/CustomSelect.tsx +333 -52
  227. package/lib/components/Select/subcomponents/FilterInput.tsx +80 -0
  228. package/lib/components/Select/subcomponents/NativeSelect.tsx +13 -1
  229. package/lib/components/Select/subcomponents/Panel.tsx +4 -5
  230. package/lib/components/Select/subcomponents/VisibleField.tsx +36 -24
  231. package/lib/components/Select/subcomponents/index.tsx +1 -0
  232. package/lib/components/Snackbar/Snackbar.stories.tsx +1 -1
  233. package/lib/components/Spinner/Spinner.stories.tsx +1 -1
  234. package/lib/components/StandaloneLink/StandaloneLink.stories.tsx +32 -0
  235. package/lib/components/StandaloneLink/StandaloneLink.tsx +183 -0
  236. package/lib/components/StandaloneLink/__tests__/StandaloneLink.test.tsx +57 -0
  237. package/lib/components/StandaloneLink/__tests__/__snapshots__/StandaloneLink.test.tsx.snap +19 -0
  238. package/lib/components/StandaloneLink/index.ts +2 -0
  239. package/lib/components/Table/Table.stories.tsx +337 -0
  240. package/lib/components/Table/Table.tsx +42 -67
  241. package/lib/components/Table/Table.types.ts +14 -0
  242. package/lib/components/Table/__tests__/Table.test.tsx +121 -0
  243. package/lib/components/Table/__tests__/__snapshots__/Table.test.tsx.snap +210 -0
  244. package/lib/components/Table/index.ts +8 -1
  245. package/lib/components/Table/subcomponents/Body.tsx +18 -0
  246. package/lib/components/Table/subcomponents/Cell/Cell.stories.tsx +151 -0
  247. package/lib/components/Table/subcomponents/Cell/Cell.tsx +72 -0
  248. package/lib/components/Table/subcomponents/Cell/CellContent.tsx +91 -0
  249. package/lib/components/Table/subcomponents/Cell/__tests__/Cell.test.tsx +115 -0
  250. package/lib/components/Table/subcomponents/Cell/__tests__/__snapshots__/Cell.test.tsx.snap +107 -0
  251. package/lib/components/Table/subcomponents/Head.tsx +34 -0
  252. package/lib/components/Table/subcomponents/HeadCell/HeadCell.stories.tsx +85 -0
  253. package/lib/components/Table/subcomponents/HeadCell/HeadCell.tsx +99 -0
  254. package/lib/components/Table/subcomponents/HeadCell/HeadCellContent.tsx +61 -0
  255. package/lib/components/Table/subcomponents/HeadCell/__tests__/HeadCell.test.tsx +137 -0
  256. package/lib/components/Table/subcomponents/HeadCell/__tests__/__snapshots__/HeadCell.test.tsx.snap +110 -0
  257. package/lib/components/Table/subcomponents/Row.tsx +49 -0
  258. package/lib/components/Table/subcomponents/SortIcon.tsx +63 -0
  259. package/lib/components/Table/subcomponents/index.ts +14 -0
  260. package/lib/components/Tabs/Tab.tsx +3 -3
  261. package/lib/components/Tabs/TabContext.tsx +1 -0
  262. package/lib/components/Tabs/Tabs.stories.tsx +9 -3
  263. package/lib/components/Tabs/Tabs.tsx +10 -32
  264. package/lib/components/Tabs/__tests__/Tabs.test.tsx +10 -4
  265. package/lib/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap +32 -32
  266. package/lib/components/Textarea/Textarea.stories.tsx +1 -1
  267. package/lib/components/Timepicker/Timepicker.stories.tsx +43 -0
  268. package/lib/components/Timepicker/Timepicker.tsx +100 -0
  269. package/lib/components/Timepicker/__tests__/Timepicker.test.tsx +55 -0
  270. package/lib/components/Timepicker/__tests__/__snapshots__/Timepicker.test.tsx.snap +19 -0
  271. package/lib/components/Timepicker/index.tsx +2 -0
  272. package/lib/components/Timepicker/utils/convertDateToTimeString.test.ts +54 -0
  273. package/lib/components/Timepicker/utils/convertDateToTimeString.ts +10 -0
  274. package/lib/components/Timepicker/utils/index.ts +1 -0
  275. package/lib/components/Toggle/Toggle.stories.tsx +1 -1
  276. package/lib/components/Tooltip/Tooltip.stories.tsx +1 -1
  277. package/lib/components/WeekPicker/WeekPicker.stories.tsx +147 -0
  278. package/lib/components/WeekPicker/WeekPicker.tsx +26 -0
  279. package/lib/components/WeekPicker/WeekPicker.types.ts +21 -0
  280. package/lib/components/WeekPicker/index.ts +2 -0
  281. package/lib/components/WeekPicker/subcomponents/CustomDatepicker.tsx +298 -0
  282. package/lib/components/WeekPicker/subcomponents/DatepickerInput.tsx +111 -0
  283. package/lib/components/WeekPicker/subcomponents/VisibleField.tsx +126 -0
  284. package/lib/components/WeekPicker/subcomponents/index.ts +3 -0
  285. package/lib/components/common/Common.mdx +1 -1
  286. package/lib/components/index.ts +28 -2
  287. package/lib/hooks/index.ts +2 -0
  288. package/lib/hooks/useFocusTrap.ts +159 -0
  289. package/lib/index.ts +2 -0
  290. package/lib/theme/defaultTheme.ts +7 -0
  291. package/lib/utils/__tests__/announce.test.ts +121 -0
  292. package/lib/utils/__tests__/capitalise.test.ts +40 -0
  293. package/lib/utils/announce.ts +134 -0
  294. package/lib/utils/capitalise.ts +4 -0
  295. package/lib/utils/index.ts +1 -0
  296. package/package.json +3 -6
  297. package/dist/components/Datepicker/subcomponents/NativeDatepicker.d.ts +0 -6
  298. package/lib/components/Accordion/Accordion.stories.tsx.NOT_READY +0 -93
  299. package/lib/components/Field/__tests__/__snapshots__/Field.test.tsx.snap +0 -300
  300. /package/dist/components/{Datepicker/utils/dateToLocaleISOString/dateToLocaleISOString.test.d.ts → FileInput/__tests__/FileInput.test.d.ts} +0 -0
  301. /package/lib/components/{Datepicker → NativeDatepicker}/utils/dateToLocaleISOString/dateToLocaleISOString.test.ts +0 -0
@@ -0,0 +1,117 @@
1
+ import * as AvatarStories from "./Avatar.stories";
2
+ import { Meta, Title, Subtitle, Canvas, Controls, ArgTypes } from "@storybook/blocks";
3
+
4
+ export const usage = {
5
+ image: `<Avatar
6
+ variant="image"
7
+ imageUrl="/sample-avatar-photo.jpg"
8
+ name="Jane Doe"
9
+ />`,
10
+ initials: `<Avatar variant="initials" name="Beverley Haggis" />`,
11
+ icon: `<Avatar variant="icon" aria-label="Default avatar" />`,
12
+ size: `<Avatar
13
+ variant="image"
14
+ imageUrl="/sample-avatar-photo.jpg"
15
+ name="Avatar size"
16
+ size={72}
17
+ />`,
18
+ disabled: `<Avatar
19
+ variant="image"
20
+ imageUrl="/sample-avatar-photo.jpg"
21
+ name="Disabled avatar"
22
+ disabled
23
+ />`,
24
+ fallback: `<Avatar
25
+ variant="image"
26
+ imageUrl="https://example.com/does-not-exist.jpg"
27
+ name="Fallback to initials"
28
+ />`,
29
+ };
30
+
31
+ <Meta of={AvatarStories} />
32
+ <Title />
33
+ <Subtitle>A circular avatar with graceful fallbacks for images, initials, and icons.</Subtitle>
34
+
35
+ Use `<Avatar>` anywhere you need a compact visual identifier for a user or entity. The component renders a button for easy focus styling and clickability, and progressively falls back from an image to initials to icon, based on the props you provide.
36
+
37
+ Key points:
38
+ - `variant="image"` tries to render `imageUrl` first, then initials (from `name`) if the image fails.
39
+ - `variant="initials"` renders initials from `name`; if none are found, it falls back to the icon.
40
+ - `variant="icon"` always renders the default icon.
41
+ - Fixed size options (`48 | 56 | 72 | 80`).
42
+ - Disabled state mutes colors and blocks interaction.
43
+
44
+ ## Variants
45
+
46
+ ### Image (default)
47
+ Renders a photo when `imageUrl` is available. If the image fails to load, initials are shown instead.
48
+
49
+ <Canvas
50
+ of={AvatarStories.Image}
51
+ sourceState="shown"
52
+ source={{ code: usage.image }}
53
+ />
54
+
55
+ ### Initials
56
+ Pass a `name` to derive initials (up to two characters). Use when you don't have a photo or want to avoid loading images.
57
+
58
+ <Canvas
59
+ of={AvatarStories.Initials}
60
+ sourceState="shown"
61
+ source={{ code: usage.initials }}
62
+ />
63
+
64
+ ### Icon
65
+ Always displays the default avatar icon. Helpful as a generic placeholder.
66
+
67
+ <Canvas
68
+ of={AvatarStories.Icon}
69
+ sourceState="shown"
70
+ source={{ code: usage.icon }}
71
+ />
72
+
73
+ ## Sizes
74
+ Pick from the supported sizes to match your layout. Larger sizes are useful for profile headers; smaller for lists or chips.
75
+
76
+ <Canvas
77
+ of={AvatarStories.Sizes}
78
+ sourceState="shown"
79
+ source={{ code: usage.size }}
80
+ />
81
+
82
+ ## Disabled
83
+ Prevents interaction and applies muted colors while keeping layout intact.
84
+
85
+ <Canvas
86
+ of={AvatarStories.Disabled}
87
+ sourceState="shown"
88
+ source={{ code: usage.disabled }}
89
+ />
90
+
91
+ ## Fallback behaviour
92
+ Image errors are handled gracefully: the component logs an error, then switches to initials. If no initials are available, it renders the icon.
93
+
94
+ <Canvas
95
+ of={AvatarStories.BrokenImageFallback}
96
+ sourceState="shown"
97
+ source={{ code: usage.fallback }}
98
+ />
99
+
100
+ ## Accessibility
101
+ - Under the hood, the avatar is a `<button>`. It can receive focus and `onClick` if provided.
102
+ - Provide a meaningful `aria-label` when no visible text is present (e.g. the icon variant).
103
+ - `alt` text on the image defaults to `name` for screen readers.
104
+ - Sizes remain square circles; focus styles come from the theme for keyboard visibility.
105
+
106
+ ## Props
107
+
108
+ Full props specification for `<Avatar>` is below.
109
+
110
+ <Canvas
111
+ of={AvatarStories.Default}
112
+ sourceState="hidden"
113
+ />
114
+
115
+ You can use these controls to manipulate the `<Avatar>` component above.
116
+
117
+ <Controls of={AvatarStories.Default} />
@@ -1,10 +1,81 @@
1
+ import type { CSSProperties } from 'react';
1
2
  import type { Meta, StoryObj } from '@storybook/react';
2
- import Avatar from './Avatar';
3
+ import Avatar, { type AvatarProps } from './Avatar';
3
4
  import sampleAvatarPhoto from '../../../public/sample-avatar-photo.jpg';
4
5
 
6
+ type AvatarSize = NonNullable<AvatarProps['size']>;
7
+ const avatarSizes: AvatarSize[] = [48, 56, 72, 80];
8
+
9
+ const avatarRowStyle: CSSProperties = {
10
+ display: 'flex',
11
+ gap: 16,
12
+ alignItems: 'center',
13
+ flexWrap: 'wrap',
14
+ };
15
+
5
16
  const meta = {
6
- title: 'Components/Ready to use/Avatar',
17
+ title: 'Components/Avatar',
7
18
  component: Avatar,
19
+ parameters: {
20
+ layout: 'centered',
21
+ },
22
+ argTypes: {
23
+ variant: {
24
+ description: 'Controls which representation to render',
25
+ options: ['image', 'initials', 'icon'],
26
+ control: { type: 'select' },
27
+ table: { type: { summary: "'image' | 'initials' | 'icon'" } },
28
+ },
29
+ imageUrl: {
30
+ description: 'Image source used when `variant` is `image`',
31
+ control: { type: 'text' },
32
+ table: { type: { summary: 'string' } },
33
+ },
34
+ name: {
35
+ description:
36
+ 'Name used for initials and as the fallback alt text for the image',
37
+ control: { type: 'text' },
38
+ table: { type: { summary: 'string' } },
39
+ },
40
+ size: {
41
+ description: 'Diameter of the avatar in pixels',
42
+ options: avatarSizes,
43
+ control: { type: 'inline-radio' },
44
+ table: { type: { summary: avatarSizes.join(' | ') } },
45
+ },
46
+ disabled: {
47
+ description: 'Disable interaction and mute colors',
48
+ control: { type: 'boolean' },
49
+ table: { type: { summary: 'boolean' } },
50
+ },
51
+ testId: {
52
+ description: 'Applied to the button for testing',
53
+ control: { type: 'text' },
54
+ table: { type: { summary: 'string' } },
55
+ },
56
+ className: {
57
+ description: 'Custom className for the root element',
58
+ control: { type: 'text' },
59
+ table: { type: { summary: 'string' } },
60
+ },
61
+ onClick: {
62
+ description: 'Click handler forwarded to the underlying button',
63
+ action: 'clicked',
64
+ table: {
65
+ type: {
66
+ summary: '(event: React.MouseEvent<HTMLButtonElement>) => void',
67
+ },
68
+ },
69
+ },
70
+ },
71
+ args: {
72
+ variant: 'image',
73
+ imageUrl: sampleAvatarPhoto,
74
+ name: 'Jane Doe',
75
+ size: 56,
76
+ disabled: false,
77
+ },
78
+ tags: ['autodocs'],
8
79
  } satisfies Meta<typeof Avatar>;
9
80
 
10
81
  export default meta;
@@ -29,5 +100,42 @@ export const Initials: Story = {
29
100
  export const Icon: Story = {
30
101
  args: {
31
102
  variant: 'icon',
103
+ name: 'Icon avatar',
104
+ },
105
+ };
106
+
107
+ export const Sizes: Story = {
108
+ name: 'Sizes',
109
+ args: {
110
+ imageUrl: sampleAvatarPhoto,
111
+ name: 'Avatar size',
112
+ },
113
+ render: (args) => (
114
+ <div style={avatarRowStyle}>
115
+ {avatarSizes.map((size) => (
116
+ <Avatar
117
+ key={size}
118
+ {...args}
119
+ size={size}
120
+ aria-label={`Avatar ${size}`}
121
+ />
122
+ ))}
123
+ </div>
124
+ ),
125
+ };
126
+
127
+ export const Disabled: Story = {
128
+ args: {
129
+ disabled: true,
130
+ name: 'Disabled avatar',
131
+ },
132
+ };
133
+
134
+ export const BrokenImageFallback: Story = {
135
+ name: 'Broken image fallback',
136
+ args: {
137
+ variant: 'image',
138
+ imageUrl: 'https://example.com/does-not-exist.jpg',
139
+ name: 'Fallback to initials',
32
140
  },
33
141
  };
@@ -0,0 +1,19 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import Badge from './Badge';
3
+
4
+ const meta = {
5
+ title: 'Components/Work in progress/Badge',
6
+ component: Badge,
7
+ parameters: {
8
+ layout: 'centered',
9
+ },
10
+ args: {
11
+ children: 'Badge',
12
+ },
13
+ tags: ['autodocs'],
14
+ } satisfies Meta<typeof Badge>;
15
+
16
+ export default meta;
17
+ type Story = StoryObj<typeof meta>;
18
+
19
+ export const Default: Story = {};
@@ -0,0 +1,48 @@
1
+ import { css, cx } from '@emotion/css';
2
+ import { useTheme } from '../../theme';
3
+
4
+ export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement> {
5
+ testId?: string;
6
+ className?: string;
7
+ }
8
+
9
+ const NAME = 'ucl-uikit-badge';
10
+
11
+ const Badge = ({
12
+ testId = NAME,
13
+ className,
14
+ children,
15
+ ...props
16
+ }: BadgeProps) => {
17
+ const [theme] = useTheme();
18
+
19
+ const baseStyle = css`
20
+ display: inline-flex;
21
+ align-items: center;
22
+ justify-content: center;
23
+ box-sizing: border-box;
24
+ height: 24px;
25
+ padding: ${theme.padding.p8};
26
+ color: ${theme.color.text.secondary};
27
+ background-color: #e4e4e4; // TODO: Add design token
28
+ font-family: ${theme.font.family.primary};
29
+ font-size: ${theme.font.size.f14};
30
+ font-weight: ${theme.font.weight.regular};
31
+ border-radius: ${theme.radius.r4};
32
+ white-space: nowrap;
33
+ `;
34
+
35
+ const style = cx(baseStyle, NAME, className);
36
+
37
+ return (
38
+ <div
39
+ data-testid={testId}
40
+ className={style}
41
+ {...props}
42
+ >
43
+ {children}
44
+ </div>
45
+ );
46
+ };
47
+
48
+ export default Badge;
@@ -0,0 +1,2 @@
1
+ export { default } from './Badge';
2
+ export type { BadgeProps } from './Badge';
@@ -3,7 +3,7 @@ import type { Meta, StoryObj } from '@storybook/react';
3
3
  import Blanket from './Blanket';
4
4
 
5
5
  const meta = {
6
- title: 'Components/Ready to use/Blanket',
6
+ title: 'Components/Blanket',
7
7
  component: Blanket,
8
8
  parameters: {
9
9
  layout: 'fullscreen',
@@ -36,7 +36,7 @@ exports[`Breadcrumbs > Snapshot: No props 1`] = `
36
36
  class="css-4ys53n"
37
37
  >
38
38
  <a
39
- class="ucl-link ucl-timetable-breadcrumb ucl-timetable-breadcrumb--inactive css-hr2cbw"
39
+ class="ucl-uikit-base-link ucl-uikit-link ucl-timetable-breadcrumb ucl-timetable-breadcrumb--inactive css-c7kkpi"
40
40
  data-testid="ucl-timetable-breadcrumb"
41
41
  href="/showcase"
42
42
  >
@@ -64,7 +64,7 @@ exports[`Breadcrumbs > Snapshot: No props 1`] = `
64
64
  class="css-4ys53n"
65
65
  >
66
66
  <a
67
- class="ucl-link ucl-timetable-breadcrumb ucl-timetable-breadcrumb--inactive css-hr2cbw"
67
+ class="ucl-uikit-base-link ucl-uikit-link ucl-timetable-breadcrumb ucl-timetable-breadcrumb--inactive css-c7kkpi"
68
68
  data-testid="ucl-timetable-breadcrumb"
69
69
  href="/showcase/breadcrumbs"
70
70
  >
@@ -110,7 +110,7 @@ exports[`Breadcrumbs > snapshot: Custom Test ID 1`] = `
110
110
  class="css-4ys53n"
111
111
  >
112
112
  <a
113
- class="ucl-link ucl-timetable-breadcrumb ucl-timetable-breadcrumb--inactive css-hr2cbw"
113
+ class="ucl-uikit-base-link ucl-uikit-link ucl-timetable-breadcrumb ucl-timetable-breadcrumb--inactive css-c7kkpi"
114
114
  data-testid="custom-testid-2"
115
115
  href="/showcase"
116
116
  >
@@ -138,7 +138,7 @@ exports[`Breadcrumbs > snapshot: Custom Test ID 1`] = `
138
138
  class="css-4ys53n"
139
139
  >
140
140
  <a
141
- class="ucl-link ucl-timetable-breadcrumb ucl-timetable-breadcrumb--inactive css-hr2cbw"
141
+ class="ucl-uikit-base-link ucl-uikit-link ucl-timetable-breadcrumb ucl-timetable-breadcrumb--inactive css-c7kkpi"
142
142
  data-testid="custom-testid-3"
143
143
  href="/showcase/breadcrumbs"
144
144
  >
@@ -24,7 +24,7 @@ const commonMarginPropsInfo = {
24
24
  };
25
25
 
26
26
  const meta = {
27
- title: 'Components/Ready to use/Button',
27
+ title: 'Components/Button',
28
28
  component: Button,
29
29
  parameters: {
30
30
  layout: 'centered',
@@ -11,8 +11,10 @@ import useTheme from '../../theme/useTheme';
11
11
  import buttonPrimaryStyle from './buttonPrimaryStyle';
12
12
  import buttonSecondaryStyle from './buttonSecondaryStyle';
13
13
  import buttonTertiaryStyle from './buttonTertiaryStyle';
14
- import { Spinner, Overlay, Tooltip } from '../';
15
- import marginsStyle from '../common/marginsStyle';
14
+ import Spinner from '../Spinner/Spinner';
15
+ import Overlay from '../Overlay/Overlay';
16
+ import Tooltip from '../Tooltip/Tooltip';
17
+ import marginsStyle, { MarginProps } from '../common/marginsStyle';
16
18
 
17
19
  export const NAME = 'ucl-uikit-button';
18
20
 
@@ -34,7 +36,9 @@ export interface ButtonBaseProps {
34
36
  export type ButtonProps<C extends ElementType = 'button'> = {
35
37
  as?: C;
36
38
  ref?: PolymorphicRef<C>;
39
+ className?: string;
37
40
  } & ButtonBaseProps &
41
+ MarginProps &
38
42
  Omit<ComponentPropsWithRef<C>, keyof ButtonBaseProps | 'as'>;
39
43
 
40
44
  const Button = <C extends ElementType = 'button'>({
@@ -34,17 +34,12 @@ const dateToISOString = (date: Date) => {
34
34
  export const Default: Story = {
35
35
  render: () => {
36
36
  const [args, updateArgs] = useArgs();
37
- args.pickedDate = args.pickedDate
38
- ? parseDateFromUNIXTimestamp(args.pickedDate)
39
- : null;
37
+ args.pickedDate = args.pickedDate ? parseDateFromUNIXTimestamp(args.pickedDate) : null;
40
38
  const onDatePick = (date: Date | null) => updateArgs({ pickedDate: date });
41
39
  return (
42
- <Calendar
43
- {...args}
44
- onDatePick={onDatePick}
45
- />
40
+ <Calendar {...args} onDatePick={onDatePick} />
46
41
  );
47
- },
42
+ }
48
43
  };
49
44
 
50
45
  // Story repeated in Datepicker.stories.tsx
@@ -76,17 +71,12 @@ export const WithEvents: Story = {
76
71
  },
77
72
  render: () => {
78
73
  const [args, updateArgs] = useArgs();
79
- args.pickedDate = args.pickedDate
80
- ? parseDateFromUNIXTimestamp(args.pickedDate)
81
- : null;
74
+ args.pickedDate = args.pickedDate ? parseDateFromUNIXTimestamp(args.pickedDate) : null;
82
75
  const onDatePick = (date: Date | null) => updateArgs({ pickedDate: date });
83
76
  return (
84
- <Calendar
85
- {...args}
86
- onDatePick={onDatePick}
87
- />
77
+ <Calendar {...args} onDatePick={onDatePick} />
88
78
  );
89
- },
79
+ }
90
80
  };
91
81
 
92
82
  const academicWeeks: AcademicWeek[] = [
@@ -155,17 +145,12 @@ export const WithAcademicWeeks: Story = {
155
145
  },
156
146
  render: () => {
157
147
  const [args, updateArgs] = useArgs();
158
- args.pickedDate = args.pickedDate
159
- ? parseDateFromUNIXTimestamp(args.pickedDate)
160
- : null;
148
+ args.pickedDate = args.pickedDate ? parseDateFromUNIXTimestamp(args.pickedDate) : null;
161
149
  const onDatePick = (date: Date | null) => updateArgs({ pickedDate: date });
162
150
  return (
163
- <Calendar
164
- {...args}
165
- onDatePick={onDatePick}
166
- />
151
+ <Calendar {...args} onDatePick={onDatePick} />
167
152
  );
168
- },
153
+ }
169
154
  };
170
155
 
171
156
  // Story repeated in Datepicker.stories.tsx
@@ -195,15 +180,10 @@ export const MinMaxDates: Story = {
195
180
  },
196
181
  render: () => {
197
182
  const [args, updateArgs] = useArgs();
198
- args.pickedDate = args.pickedDate
199
- ? parseDateFromUNIXTimestamp(args.pickedDate)
200
- : null;
183
+ args.pickedDate = args.pickedDate ? parseDateFromUNIXTimestamp(args.pickedDate) : null;
201
184
  const onDatePick = (date: Date | null) => updateArgs({ pickedDate: date });
202
185
  return (
203
- <Calendar
204
- {...args}
205
- onDatePick={onDatePick}
206
- />
186
+ <Calendar {...args} onDatePick={onDatePick} />
207
187
  );
208
- },
188
+ }
209
189
  };
@@ -8,12 +8,15 @@ const defaultTestId = 'ucl-uikit-calendar';
8
8
  const customRender = (ui: React.ReactElement) => {
9
9
  return render(ui, {
10
10
  wrapper: ({ children }) => (
11
- <ThemeContextProvider>{children}</ThemeContextProvider>
11
+ <ThemeContextProvider>
12
+ {children}
13
+ </ThemeContextProvider>
12
14
  ),
13
15
  });
14
16
  };
15
17
 
16
- describe('Calendar', () => {
18
+ describe("Calendar", () => {
19
+
17
20
  beforeAll(() => {
18
21
  // Snapshot tests will fail because the Calendar Grid includes styling for "today's date".
19
22
  // Therefore, we need to use Vitest to mock the current date.
@@ -21,43 +24,48 @@ describe('Calendar', () => {
21
24
  vi.setSystemTime(new Date('2025-03-10')); // Arbitrary fixed date -- Alex's birthday :)
22
25
  });
23
26
 
24
- // Snapshot tests
27
+ // Snapshot tests
25
28
 
26
- test('Snapshot: no date provided', () => {
27
- const renderResult = customRender(<Calendar />);
29
+ test("Snapshot: no date provided", () => {
30
+ const renderResult = customRender(
31
+ <Calendar />
32
+ );
28
33
  expect(renderResult.container.firstChild).toMatchSnapshot();
29
34
  });
30
35
 
31
- test('Snapshot: with date provided', () => {
36
+ test("Snapshot: with date provided", () => {
32
37
  const renderResult = customRender(
33
38
  <Calendar pickedDate={new Date('2025-01-06')} />
34
39
  );
35
40
  expect(renderResult.container.firstChild).toMatchSnapshot();
36
41
  });
37
42
 
38
- // Unit tests
43
+ // Unit tests
39
44
 
40
- test('Can be found via default test id', () => {
41
- customRender(<Calendar />);
45
+ test("Can be found via default test id", () => {
46
+ customRender(
47
+ <Calendar />
48
+ );
42
49
  const calendar = screen.getByTestId(defaultTestId);
43
50
  expect(calendar).toBeInTheDocument();
44
51
  });
45
52
 
46
- test('Can be found custom test id', () => {
53
+ test("Can be found custom test id", () => {
47
54
  const customTestId = '123';
48
- customRender(<Calendar testId={customTestId} />);
55
+ customRender(
56
+ <Calendar testId={customTestId} />
57
+ );
49
58
  const calendar = screen.getByTestId(customTestId);
50
59
  expect(calendar).toBeInTheDocument();
51
60
  });
52
61
 
53
- test('Can pick a date', () => {
62
+ test("Can pick a date", () => {
54
63
  const dateToPick = new Date('2025-03-22');
55
64
  const onDatePick = vi.fn();
56
65
  customRender(
57
66
  <Calendar
58
- pickedDate={new Date('2025-03-01')} // To ensure the calendar is displayed for March 2025
59
- onDatePick={onDatePick}
60
- />
67
+ pickedDate={new Date('2025-03-01')} // To ensure the calendar is displayed for March 2025
68
+ onDatePick={onDatePick} />
61
69
  );
62
70
  const dayButton = screen.getByText('22');
63
71
 
@@ -1,6 +1,2 @@
1
1
  export { default } from './Calendar';
2
- export type {
3
- CalendarProps,
4
- CalendarEvent,
5
- AcademicWeek,
6
- } from './Calendar.types';
2
+ export type { CalendarProps, CalendarEvent, AcademicWeek } from './Calendar.types';
@@ -13,6 +13,7 @@ interface AcademicWeeksProps {
13
13
  }
14
14
 
15
15
  const AcademicWeeks = ({ date, weeks }: AcademicWeeksProps) => {
16
+
16
17
  const [theme] = useTheme();
17
18
 
18
19
  const academicWeekNumbers = getAcademicWeekNumbers(weeks, date);
@@ -41,6 +42,6 @@ const AcademicWeeks = ({ date, weeks }: AcademicWeeksProps) => {
41
42
  ))}
42
43
  </div>
43
44
  );
44
- };
45
+ }
45
46
 
46
47
  export default AcademicWeeks;
@@ -9,7 +9,11 @@ interface ColumnHeadingProps {
9
9
 
10
10
  const NAME = 'ucl-uikit-calendar__column-heading';
11
11
 
12
- const ColumnHeading = ({ index, day, isWeekend }: ColumnHeadingProps) => {
12
+ const ColumnHeading = ({
13
+ index,
14
+ day,
15
+ isWeekend
16
+ }: ColumnHeadingProps) => {
13
17
  const [theme] = useTheme();
14
18
 
15
19
  const baseStyle = css`
@@ -9,6 +9,7 @@ interface EventDotProps {
9
9
  }
10
10
 
11
11
  const EventDot = ({ inverted, inCurrentMonth }: EventDotProps) => {
12
+
12
13
  const [theme] = useTheme();
13
14
 
14
15
  const invertedColour = theme.color.neutral.white;
@@ -33,7 +34,7 @@ const EventDot = ({ inverted, inCurrentMonth }: EventDotProps) => {
33
34
  <div
34
35
  data-testid={NAME}
35
36
  className={style}
36
- />
37
+ />
37
38
  );
38
39
  };
39
40
 
@@ -41,7 +41,6 @@ function createEventsMap(
41
41
  }
42
42
  eventsMap.get(dateKey)!.push(event);
43
43
  });
44
- console.log('Events map created:', eventsMap);
45
44
  return eventsMap;
46
45
  }
47
46
 
@@ -4,4 +4,4 @@ export { default as AcademicWeek } from './AcademicWeek';
4
4
  export { default as Grid } from './Grid';
5
5
  export { default as ColumnHeading } from './ColumnHeading';
6
6
  export { default as Day } from './Day';
7
- export { default as EventDot } from './EventDot';
7
+ export { default as EventDot } from './EventDot';