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,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,4 @@
1
+ const capitalise = (text: string) =>
2
+ text.charAt(0).toUpperCase() + text.slice(1);
3
+
4
+ export default capitalise;
@@ -0,0 +1 @@
1
+ export { default as announce } from './announce';
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.11.24",
5
+ "version": "0.17.4",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
@@ -10,9 +10,6 @@
10
10
  "dist",
11
11
  "lib"
12
12
  ],
13
- "publishConfig": {
14
- "registry": "https://registry.npmjs.org/"
15
- },
16
13
  "scripts": {
17
14
  "dev": "vite",
18
15
  "dev_expose": "vite --host",
@@ -45,8 +42,8 @@
45
42
  "@floating-ui/react-dom": "^2.1.2"
46
43
  },
47
44
  "peerDependencies": {
48
- "react": "^18.0.0 || ^19.0.0",
49
- "react-dom": "^18.0.0 || ^19.0.0"
45
+ "react": "^19.0.0",
46
+ "react-dom": "^19.0.0"
50
47
  },
51
48
  "devDependencies": {
52
49
  "@azure/msal-browser": "^4.7.0",
@@ -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,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,300 +0,0 @@
1
- // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
-
3
- exports[`Field > Snapshot: Default (no children) 1`] = `
4
- <div
5
- class="ucl-uikit-field css-1wirz7t"
6
- data-testid="ucl-uikit-field"
7
- />
8
- `;
9
-
10
- exports[`Field > Snapshot: Field.ErrorText alone 1`] = `null`;
11
-
12
- exports[`Field > Snapshot: Field.HelperText alone 1`] = `
13
- <div
14
- class="ucl-uikit-field__helper-text css-1m34d18"
15
- data-testid="ucl-uikit-field__helper-text"
16
- >
17
- Helper text
18
- </div>
19
- `;
20
-
21
- exports[`Field > Snapshot: With Label, HelperText, ErrorText, Input 1`] = `
22
- <div
23
- class="ucl-uikit-field css-1wirz7t"
24
- data-testid="ucl-uikit-field"
25
- >
26
- <label
27
- class="ucl-uikit-label css-v576g6"
28
- data-testid="ucl-uikit-label"
29
- for="«r2»"
30
- >
31
- Name
32
- </label>
33
- <div
34
- class="ucl-uikit-field__helper-text css-1m34d18"
35
- data-testid="ucl-uikit-field__helper-text"
36
- >
37
- Helper text
38
- </div>
39
- <span
40
- class="ucl-uikit-input css-1bpb1dw"
41
- >
42
- <input
43
- class="ucl-uikit-input__input css-1nizqet"
44
- data-testid="ucl-uikit-input"
45
- id="«r2»"
46
- />
47
- </span>
48
- </div>
49
- `;
50
-
51
- exports[`Field > Snapshot: With Label, HelperText, ErrorText, Input, & prop disabled 1`] = `
52
- <div
53
- class="ucl-uikit-field css-1wirz7t"
54
- data-testid="ucl-uikit-field"
55
- >
56
- <label
57
- class="ucl-uikit-label css-2pe9mc"
58
- data-testid="ucl-uikit-label"
59
- for="«r3»"
60
- >
61
- Name
62
- </label>
63
- <div
64
- class="ucl-uikit-field__helper-text css-k4nfij"
65
- data-testid="ucl-uikit-field__helper-text"
66
- >
67
- Helper text
68
- </div>
69
- <span
70
- class="ucl-uikit-input css-1bpb1dw"
71
- >
72
- <input
73
- class="ucl-uikit-input__input css-mfikdl"
74
- data-testid="ucl-uikit-input"
75
- disabled=""
76
- id="«r3»"
77
- />
78
- </span>
79
- </div>
80
- `;
81
-
82
- exports[`Field > Snapshot: With Label, HelperText, ErrorText, Input, & prop error 1`] = `
83
- <div
84
- class="ucl-uikit-field css-ar7o8y"
85
- data-testid="ucl-uikit-field"
86
- >
87
- <label
88
- class="ucl-uikit-label css-v576g6"
89
- data-testid="ucl-uikit-label"
90
- for="«r4»"
91
- >
92
- Name
93
- </label>
94
- <div
95
- class="ucl-uikit-field__helper-text css-1m34d18"
96
- data-testid="ucl-uikit-field__helper-text"
97
- >
98
- Helper text
99
- </div>
100
- <div
101
- class="ucl-uikit-field__error-text css-1puiun"
102
- data-testid="ucl-uikit-field__error-text"
103
- >
104
- <svg
105
- class="ucl-uikit-icon css-q9euyk"
106
- data-testid="ucl-uikit-icon"
107
- fill="none"
108
- height="24"
109
- stroke="currentColor"
110
- stroke-linecap="round"
111
- stroke-linejoin="round"
112
- stroke-width="2"
113
- viewBox="0 0 24 24"
114
- width="24"
115
- xmlns="http://www.w3.org/2000/svg"
116
- >
117
- <circle
118
- cx="12"
119
- cy="12"
120
- r="10"
121
- />
122
- <line
123
- x1="12"
124
- x2="12"
125
- y1="16"
126
- y2="12"
127
- />
128
- <line
129
- x1="12"
130
- x2="12.01"
131
- y1="8"
132
- y2="8"
133
- />
134
- </svg>
135
- Error text
136
- </div>
137
- <span
138
- class="ucl-uikit-input css-1bpb1dw"
139
- >
140
- <input
141
- class="ucl-uikit-input__input css-1nizqet"
142
- data-testid="ucl-uikit-input"
143
- id="«r4»"
144
- />
145
- </span>
146
- </div>
147
- `;
148
-
149
- exports[`Field > Snapshot: With Label, HelperText, ErrorText, Input, & prop optional 1`] = `
150
- <div
151
- class="ucl-uikit-field css-1wirz7t"
152
- data-testid="ucl-uikit-field"
153
- >
154
- <label
155
- class="ucl-uikit-label css-v576g6"
156
- data-testid="ucl-uikit-label"
157
- for="«r5»"
158
- >
159
- Name
160
- <span
161
- class="css-1fd72bb"
162
- >
163
- (optional)
164
- </span>
165
- </label>
166
- <div
167
- class="ucl-uikit-field__helper-text css-1m34d18"
168
- data-testid="ucl-uikit-field__helper-text"
169
- >
170
- Helper text
171
- </div>
172
- <span
173
- class="ucl-uikit-input css-1bpb1dw"
174
- >
175
- <input
176
- class="ucl-uikit-input__input css-1nizqet"
177
- data-testid="ucl-uikit-input"
178
- id="«r5»"
179
- />
180
- </span>
181
- </div>
182
- `;
183
-
184
- exports[`Field > Snapshot: With Label, HelperText, ErrorText, Textarea 1`] = `
185
- <div
186
- class="ucl-uikit-field css-1wirz7t"
187
- data-testid="ucl-uikit-field"
188
- >
189
- <label
190
- class="ucl-uikit-label css-v576g6"
191
- data-testid="ucl-uikit-label"
192
- for="«r7»"
193
- >
194
- Name
195
- </label>
196
- <div
197
- class="ucl-uikit-field__helper-text css-1m34d18"
198
- data-testid="ucl-uikit-field__helper-text"
199
- >
200
- Helper text
201
- </div>
202
- <textarea
203
- class="ucl-uikit-textarea css-19nnvor"
204
- data-testid="ucl-uikit-textarea"
205
- id="«r7»"
206
- />
207
- </div>
208
- `;
209
-
210
- exports[`Field > Snapshot: With Label, HelperText, ErrorText, Textarea, & prop disabled 1`] = `
211
- <div
212
- class="ucl-uikit-field css-1wirz7t"
213
- data-testid="ucl-uikit-field"
214
- >
215
- <label
216
- class="ucl-uikit-label css-2pe9mc"
217
- data-testid="ucl-uikit-label"
218
- for="«r8»"
219
- >
220
- Name
221
- </label>
222
- <div
223
- class="ucl-uikit-field__helper-text css-k4nfij"
224
- data-testid="ucl-uikit-field__helper-text"
225
- >
226
- Helper text
227
- </div>
228
- <textarea
229
- class="ucl-uikit-textarea css-1o8pbxe"
230
- data-testid="ucl-uikit-textarea"
231
- disabled=""
232
- id="«r8»"
233
- />
234
- </div>
235
- `;
236
-
237
- exports[`Field > Snapshot: With Label, Input 1`] = `
238
- <div
239
- class="ucl-uikit-field css-1wirz7t"
240
- data-testid="ucl-uikit-field"
241
- >
242
- <label
243
- class="ucl-uikit-label css-v576g6"
244
- data-testid="ucl-uikit-label"
245
- for="«r1»"
246
- >
247
- Name
248
- </label>
249
- <span
250
- class="ucl-uikit-input css-1bpb1dw"
251
- >
252
- <input
253
- class="ucl-uikit-input__input css-1nizqet"
254
- data-testid="ucl-uikit-input"
255
- id="«r1»"
256
- />
257
- </span>
258
- </div>
259
- `;
260
-
261
- exports[`Field > Snapshot: With Label, Textarea 1`] = `
262
- <div
263
- class="ucl-uikit-field css-1wirz7t"
264
- data-testid="ucl-uikit-field"
265
- >
266
- <label
267
- class="ucl-uikit-label css-v576g6"
268
- data-testid="ucl-uikit-label"
269
- for="«r6»"
270
- >
271
- Name
272
- </label>
273
- <textarea
274
- class="ucl-uikit-textarea css-19nnvor"
275
- data-testid="ucl-uikit-textarea"
276
- id="«r6»"
277
- />
278
- </div>
279
- `;
280
-
281
- exports[`Field > Snapshot: With Textarea & prop maxChar 1`] = `
282
- <div
283
- class="ucl-uikit-field css-1wirz7t"
284
- data-testid="ucl-uikit-field"
285
- >
286
- <textarea
287
- class="ucl-uikit-textarea css-19nnvor"
288
- data-testid="ucl-uikit-textarea"
289
- id="«r9»"
290
- />
291
- <div
292
- class="ucl-uikit-field__char-count css-1ma0lts"
293
- data-testid="ucl-uikit-field__char-count"
294
- >
295
- 0
296
- /
297
- 100
298
- </div>
299
- </div>
300
- `;