uikit-react-public 0.14.21 → 0.21.8

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 (392) hide show
  1. package/README.md +2 -2
  2. package/dist/components/Accordion/Accordion.Heading.d.ts +5 -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/AppHeader/AppHeader.d.ts +1 -1
  8. package/dist/components/AppHeader/AppHeaderBottom.d.ts +1 -1
  9. package/dist/components/AppHeader/AppHeaderNav.d.ts +1 -1
  10. package/dist/components/AppHeader/AppHeaderTop.d.ts +1 -1
  11. package/dist/components/Avatar/Avatar.stories.d.ts +107 -1
  12. package/dist/components/Breadcrumbs/Breadcrumb.d.ts +3 -4
  13. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
  14. package/dist/components/Breadcrumbs/Breadcrumbs.stories.d.ts +1 -1
  15. package/dist/components/Button/Button.d.ts +8 -3
  16. package/dist/components/Button/Button.stories.d.ts +17 -7
  17. package/dist/components/Button/style/buttonAccentStyle.d.ts +4 -0
  18. package/dist/components/Button/style/buttonPrimaryDestructiveStyle.d.ts +4 -0
  19. package/dist/components/Button/style/buttonPrimaryStyle.d.ts +4 -0
  20. package/dist/components/Button/style/buttonPrimarySubtleStyle.d.ts +4 -0
  21. package/dist/components/Button/style/buttonPrimaryWarningStyle.d.ts +4 -0
  22. package/dist/components/Button/style/buttonSecondaryDestructiveStyle.d.ts +4 -0
  23. package/dist/components/Button/style/buttonSecondaryStyle.d.ts +4 -0
  24. package/dist/components/Button/style/buttonSecondarySubtleStyle.d.ts +4 -0
  25. package/dist/components/Button/style/buttonTertiaryDestructiveStyle.d.ts +4 -0
  26. package/dist/components/Button/style/buttonTertiaryNoPaddingStyle.d.ts +4 -0
  27. package/dist/components/Button/style/buttonTertiaryStyle.d.ts +4 -0
  28. package/dist/components/Calendar/index.d.ts +1 -1
  29. package/dist/components/Checkbox/Checkbox.d.ts +1 -0
  30. package/dist/components/Datepicker/Datepicker.d.ts +1 -1
  31. package/dist/components/Datepicker/Datepicker.stories.d.ts +4 -3
  32. package/dist/components/Datepicker/Datepicker.types.d.ts +4 -5
  33. package/dist/components/Datepicker/subcomponents/CustomDatepicker.d.ts +4 -1
  34. package/dist/components/Datepicker/subcomponents/DatepickerInput.d.ts +15 -2
  35. package/dist/components/Datepicker/subcomponents/Panel.d.ts +1 -1
  36. package/dist/components/Datepicker/subcomponents/VisibleField.d.ts +6 -1
  37. package/dist/components/Datepicker/subcomponents/index.d.ts +0 -1
  38. package/dist/components/Datepicker/utils/index.d.ts +0 -1
  39. package/dist/components/Dialog/BaseDialog.d.ts +2 -1
  40. package/dist/components/Dialog/Dialog.d.ts +2 -0
  41. package/dist/components/FooterNew/BackToTop.d.ts +8 -0
  42. package/dist/components/FooterNew/Footer.d.ts +23 -0
  43. package/dist/components/FooterNew/FooterColumn.d.ts +8 -0
  44. package/dist/components/FooterNew/FooterLinks.d.ts +7 -0
  45. package/dist/components/FooterNew/FooterNavLink.d.ts +8 -0
  46. package/dist/components/FooterNew/LegalAndCopyright.d.ts +14 -0
  47. package/dist/components/FooterNew/LogoAddressAndSocial.d.ts +10 -0
  48. package/dist/components/FooterNew/SocialLink.d.ts +8 -0
  49. package/dist/components/FooterNew/index.d.ts +2 -0
  50. package/dist/components/Header/Header.d.ts +4 -1
  51. package/dist/components/Header/Header.stories.d.ts +40 -0
  52. package/dist/components/HeaderNew/Header.d.ts +18 -0
  53. package/dist/components/HeaderNew/HeaderBorder.d.ts +7 -0
  54. package/dist/components/HeaderNew/HeaderLogo.d.ts +9 -0
  55. package/dist/components/HeaderNew/HeaderMenuContainer.d.ts +7 -0
  56. package/dist/components/HeaderNew/HeaderTitle.d.ts +9 -0
  57. package/dist/components/HeaderNew/__tests__/Header.test.d.ts +1 -0
  58. package/dist/components/HeaderNew/constants.d.ts +3 -0
  59. package/dist/components/HeaderNew/index.d.ts +3 -0
  60. package/dist/components/HeadingNew/Heading.d.ts +13 -0
  61. package/dist/components/HeadingNew/index.d.ts +2 -0
  62. package/dist/components/Icon/svgImports.d.ts +7 -881
  63. package/dist/components/Link/BaseLink.d.ts +14 -5
  64. package/dist/components/Link/Link.d.ts +8 -3
  65. package/dist/components/Link/Link.stories.d.ts +3 -1
  66. package/dist/components/Main/Main.d.ts +21 -0
  67. package/dist/components/Main/Main.stories.d.ts +15 -0
  68. package/dist/components/Main/__tests__/Main.test.d.ts +1 -0
  69. package/dist/components/Main/index.d.ts +2 -0
  70. package/dist/components/MenuNew/Menu.context.d.ts +14 -0
  71. package/dist/components/MenuNew/Menu.d.ts +20 -0
  72. package/dist/components/MenuNew/MenuContent.d.ts +9 -0
  73. package/dist/components/MenuNew/MenuItem.d.ts +10 -0
  74. package/dist/components/MenuNew/MenuSection.d.ts +7 -0
  75. package/dist/components/MenuNew/index.d.ts +6 -0
  76. package/dist/components/MenuNew/trigger/ButtonMenuTrigger.d.ts +8 -0
  77. package/dist/components/MenuNew/trigger/IconMenuTrigger.d.ts +8 -0
  78. package/dist/components/NativeDatepicker/NativeDatepicker.d.ts +3 -0
  79. package/dist/components/NativeDatepicker/NativeDatepicker.stories.d.ts +36 -0
  80. package/dist/components/NativeDatepicker/NativeDatepicker.types.d.ts +10 -0
  81. package/dist/components/NativeDatepicker/index.d.ts +2 -0
  82. package/dist/components/{Datepicker → NativeDatepicker}/utils/dateToLocaleISOString/dateToLocaleISOString.d.ts +1 -1
  83. package/dist/components/NativeDatepicker/utils/dateToLocaleISOString/dateToLocaleISOString.test.d.ts +1 -0
  84. package/dist/components/NativeDatepicker/utils/index.d.ts +1 -0
  85. package/dist/components/Overlay/Overlay.stories.d.ts +12 -12
  86. package/dist/components/ParagraphNew/Paragraph.d.ts +13 -0
  87. package/dist/components/ParagraphNew/index.d.ts +4 -0
  88. package/dist/components/Select/Select.d.ts +2 -1
  89. package/dist/components/Select/Select.stories.d.ts +167 -3
  90. package/dist/components/Select/Select.types.d.ts +75 -19
  91. package/dist/components/Select/subcomponents/CustomOption.d.ts +1 -1
  92. package/dist/components/Select/subcomponents/CustomSelect.d.ts +3 -2
  93. package/dist/components/Select/subcomponents/FilterInput.d.ts +16 -0
  94. package/dist/components/Select/subcomponents/NativeSelect.d.ts +5 -1
  95. package/dist/components/Select/subcomponents/VisibleField.d.ts +6 -1
  96. package/dist/components/Select/subcomponents/index.d.ts +1 -0
  97. package/dist/components/Spinner/Spinner.d.ts +2 -0
  98. package/dist/components/StandaloneLink/StandaloneLink.d.ts +8 -5
  99. package/dist/components/StandaloneLink/StandaloneLink.stories.d.ts +3 -1
  100. package/dist/components/Table/Table.d.ts +3 -3
  101. package/dist/components/Table/Table.stories.d.ts +3 -3
  102. package/dist/components/Table/Table.types.d.ts +1 -0
  103. package/dist/components/Table/subcomponents/Cell/Cell.d.ts +5 -1
  104. package/dist/components/Table/subcomponents/Cell/Cell.stories.d.ts +15 -13
  105. package/dist/components/Table/subcomponents/Cell/CellContent.d.ts +5 -1
  106. package/dist/components/Table/subcomponents/HeadCell/HeadCell.d.ts +2 -1
  107. package/dist/components/Table/subcomponents/HeadCell/HeadCell.stories.d.ts +14 -13
  108. package/dist/components/Table/subcomponents/HeadCell/HeadCellContent.d.ts +2 -1
  109. package/dist/components/Table/subcomponents/__tests__/Row.test.d.ts +1 -0
  110. package/dist/components/UclLogoNew/UclLogo.d.ts +8 -0
  111. package/dist/components/UclLogoNew/index.d.ts +2 -0
  112. package/dist/components/WeekPicker/WeekPicker.d.ts +2 -2
  113. package/dist/components/WeekPicker/WeekPicker.stories.d.ts +41 -0
  114. package/dist/components/WeekPicker/WeekPicker.types.d.ts +16 -0
  115. package/dist/components/WeekPicker/index.d.ts +1 -0
  116. package/dist/components/WeekPicker/subcomponents/CustomDatepicker.d.ts +1 -1
  117. package/dist/components/index.d.ts +20 -0
  118. package/dist/hooks/useFocusTrap.d.ts +2 -1
  119. package/dist/index.d.ts +1 -0
  120. package/dist/index.js +22204 -16719
  121. package/dist/theme/__tests__/fonts.test.d.ts +1 -0
  122. package/dist/theme/common/themeCommon.d.ts +904 -0
  123. package/dist/theme/fonts.d.ts +18 -0
  124. package/dist/theme/index.d.ts +6 -3
  125. package/dist/theme/light/lightColour.d.ts +126 -0
  126. package/dist/theme/light/lightTheme.d.ts +3 -0
  127. package/dist/theme/original/color.d.ts +166 -0
  128. package/dist/theme/original/defaultTheme.d.ts +1340 -0
  129. package/dist/theme/original/originalColourNewStructure.d.ts +126 -0
  130. package/dist/theme/useTheme.d.ts +2174 -0
  131. package/dist/utils/__tests__/announce.test.d.ts +1 -0
  132. package/dist/utils/addAlphaToHex.d.ts +5 -0
  133. package/dist/utils/announce.d.ts +6 -0
  134. package/dist/utils/index.d.ts +1 -0
  135. package/dist/utils/scrollToTop.d.ts +2 -0
  136. package/lib/components/Accordion/Accordion.Heading.tsx +65 -34
  137. package/lib/components/Accordion/Accordion.Panel.tsx +11 -7
  138. package/lib/components/Accordion/Accordion.stories.tsx +139 -0
  139. package/lib/components/Accordion/Accordion.tsx +39 -31
  140. package/lib/components/Accordion/__tests__/__snapshots__/Accordion.test.tsx.snap +15 -13
  141. package/lib/components/Accordion/index.ts +2 -0
  142. package/lib/components/Alert/Alert.stories.tsx +1 -1
  143. package/lib/components/Alert/Alert.tsx +12 -12
  144. package/lib/components/Alert/__tests__/__snapshots__/Alert.test.tsx.snap +13 -39
  145. package/lib/components/AppHeader/AppHeader.tsx +6 -11
  146. package/lib/components/AppHeader/AppHeaderBottom.tsx +2 -3
  147. package/lib/components/AppHeader/AppHeaderNav.tsx +2 -3
  148. package/lib/components/AppHeader/AppHeaderTop.tsx +1 -1
  149. package/lib/components/AppHeader/__tests__/__snapshots__/AppHeader.test.tsx.snap +2 -2
  150. package/lib/components/AppMenu/__tests__/__snapshots__/AppMenu.test.tsx.snap +6 -19
  151. package/lib/components/Avatar/Avatar.mdx +117 -0
  152. package/lib/components/Avatar/Avatar.stories.tsx +110 -2
  153. package/lib/components/Badge/Badge.stories.tsx +1 -1
  154. package/lib/components/Blanket/Blanket.stories.tsx +1 -1
  155. package/lib/components/Breadcrumbs/Breadcrumb.tsx +26 -12
  156. package/lib/components/Breadcrumbs/Breadcrumbs.tsx +1 -1
  157. package/lib/components/Breadcrumbs/__tests__/Breadcrumbs.test.tsx +9 -27
  158. package/lib/components/Breadcrumbs/__tests__/__snapshots__/Breadcrumbs.test.tsx.snap +24 -20
  159. package/lib/components/Button/Button.mdx +32 -279
  160. package/lib/components/Button/Button.stories.tsx +44 -51
  161. package/lib/components/Button/Button.tsx +166 -25
  162. package/lib/components/Button/__tests__/Button.test.tsx +49 -15
  163. package/lib/components/Button/__tests__/__snapshots__/Button.test.tsx.snap +80 -73
  164. package/lib/components/Button/style/buttonAccentStyle.ts +53 -0
  165. package/lib/components/Button/style/buttonPrimaryDestructiveStyle.ts +55 -0
  166. package/lib/components/Button/style/buttonPrimaryStyle.ts +53 -0
  167. package/lib/components/Button/style/buttonPrimarySubtleStyle.ts +64 -0
  168. package/lib/components/Button/style/buttonPrimaryWarningStyle.ts +56 -0
  169. package/lib/components/Button/style/buttonSecondaryDestructiveStyle.ts +63 -0
  170. package/lib/components/Button/style/buttonSecondaryStyle.ts +62 -0
  171. package/lib/components/Button/style/buttonSecondarySubtleStyle.ts +72 -0
  172. package/lib/components/Button/style/buttonTertiaryDestructiveStyle.ts +65 -0
  173. package/lib/components/Button/style/buttonTertiaryNoPaddingStyle.ts +52 -0
  174. package/lib/components/Button/style/buttonTertiaryStyle.ts +62 -0
  175. package/lib/components/Calendar/Calendar.stories.tsx +1 -1
  176. package/lib/components/Calendar/Calendar.tsx +2 -2
  177. package/lib/components/Calendar/__tests__/Calendar.test.tsx +23 -15
  178. package/lib/components/Calendar/__tests__/__snapshots__/Calendar.test.tsx.snap +99 -95
  179. package/lib/components/Calendar/index.ts +1 -5
  180. package/lib/components/Calendar/subcomponents/AcademicWeek.tsx +2 -1
  181. package/lib/components/Calendar/subcomponents/AcademicWeeks.tsx +1 -1
  182. package/lib/components/Calendar/subcomponents/ColumnHeading.tsx +2 -2
  183. package/lib/components/Calendar/subcomponents/Controls.tsx +1 -1
  184. package/lib/components/Calendar/subcomponents/Day.stories.tsx +1 -1
  185. package/lib/components/Calendar/subcomponents/Day.tsx +7 -9
  186. package/lib/components/Calendar/subcomponents/EventDot.tsx +3 -6
  187. package/lib/components/Calendar/subcomponents/index.ts +1 -1
  188. package/lib/components/Calendar/utils/getDatesForCalendarGrid/getDatesForCalendarGrid.ts +43 -11
  189. package/lib/components/Calendar/utils/normaliseMonth/normaliseMonth.test.ts +5 -5
  190. package/lib/components/Checkbox/Checkbox.stories.tsx +1 -1
  191. package/lib/components/Checkbox/Checkbox.tsx +12 -10
  192. package/lib/components/Checkbox/__tests__/Checkbox.test.tsx +29 -0
  193. package/lib/components/Checkbox/__tests__/__snapshots__/Checkbox.test.tsx.snap +4 -4
  194. package/lib/components/Datepicker/Datepicker.lld.md +108 -0
  195. package/lib/components/Datepicker/Datepicker.stories.tsx +44 -5
  196. package/lib/components/Datepicker/Datepicker.tsx +14 -36
  197. package/lib/components/Datepicker/Datepicker.types.ts +5 -14
  198. package/lib/components/Datepicker/__tests__/Datepicker.test.tsx +267 -8
  199. package/lib/components/Datepicker/__tests__/__snapshots__/Datepicker.test.tsx.snap +20 -42
  200. package/lib/components/Datepicker/subcomponents/CustomDatepicker.tsx +48 -5
  201. package/lib/components/Datepicker/subcomponents/DatepickerInput.tsx +30 -17
  202. package/lib/components/Datepicker/subcomponents/Panel.tsx +6 -2
  203. package/lib/components/Datepicker/subcomponents/VisibleField.tsx +46 -8
  204. package/lib/components/Datepicker/subcomponents/index.ts +0 -1
  205. package/lib/components/Datepicker/utils/index.ts +0 -1
  206. package/lib/components/Dialog/BaseDialog.tsx +13 -2
  207. package/lib/components/Dialog/Dialog.stories.tsx +1 -1
  208. package/lib/components/Dialog/Dialog.tsx +8 -1
  209. package/lib/components/Dialog/DialogBody.tsx +5 -1
  210. package/lib/components/Dialog/DialogHeader.tsx +2 -1
  211. package/lib/components/Divider/Divider.stories.tsx +1 -1
  212. package/lib/components/Divider/__tests__/__snapshots__/Breadcrumbs.test.tsx.snap +12 -12
  213. package/lib/components/FeedbackDialog/FeedbackDialog.stories.tsx +1 -1
  214. package/lib/components/FeedbackDialog/FeedbackDialog.tsx +4 -6
  215. package/lib/components/Field/CharacterCount.tsx +2 -2
  216. package/lib/components/Field/ErrorText.tsx +2 -1
  217. package/lib/components/Field/Field.stories.tsx +1 -1
  218. package/lib/components/Field/Field.tsx +1 -1
  219. package/lib/components/Field/HelperText.tsx +3 -1
  220. package/lib/components/Field/__tests__/Field.test.tsx +13 -0
  221. package/lib/components/FileInput/FileInput.stories.tsx +1 -1
  222. package/lib/components/FileInput/__tests__/__snapshots__/FileInput.test.tsx.snap +4 -20
  223. package/lib/components/Footer/Footer.stories.tsx +1 -1
  224. package/lib/components/Footer/__tests__/__snapshots__/Footer.test.tsx.snap +73 -82
  225. package/lib/components/FooterNew/BackToTop.tsx +83 -0
  226. package/lib/components/FooterNew/Footer.tsx +110 -0
  227. package/lib/components/FooterNew/FooterColumn.tsx +79 -0
  228. package/lib/components/FooterNew/FooterLinks.tsx +44 -0
  229. package/lib/components/FooterNew/FooterNavLink.tsx +63 -0
  230. package/lib/components/FooterNew/LegalAndCopyright.tsx +150 -0
  231. package/lib/components/FooterNew/LogoAddressAndSocial.tsx +154 -0
  232. package/lib/components/FooterNew/SocialLink.tsx +108 -0
  233. package/lib/components/FooterNew/__tests__/Footer.test.tsx +51 -0
  234. package/lib/components/FooterNew/__tests__/__snapshots__/Footer.test.tsx.snap +1107 -0
  235. package/lib/components/FooterNew/index.ts +2 -0
  236. package/lib/components/Header/Header.mdx +52 -0
  237. package/lib/components/Header/Header.stories.tsx +98 -0
  238. package/lib/components/Header/Header.tsx +51 -6
  239. package/lib/components/Header/__tests__/Header.test.tsx +17 -1
  240. package/lib/components/HeaderDraft/__tests__/__snapshots__/Header.test.tsx.snap +3 -2
  241. package/lib/components/HeaderNew/Header.tsx +93 -0
  242. package/lib/components/HeaderNew/HeaderBorder.tsx +55 -0
  243. package/lib/components/HeaderNew/HeaderLogo.tsx +70 -0
  244. package/lib/components/HeaderNew/HeaderMenuContainer.tsx +35 -0
  245. package/lib/components/HeaderNew/HeaderTitle.tsx +53 -0
  246. package/lib/components/HeaderNew/__tests__/Header.test.tsx +42 -0
  247. package/lib/components/HeaderNew/__tests__/__snapshots__/Header.test.tsx.snap +79 -0
  248. package/lib/components/HeaderNew/constants.ts +3 -0
  249. package/lib/components/HeaderNew/index.ts +7 -0
  250. package/lib/components/Heading/Heading.stories.tsx +1 -1
  251. package/lib/components/HeadingNew/Heading.tsx +208 -0
  252. package/lib/components/HeadingNew/index.ts +2 -0
  253. package/lib/components/Icon/Icon.stories.tsx +1 -1
  254. package/lib/components/Icon/__tests__/__snapshots__/Icon.test.tsx.snap +16 -12
  255. package/lib/components/Icon/svgImports.ts +318 -296
  256. package/lib/components/IconButton/IconButton.stories.tsx +1 -1
  257. package/lib/components/IconButton/IconButton.tsx +3 -4
  258. package/lib/components/IconButton/__tests__/__snapshots__/IconButton.test.tsx.snap +12 -9
  259. package/lib/components/Input/Input.stories.tsx +1 -1
  260. package/lib/components/Label/Label.stories.tsx +1 -1
  261. package/lib/components/Link/BaseLink.tsx +114 -71
  262. package/lib/components/Link/Link.stories.tsx +1 -1
  263. package/lib/components/Link/Link.tsx +120 -109
  264. package/lib/components/Link/__tests__/__snapshots__/link.test.tsx.snap +2 -2
  265. package/lib/components/Main/Main.stories.tsx +36 -0
  266. package/lib/components/Main/Main.tsx +46 -0
  267. package/lib/components/Main/__tests__/Main.test.tsx +80 -0
  268. package/lib/components/Main/__tests__/__snapshots__/Main.test.tsx.snap +33 -0
  269. package/lib/components/Main/index.ts +2 -0
  270. package/lib/components/MenuNew/Menu.context.tsx +149 -0
  271. package/lib/components/MenuNew/Menu.tsx +75 -0
  272. package/lib/components/MenuNew/MenuContent.tsx +140 -0
  273. package/lib/components/MenuNew/MenuItem.tsx +101 -0
  274. package/lib/components/MenuNew/MenuSection.tsx +47 -0
  275. package/lib/components/MenuNew/index.ts +8 -0
  276. package/lib/components/MenuNew/trigger/ButtonMenuTrigger.tsx +42 -0
  277. package/lib/components/MenuNew/trigger/IconMenuTrigger.tsx +40 -0
  278. package/lib/components/NativeDatepicker/NativeDatepicker.stories.tsx +100 -0
  279. package/lib/components/{Datepicker/subcomponents → NativeDatepicker}/NativeDatepicker.tsx +14 -15
  280. package/lib/components/NativeDatepicker/NativeDatepicker.types.ts +19 -0
  281. package/lib/components/NativeDatepicker/index.ts +2 -0
  282. package/lib/components/{Datepicker → NativeDatepicker}/utils/dateToLocaleISOString/dateToLocaleISOString.ts +1 -1
  283. package/lib/components/NativeDatepicker/utils/index.ts +1 -0
  284. package/lib/components/Pagination/Pagination.stories.tsx +1 -1
  285. package/lib/components/Pagination/PaginationControls.tsx +59 -17
  286. package/lib/components/Pagination/PaginationInfo.tsx +7 -4
  287. package/lib/components/Paragraph/Paragraph.stories.tsx +1 -1
  288. package/lib/components/ParagraphNew/Paragraph.tsx +200 -0
  289. package/lib/components/ParagraphNew/index.ts +6 -0
  290. package/lib/components/Radio/Radio.stories.tsx +1 -1
  291. package/lib/components/Radio/Radio.tsx +8 -8
  292. package/lib/components/Radio/__tests__/__snapshots__/Radio.test.tsx.snap +4 -4
  293. package/lib/components/Search/Search.stories.tsx +1 -1
  294. package/lib/components/Search/Search.tsx +4 -1
  295. package/lib/components/Search/__tests__/Search.test.tsx +19 -1
  296. package/lib/components/Search/__tests__/__snapshots__/Search.test.tsx.snap +12 -32
  297. package/lib/components/Select/Select.mdx +192 -0
  298. package/lib/components/Select/Select.stories.tsx +229 -48
  299. package/lib/components/Select/Select.tsx +50 -15
  300. package/lib/components/Select/Select.types.ts +99 -44
  301. package/lib/components/Select/__tests__/Select.test.tsx +698 -8
  302. package/lib/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +5 -4
  303. package/lib/components/Select/subcomponents/CustomOption.tsx +12 -4
  304. package/lib/components/Select/subcomponents/CustomSelect.tsx +411 -41
  305. package/lib/components/Select/subcomponents/FilterInput.tsx +90 -0
  306. package/lib/components/Select/subcomponents/NativeSelect.tsx +21 -17
  307. package/lib/components/Select/subcomponents/Panel.tsx +2 -2
  308. package/lib/components/Select/subcomponents/VisibleField.tsx +59 -6
  309. package/lib/components/Select/subcomponents/index.tsx +1 -0
  310. package/lib/components/Snackbar/Snackbar.stories.tsx +1 -1
  311. package/lib/components/Snackbar/__tests__/__snapshots__/Snackbar.test.tsx.snap +9 -15
  312. package/lib/components/Spinner/Spinner.stories.tsx +1 -1
  313. package/lib/components/Spinner/Spinner.tsx +24 -5
  314. package/lib/components/Spinner/__tests__/Spinner.test.tsx +35 -5
  315. package/lib/components/Spinner/__tests__/__snapshots__/Spinner.test.tsx.snap +40 -16
  316. package/lib/components/StandaloneLink/StandaloneLink.stories.tsx +1 -1
  317. package/lib/components/StandaloneLink/StandaloneLink.tsx +180 -163
  318. package/lib/components/StandaloneLink/__tests__/__snapshots__/StandaloneLink.test.tsx.snap +2 -2
  319. package/lib/components/Table/Table.stories.tsx +1 -1
  320. package/lib/components/Table/Table.tsx +2 -0
  321. package/lib/components/Table/Table.types.ts +1 -0
  322. package/lib/components/Table/__tests__/Table.test.tsx +19 -0
  323. package/lib/components/Table/__tests__/__snapshots__/Table.test.tsx.snap +7 -3
  324. package/lib/components/Table/subcomponents/Cell/Cell.stories.tsx +1 -1
  325. package/lib/components/Table/subcomponents/Cell/Cell.tsx +23 -2
  326. package/lib/components/Table/subcomponents/Cell/CellContent.tsx +12 -1
  327. package/lib/components/Table/subcomponents/Cell/__tests__/Cell.test.tsx +106 -0
  328. package/lib/components/Table/subcomponents/Cell/__tests__/__snapshots__/Cell.test.tsx.snap +4 -3
  329. package/lib/components/Table/subcomponents/HeadCell/HeadCell.stories.tsx +1 -1
  330. package/lib/components/Table/subcomponents/HeadCell/HeadCell.tsx +28 -6
  331. package/lib/components/Table/subcomponents/HeadCell/HeadCellContent.tsx +3 -0
  332. package/lib/components/Table/subcomponents/HeadCell/__tests__/HeadCell.test.tsx +221 -2
  333. package/lib/components/Table/subcomponents/HeadCell/__tests__/__snapshots__/HeadCell.test.tsx.snap +6 -4
  334. package/lib/components/Table/subcomponents/Row.tsx +2 -2
  335. package/lib/components/Table/subcomponents/SortIcon.tsx +1 -0
  336. package/lib/components/Table/subcomponents/__tests__/Row.test.tsx +59 -0
  337. package/lib/components/Tabs/Tab.tsx +3 -3
  338. package/lib/components/Tabs/Tabs.stories.tsx +1 -1
  339. package/lib/components/Tabs/Tabs.tsx +5 -3
  340. package/lib/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap +4 -4
  341. package/lib/components/Textarea/Textarea.stories.tsx +1 -1
  342. package/lib/components/Timepicker/Timepicker.stories.tsx +1 -1
  343. package/lib/components/Timepicker/Timepicker.tsx +4 -0
  344. package/lib/components/Timepicker/__tests__/__snapshots__/Timepicker.test.tsx.snap +2 -2
  345. package/lib/components/Toggle/Toggle.stories.tsx +1 -1
  346. package/lib/components/Toggle/Toggle.tsx +5 -5
  347. package/lib/components/Toggle/ToggleHandle.tsx +2 -3
  348. package/lib/components/Tooltip/Tooltip.stories.tsx +1 -1
  349. package/lib/components/Tooltip/Tooltip.tsx +2 -2
  350. package/lib/components/Tooltip/__tests__/__snapshots__/tooltip.test.tsx.snap +2 -2
  351. package/lib/components/UclLogoNew/UclLogo.tsx +42 -0
  352. package/lib/components/UclLogoNew/index.ts +2 -0
  353. package/lib/components/WeekPicker/WeekPicker.stories.tsx +145 -0
  354. package/lib/components/WeekPicker/WeekPicker.tsx +2 -2
  355. package/lib/components/WeekPicker/WeekPicker.types.ts +21 -0
  356. package/lib/components/WeekPicker/index.ts +1 -0
  357. package/lib/components/WeekPicker/subcomponents/CustomDatepicker.tsx +1 -1
  358. package/lib/components/common/Common.mdx +1 -2
  359. package/lib/components/index.ts +30 -3
  360. package/lib/hooks/useFocusTrap.ts +40 -4
  361. package/lib/index.ts +1 -0
  362. package/lib/theme/Colours.mdx +1 -1
  363. package/lib/theme/Theme.mdx +1 -1
  364. package/lib/theme/Typography.mdx +1 -1
  365. package/lib/theme/__tests__/fonts.test.ts +37 -0
  366. package/lib/theme/common/themeCommon.ts +515 -0
  367. package/lib/theme/fonts.ts +110 -0
  368. package/lib/theme/index.ts +6 -6
  369. package/lib/theme/light/lightColour.ts +232 -0
  370. package/lib/theme/light/lightTheme.ts +37 -0
  371. package/lib/theme/{defaultTheme.ts → original/color.ts} +17 -199
  372. package/lib/theme/original/defaultTheme.ts +207 -0
  373. package/lib/theme/original/originalColourNewStructure.ts +185 -0
  374. package/lib/theme/useTheme.tsx +72 -15
  375. package/lib/types/assets.d.ts +10 -0
  376. package/lib/utils/__tests__/announce.test.ts +121 -0
  377. package/lib/utils/addAlphaToHex.ts +29 -0
  378. package/lib/utils/announce.ts +134 -0
  379. package/lib/utils/index.ts +1 -0
  380. package/lib/utils/scrollToTop.ts +5 -0
  381. package/package.json +11 -9
  382. package/dist/components/Button/buttonPrimaryStyle.d.ts +0 -4
  383. package/dist/components/Button/buttonSecondaryStyle.d.ts +0 -4
  384. package/dist/components/Button/buttonTertiaryStyle.d.ts +0 -4
  385. package/dist/components/Datepicker/subcomponents/NativeDatepicker.d.ts +0 -6
  386. package/dist/theme/defaultTheme.d.ts +0 -274
  387. package/lib/components/Accordion/Accordion.stories.tsx.NOT_READY +0 -93
  388. package/lib/components/Button/buttonPrimaryStyle.ts +0 -62
  389. package/lib/components/Button/buttonSecondaryStyle.ts +0 -65
  390. package/lib/components/Button/buttonTertiaryStyle.ts +0 -54
  391. /package/dist/components/{Datepicker/utils/dateToLocaleISOString/dateToLocaleISOString.test.d.ts → FooterNew/__tests__/Footer.test.d.ts} +0 -0
  392. /package/lib/components/{Datepicker → NativeDatepicker}/utils/dateToLocaleISOString/dateToLocaleISOString.test.ts +0 -0
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Sends a message to screen readers using an ARIA live region.
3
+ *
4
+ * Automatically initializes a hidden live region the first time it is used.
5
+ * This allows screen readers (NVDA, JAWS, VoiceOver) to announce dynamic
6
+ * updates such as "Item removed", "Saved", etc.
7
+ *
8
+ * The live region is visually hidden but remains accessible.
9
+ *
10
+ * @param message - The message to announce to screen readers.
11
+ *
12
+ * @param force - If true, forces the announcement even if it's the same as the last one.
13
+ *
14
+ * @example
15
+ * announce("Item removed");
16
+ *
17
+ * @example
18
+ * announce("Form submitted successfully");
19
+ */
20
+ let liveRegion: HTMLDivElement | null = null;
21
+ let announcementQueue: string[] = [];
22
+ let isAnnouncing = false;
23
+ let lastAnnouncement = '';
24
+
25
+ const SR_DETECTION_DELAY = 100; // Time for SR to detect change
26
+ const SR_PROCESSING_DELAY = 1000; // Time for SR to finish announcement
27
+
28
+ /**
29
+ * Creates the live region if it does not already exist.
30
+ */
31
+ const initLiveRegion = (): void => {
32
+ if (typeof document === 'undefined' || liveRegion) return;
33
+
34
+ // Guard: body may not exist yet (e.g., script in <head>)
35
+ const container = document.body || document.documentElement;
36
+ if (!container) return;
37
+
38
+ const region = document.createElement('div');
39
+ region.setAttribute('aria-live', 'polite');
40
+ region.setAttribute('aria-atomic', 'true');
41
+ region.setAttribute('role', 'status');
42
+ region.setAttribute('data-testid', 'aria-live-region');
43
+
44
+ // Visually hide but keep accessible
45
+ region.style.position = 'absolute';
46
+ region.style.left = '-9999px';
47
+ region.style.width = '1px';
48
+ region.style.height = '1px';
49
+ region.style.overflow = 'hidden';
50
+
51
+ document.body.appendChild(region);
52
+ liveRegion = region;
53
+ };
54
+
55
+ /**
56
+ * Processes the announcement queue sequentially.
57
+ */
58
+ const processQueue = (): void => {
59
+ if (isAnnouncing || announcementQueue.length === 0) return;
60
+
61
+ if (!liveRegion) {
62
+ // If no live region, do not drop the message or update lastAnnouncement
63
+ return;
64
+ }
65
+
66
+ // Only shift and update lastAnnouncement if liveRegion exists
67
+ const message = announcementQueue.shift()!;
68
+ lastAnnouncement = message;
69
+ isAnnouncing = true;
70
+ // Clear previous message to force announcement
71
+ liveRegion.textContent = '';
72
+
73
+ // brief delay ensures SRs detect the change
74
+ setTimeout(() => {
75
+ if (liveRegion) {
76
+ liveRegion.textContent = message;
77
+ }
78
+
79
+ // Wait for screen reader to process, then announce next
80
+ setTimeout(() => {
81
+ isAnnouncing = false;
82
+ processQueue();
83
+ }, SR_PROCESSING_DELAY);
84
+ }, SR_DETECTION_DELAY);
85
+ };
86
+
87
+ /**
88
+ * Announces a message to screen readers.
89
+ */
90
+ const announce = (message: string, force = false): void => {
91
+ // SSR guard: do nothing if document is unavailable
92
+ if (typeof document === 'undefined') return;
93
+
94
+ // Initialize live region on first use
95
+ if (!liveRegion) initLiveRegion();
96
+
97
+ // If forcing, clear the queue to prevent old messages
98
+ if (force) {
99
+ announcementQueue.length = 0;
100
+ }
101
+
102
+ // Skip if the same message was just announced or is already queued
103
+ if (
104
+ !force &&
105
+ message === lastAnnouncement &&
106
+ announcementQueue.length === 0
107
+ ) {
108
+ return;
109
+ }
110
+
111
+ // Prevent adding duplicate messages to the queue (including if currently announcing)
112
+ if (
113
+ announcementQueue.includes(message) ||
114
+ (isAnnouncing && lastAnnouncement === message)
115
+ ) {
116
+ return;
117
+ }
118
+
119
+ announcementQueue.push(message);
120
+ processQueue();
121
+ };
122
+
123
+ // Export for testing purposes
124
+ export const __resetForTesting = (): void => {
125
+ if (liveRegion && liveRegion.parentNode) {
126
+ liveRegion.parentNode.removeChild(liveRegion);
127
+ }
128
+ liveRegion = null;
129
+ announcementQueue = [];
130
+ isAnnouncing = false;
131
+ lastAnnouncement = '';
132
+ };
133
+
134
+ export default announce;
@@ -0,0 +1 @@
1
+ export { default as announce } from './announce';
@@ -0,0 +1,5 @@
1
+ const scrollToTop = () => {
2
+ window?.scrollTo({ top: 0, behavior: 'smooth' });
3
+ };
4
+
5
+ export default scrollToTop;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "uikit-react-public",
3
3
  "private": false,
4
4
  "license": "UNLICENSED",
5
- "version": "0.14.21",
5
+ "version": "0.21.8",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
@@ -11,7 +11,7 @@
11
11
  "lib"
12
12
  ],
13
13
  "publishConfig": {
14
- "registry": "https://registry.npmjs.org/"
14
+ "access": "public"
15
15
  },
16
16
  "scripts": {
17
17
  "dev": "vite",
@@ -28,9 +28,7 @@
28
28
  "coverage": "vitest run --coverage",
29
29
  "report": "vite ./coverage",
30
30
  "preview": "vite preview",
31
- "prepublishOnly": "npm run build",
32
- "prepare": "husky",
33
- "storybook": "storybook dev -p 6006",
31
+ "storybook": "storybook dev -p 6006 --disable-telemetry",
34
32
  "build-storybook": "storybook build",
35
33
  "predeploy": "npm run build-storybook",
36
34
  "deploy": "gh-pages -d storybook-static"
@@ -42,11 +40,13 @@
42
40
  },
43
41
  "dependencies": {
44
42
  "@emotion/css": "^11.13.5",
45
- "@floating-ui/react-dom": "^2.1.2"
43
+ "@emotion/react": "^11.14.0",
44
+ "@floating-ui/react-dom": "^2.1.2",
45
+ "design-system-foundations-public": "0.0.37"
46
46
  },
47
47
  "peerDependencies": {
48
- "react": "^18.0.0 || ^19.0.0",
49
- "react-dom": "^18.0.0 || ^19.0.0"
48
+ "react": "^19.0.0",
49
+ "react-dom": "^19.0.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@azure/msal-browser": "^4.7.0",
@@ -66,7 +66,8 @@
66
66
  "@testing-library/react": "^16.2.0",
67
67
  "@testing-library/user-event": "^14.6.1",
68
68
  "@types/node": "^22.13.10",
69
- "@types/react-dom": "^19.1.2",
69
+ "@types/react": "^19.2.14",
70
+ "@types/react-dom": "^19.2.3",
70
71
  "@typescript-eslint/eslint-plugin": "^8.26.1",
71
72
  "@typescript-eslint/parser": "^8.26.1",
72
73
  "@vitejs/plugin-basic-ssl": "^2.0.0",
@@ -89,6 +90,7 @@
89
90
  "prettier": "^3.5.3",
90
91
  "react": "^19.1.0",
91
92
  "react-dom": "^19.1.0",
93
+ "react-router": "^7.13.1",
92
94
  "storybook": "^8.6.4",
93
95
  "typescript": "^5.8.2",
94
96
  "typescript-eslint": "^8.26.1",
@@ -1,4 +0,0 @@
1
- import { ThemeType } from '../../theme';
2
- import { ButtonBaseProps } from './Button';
3
- declare const buttonPrimaryStyle: (theme: ThemeType, destructive: ButtonBaseProps["destructive"], disabled: ButtonBaseProps["disabled"], loading: ButtonBaseProps["loading"]) => string;
4
- export default buttonPrimaryStyle;
@@ -1,4 +0,0 @@
1
- import { ThemeType } from '../../theme';
2
- import { ButtonBaseProps } from './Button';
3
- declare const buttonSecondaryStyle: (theme: ThemeType, destructive: ButtonBaseProps["destructive"], disabled: ButtonBaseProps["disabled"], loading: ButtonBaseProps["loading"]) => string;
4
- export default buttonSecondaryStyle;
@@ -1,4 +0,0 @@
1
- import { ThemeType } from '../../theme';
2
- import { ButtonBaseProps } from './Button';
3
- declare const buttonTertiaryStyle: (theme: ThemeType, disabled: ButtonBaseProps["disabled"], loading: ButtonBaseProps["loading"]) => string;
4
- export default buttonTertiaryStyle;
@@ -1,6 +0,0 @@
1
- interface NativeDatepickerProps extends React.InputHTMLAttributes<HTMLInputElement> {
2
- testId?: string;
3
- ref?: React.RefObject<HTMLInputElement>;
4
- }
5
- declare const NativeDatepicker: ({ value, onChange, min, max, className, disabled, testId, ref, ...props }: NativeDatepickerProps) => import("react/jsx-runtime").JSX.Element;
6
- export default NativeDatepicker;
@@ -1,274 +0,0 @@
1
- declare const displayColours: {
2
- purpleDark: string;
3
- purpleVibrant: string;
4
- purpleMuted: string;
5
- greenDark: string;
6
- greenVibrant: string;
7
- greenMuted: string;
8
- yellowDark: string;
9
- yellowVibrant: string;
10
- yellowMuted: string;
11
- pinkDark: string;
12
- pinkVibrant: string;
13
- pinkMuted: string;
14
- blueDark: string;
15
- blueVibrant: string;
16
- blueMuted: string;
17
- };
18
- declare const blackAndWhite: {
19
- black: string;
20
- white: string;
21
- };
22
- declare const theme: {
23
- p0: number;
24
- p2: string;
25
- p4: string;
26
- p6: string;
27
- p8: string;
28
- p12: string;
29
- p16: string;
30
- p20: string;
31
- p24: string;
32
- p32: string;
33
- p40: string;
34
- p48: string;
35
- p56: string;
36
- p64: string;
37
- p72: string;
38
- p80: string;
39
- m0: number;
40
- m2: string;
41
- m4: string;
42
- m6: string;
43
- m8: string;
44
- m12: string;
45
- m16: string;
46
- m20: string;
47
- m24: string;
48
- m32: string;
49
- m40: string;
50
- m48: string;
51
- m56: string;
52
- m64: string;
53
- m72: string;
54
- m80: string;
55
- color: {
56
- text: {
57
- primary: string;
58
- secondary: string;
59
- muted: string;
60
- inverted: string;
61
- interactive: string;
62
- default: string;
63
- disabledOnBg: string;
64
- disabled: string;
65
- active: string;
66
- hover: string;
67
- visited: string;
68
- error: string;
69
- errorHover: string;
70
- errorDisabled: string;
71
- };
72
- interaction: {
73
- blue100: string;
74
- blue80: string;
75
- blue70: string;
76
- blue40: string;
77
- blue10: string;
78
- blue5: string;
79
- };
80
- display: {
81
- purpleDark: string;
82
- purpleVibrant: string;
83
- purpleMuted: string;
84
- greenDark: string;
85
- greenVibrant: string;
86
- greenMuted: string;
87
- yellowDark: string;
88
- yellowVibrant: string;
89
- yellowMuted: string;
90
- pinkDark: string;
91
- pinkVibrant: string;
92
- pinkMuted: string;
93
- blueDark: string;
94
- blueVibrant: string;
95
- blueMuted: string;
96
- };
97
- system: {
98
- red100: string;
99
- red70: string;
100
- red40: string;
101
- red10: string;
102
- orange100: string;
103
- orange70: string;
104
- orange40: string;
105
- orange10: string;
106
- green100: string;
107
- green70: string;
108
- green40: string;
109
- green10: string;
110
- blue100: string;
111
- blue80: string;
112
- blue70: string;
113
- blue40: string;
114
- blue10: string;
115
- blue5: string;
116
- };
117
- link: {
118
- default: string;
119
- secondaryDefault: string;
120
- hover: string;
121
- secondaryHover: string;
122
- visited: string;
123
- disabled: string;
124
- };
125
- neutral: {
126
- black: string;
127
- grey90: string;
128
- grey80: string;
129
- grey70: string;
130
- grey60: string;
131
- grey40: string;
132
- grey20: string;
133
- grey15: string;
134
- grey10: string;
135
- grey5: string;
136
- white: string;
137
- };
138
- overlay: {
139
- blanket: string;
140
- };
141
- };
142
- thickness: {
143
- t1: string;
144
- t2: string;
145
- };
146
- width: {
147
- h16: string;
148
- h20: string;
149
- h24: string;
150
- };
151
- height: {
152
- h16: string;
153
- h20: string;
154
- h24: string;
155
- h32: string;
156
- h36: string;
157
- h40: string;
158
- h80: string;
159
- };
160
- margin: {
161
- m0: number;
162
- m2: string;
163
- m4: string;
164
- m6: string;
165
- m8: string;
166
- m12: string;
167
- m16: string;
168
- m20: string;
169
- m24: string;
170
- m32: string;
171
- m40: string;
172
- m48: string;
173
- m56: string;
174
- m64: string;
175
- m72: string;
176
- m80: string;
177
- };
178
- padding: {
179
- p0: number;
180
- p2: string;
181
- p4: string;
182
- p6: string;
183
- p8: string;
184
- p12: string;
185
- p16: string;
186
- p20: string;
187
- p24: string;
188
- p32: string;
189
- p40: string;
190
- p48: string;
191
- p56: string;
192
- p64: string;
193
- p72: string;
194
- p80: string;
195
- };
196
- radius: {
197
- r2: string;
198
- r4: string;
199
- r8: string;
200
- r12: string;
201
- r16: string;
202
- };
203
- border: {
204
- b1: string;
205
- b2: string;
206
- };
207
- outline: {
208
- o2: string;
209
- o4: string;
210
- };
211
- font: {
212
- family: {
213
- primary: string;
214
- secondary: string;
215
- fixed: string;
216
- };
217
- size: {
218
- f12: string;
219
- f14: string;
220
- f16: string;
221
- f18: string;
222
- f20: string;
223
- f22: string;
224
- f24: string;
225
- f26: string;
226
- f28: string;
227
- f30: string;
228
- f32: string;
229
- f36: string;
230
- f40: string;
231
- };
232
- weight: {
233
- light: number;
234
- regular: number;
235
- medium: number;
236
- semiBold: number;
237
- bold: number;
238
- extraBold: number;
239
- };
240
- lineHeight: {
241
- h100: string;
242
- h110: string;
243
- h120: string;
244
- h130: string;
245
- h140: string;
246
- h150: string;
247
- };
248
- };
249
- boxShadow: {
250
- y1: string;
251
- y2: string;
252
- x2y4: string;
253
- focus: string;
254
- active: string;
255
- destructiveActive: string;
256
- };
257
- breakpoints: {
258
- mobile: number;
259
- tablet: number;
260
- desktop: number;
261
- desktopLarge: number;
262
- };
263
- mq: {
264
- mobile: string;
265
- tablet: string;
266
- desktop: string;
267
- desktopLarge: string;
268
- custom: (breakpoint: number) => string;
269
- };
270
- };
271
- export type ThemeType = typeof theme;
272
- export type DisplayColoursType = typeof displayColours;
273
- export type BlackAndWhiteColoursType = typeof blackAndWhite;
274
- export default theme;
@@ -1,93 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import Accordion from './Accordion';
3
- import { ThemeContextProvider } from '../../theme/useTheme';
4
-
5
- const meta: Meta<typeof Accordion> = {
6
- title: 'Components/Accordion',
7
- component: Accordion,
8
- decorators: [
9
- (Story: React.FC) => (
10
- <ThemeContextProvider>
11
- <Story />
12
- </ThemeContextProvider>
13
- ),
14
- ],
15
- };
16
-
17
- export default meta;
18
-
19
- type Story = StoryObj<typeof meta>;
20
-
21
- export const Default: Story = {
22
- args: {
23
- isOpen: false,
24
- disabled: false,
25
- size: 'medium',
26
- },
27
- render: (args) => (
28
- <Accordion {...args}>
29
- <Accordion.Heading>Heading</Accordion.Heading>
30
- <Accordion.Panel>Panel Content</Accordion.Panel>
31
- </Accordion>
32
- ),
33
- };
34
-
35
- export const OpenByDefault: Story = {
36
- args: {
37
- isOpen: true,
38
- disabled: false,
39
- size: 'medium',
40
- },
41
- render: (args) => (
42
- <Accordion {...args}>
43
- <Accordion.Heading>Heading</Accordion.Heading>
44
- <Accordion.Panel>Panel Content</Accordion.Panel>
45
- </Accordion>
46
- ),
47
- };
48
-
49
- export const Disabled: Story = {
50
- args: {
51
- isOpen: false,
52
- disabled: true,
53
- size: 'medium',
54
- },
55
- render: (args) => (
56
- <Accordion {...args}>
57
- <Accordion.Heading>Heading</Accordion.Heading>
58
- <Accordion.Panel>Panel Content</Accordion.Panel>
59
- </Accordion>
60
- ),
61
- };
62
-
63
- export const SmallSize: Story = {
64
- args: {
65
- isOpen: false,
66
- disabled: false,
67
- size: 'small',
68
- },
69
- render: (args) => (
70
- <Accordion {...args}>
71
- <Accordion.Heading>Heading</Accordion.Heading>
72
- <Accordion.Panel>Panel Content</Accordion.Panel>
73
- </Accordion>
74
- ),
75
- };
76
-
77
- export const CustomHeadingElement: Story = {
78
- args: {
79
- isOpen: false,
80
- disabled: false,
81
- size: 'medium',
82
- },
83
- render: (args) => (
84
- <Accordion {...args}>
85
- <Accordion.Heading as='h2'>
86
- Custom Heading as H2
87
- </Accordion.Heading>
88
- <Accordion.Panel>
89
- <p>This is the content of the accordion.</p>
90
- </Accordion.Panel>
91
- </Accordion>
92
- ),
93
- };
@@ -1,62 +0,0 @@
1
- import { css, cx } from '@emotion/css';
2
- import { ThemeType } from '../../theme';
3
- import { ButtonBaseProps } from './Button';
4
-
5
- const buttonPrimaryStyle = (
6
- theme: ThemeType,
7
- destructive: ButtonBaseProps['destructive'],
8
- disabled: ButtonBaseProps['disabled'],
9
- loading: ButtonBaseProps['loading']
10
- ) => {
11
- const {
12
- color: { system, interaction },
13
- boxShadow,
14
- } = theme;
15
-
16
- const bgColour = destructive ? system.red70 : interaction.blue70;
17
- const bgHoverColour = destructive ? system.red100 : interaction.blue80;
18
- const bgActiveColour = destructive ? system.red70 : interaction.blue70;
19
- const boxShadowActive = destructive
20
- ? boxShadow.destructiveActive
21
- : boxShadow.active;
22
-
23
- const primaryBaseStyle = css`
24
- border: none;
25
- background-color: ${bgColour};
26
- color: ${theme.color.neutral.white};
27
- font-weight: ${theme.font.weight.bold};
28
- `;
29
-
30
- const interactiveStyle = css`
31
- cursor: pointer;
32
-
33
- &:hover {
34
- background-color: ${bgHoverColour};
35
- }
36
-
37
- &:active {
38
- background-color: ${bgActiveColour};
39
- box-shadow: ${boxShadowActive};
40
- }
41
- `;
42
-
43
- const disabledStyle = css`
44
- border-color: ${theme.color.text.disabled};
45
- background-color: ${theme.color.link.disabled};
46
- color: ${theme.color.text.disabledOnBg};
47
- cursor: not-allowed;
48
- `;
49
-
50
- const loadingStyle = css`
51
- cursor: wait;
52
- `;
53
-
54
- return cx(
55
- primaryBaseStyle,
56
- !disabled && !loading && interactiveStyle,
57
- disabled && disabledStyle,
58
- loading && loadingStyle
59
- );
60
- };
61
-
62
- export default buttonPrimaryStyle;