codeforlife 2.8.2 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (364) hide show
  1. package/dist/Countdown-DFI1RljW.js +28 -0
  2. package/dist/Countdown-DFI1RljW.js.map +1 -0
  3. package/dist/Countdown-zY3nMzmi.cjs +2 -0
  4. package/dist/Countdown-zY3nMzmi.cjs.map +1 -0
  5. package/dist/Image-D5jC9UoX.js +21 -0
  6. package/dist/Image-D5jC9UoX.js.map +1 -0
  7. package/dist/Image-mgT45r_B.cjs +2 -0
  8. package/dist/Image-mgT45r_B.cjs.map +1 -0
  9. package/dist/LinkButton-BYFkvL_O.cjs +2 -0
  10. package/dist/LinkButton-BYFkvL_O.cjs.map +1 -0
  11. package/dist/LinkButton-oK0RThqn.js +12 -0
  12. package/dist/LinkButton-oK0RThqn.js.map +1 -0
  13. package/dist/Navigate-Dq47aqC8.js +25 -0
  14. package/dist/Navigate-Dq47aqC8.js.map +1 -0
  15. package/dist/Navigate-dQocLhzN.cjs +2 -0
  16. package/dist/Navigate-dQocLhzN.cjs.map +1 -0
  17. package/dist/api/endpoints/index.cjs.js +2 -0
  18. package/dist/api/endpoints/index.cjs.js.map +1 -0
  19. package/dist/api/endpoints/index.d.ts +81 -0
  20. package/dist/api/endpoints/index.es.js +78 -0
  21. package/dist/api/endpoints/index.es.js.map +1 -0
  22. package/dist/api/index.cjs.js +4 -0
  23. package/dist/api/index.cjs.js.map +1 -0
  24. package/dist/api/index.d.ts +77 -0
  25. package/dist/api/index.es.js +541 -0
  26. package/dist/api/index.es.js.map +1 -0
  27. package/dist/api-Cbyt3rw0.js +92 -0
  28. package/dist/api-Cbyt3rw0.js.map +1 -0
  29. package/dist/api-CnMfjRk3.cjs +2 -0
  30. package/dist/api-CnMfjRk3.cjs.map +1 -0
  31. package/dist/api-Cs4Y-WeI.js +20 -0
  32. package/dist/api-Cs4Y-WeI.js.map +1 -0
  33. package/dist/api-DIgp_6Vr.cjs +2 -0
  34. package/dist/api-DIgp_6Vr.cjs.map +1 -0
  35. package/dist/api.d.ts +123 -0
  36. package/dist/auth-BPfUPjmM.js +237 -0
  37. package/dist/auth-BPfUPjmM.js.map +1 -0
  38. package/dist/auth-Vf1MgMci.cjs +2 -0
  39. package/dist/auth-Vf1MgMci.cjs.map +1 -0
  40. package/dist/auth.d.ts +40 -0
  41. package/dist/components/form/index.cjs.js +2 -0
  42. package/dist/components/form/index.cjs.js.map +1 -0
  43. package/dist/components/form/index.d.ts +86 -0
  44. package/dist/components/form/index.es.js +18 -0
  45. package/dist/components/form/index.es.js.map +1 -0
  46. package/dist/components/index.cjs.js +11 -0
  47. package/dist/components/index.cjs.js.map +1 -0
  48. package/dist/components/index.d.ts +90 -0
  49. package/dist/components/index.es.js +383 -0
  50. package/dist/components/index.es.js.map +1 -0
  51. package/dist/components/page/index.cjs.js +2 -0
  52. package/dist/components/page/index.cjs.js.map +1 -0
  53. package/dist/components/page/index.d.ts +77 -0
  54. package/dist/components/page/index.es.js +9 -0
  55. package/dist/components/page/index.es.js.map +1 -0
  56. package/dist/components/router/index.cjs.js +2 -0
  57. package/dist/components/router/index.cjs.js.map +1 -0
  58. package/dist/components/router/index.d.ts +78 -0
  59. package/dist/components/router/index.es.js +11 -0
  60. package/dist/components/router/index.es.js.map +1 -0
  61. package/dist/components/table/index.cjs.js +2 -0
  62. package/dist/components/table/index.cjs.js.map +1 -0
  63. package/dist/components/table/index.d.ts +75 -0
  64. package/dist/components/table/index.es.js +9 -0
  65. package/dist/components/table/index.es.js.map +1 -0
  66. package/dist/en-gb-B_rK7Jx1.js +20 -0
  67. package/dist/en-gb-B_rK7Jx1.js.map +1 -0
  68. package/dist/en-gb-CpyEkKq3.cjs +2 -0
  69. package/dist/en-gb-CpyEkKq3.cjs.map +1 -0
  70. package/dist/features/index.cjs.js +2 -0
  71. package/dist/features/index.cjs.js.map +1 -0
  72. package/dist/features/index.d.ts +76 -0
  73. package/dist/features/index.es.js +47 -0
  74. package/dist/features/index.es.js.map +1 -0
  75. package/dist/form.d.ts +40 -0
  76. package/dist/general-BPbbmkeX.cjs +2 -0
  77. package/dist/general-BPbbmkeX.cjs.map +1 -0
  78. package/dist/general-CtTJPCJn.js +58 -0
  79. package/dist/general-CtTJPCJn.js.map +1 -0
  80. package/dist/general.d.ts +53 -0
  81. package/dist/hooks/index.cjs.js +2 -0
  82. package/dist/hooks/index.cjs.js.map +1 -0
  83. package/dist/hooks/index.d.ts +77 -0
  84. package/dist/hooks/index.es.js +25 -0
  85. package/dist/hooks/index.es.js.map +1 -0
  86. package/dist/index-2W--_sNE.js +30 -0
  87. package/dist/index-2W--_sNE.js.map +1 -0
  88. package/dist/index-BUMdUVBH.cjs +5 -0
  89. package/dist/index-BUMdUVBH.cjs.map +1 -0
  90. package/dist/index-B_Zy_zwA.cjs +2 -0
  91. package/dist/index-B_Zy_zwA.cjs.map +1 -0
  92. package/dist/index-BgsynEGX.cjs +2 -0
  93. package/dist/index-BgsynEGX.cjs.map +1 -0
  94. package/dist/index-CA-ugBSa.cjs +2 -0
  95. package/dist/index-CA-ugBSa.cjs.map +1 -0
  96. package/dist/index-CNtOlJ49.js +572 -0
  97. package/dist/index-CNtOlJ49.js.map +1 -0
  98. package/dist/index-DkM_cG3a.js +237 -0
  99. package/dist/index-DkM_cG3a.js.map +1 -0
  100. package/dist/index-Dqp7dpn3.js +1111 -0
  101. package/dist/index-Dqp7dpn3.js.map +1 -0
  102. package/dist/index.cjs.js +2 -0
  103. package/dist/index.cjs.js.map +1 -0
  104. package/dist/index.d.ts +78 -0
  105. package/dist/index.es.js +7 -0
  106. package/dist/index.es.js.map +1 -0
  107. package/dist/jsx-runtime-CeSfJrVB.cjs +31 -0
  108. package/dist/jsx-runtime-CeSfJrVB.cjs.map +1 -0
  109. package/dist/jsx-runtime-Dpn_P65e.js +634 -0
  110. package/dist/jsx-runtime-Dpn_P65e.js.map +1 -0
  111. package/dist/middlewares/index.cjs.js +2 -0
  112. package/dist/middlewares/index.cjs.js.map +1 -0
  113. package/dist/middlewares/index.d.ts +73 -0
  114. package/dist/middlewares/index.es.js +10 -0
  115. package/dist/middlewares/index.es.js.map +1 -0
  116. package/dist/palette-CE2mKYse.cjs +2 -0
  117. package/dist/palette-CE2mKYse.cjs.map +1 -0
  118. package/dist/palette-C_L0akN_.js +43 -0
  119. package/dist/palette-C_L0akN_.js.map +1 -0
  120. package/dist/router.d.ts +48 -0
  121. package/dist/rtk-query.modern-CjetfYPg.js +3038 -0
  122. package/dist/rtk-query.modern-CjetfYPg.js.map +1 -0
  123. package/dist/rtk-query.modern-PBCErCqb.cjs +15 -0
  124. package/dist/rtk-query.modern-PBCErCqb.cjs.map +1 -0
  125. package/dist/schema.d.ts +89 -0
  126. package/dist/schemas-BZbJpkD5.cjs +2 -0
  127. package/dist/schemas-BZbJpkD5.cjs.map +1 -0
  128. package/dist/schemas-DlOtf2vf.js +162 -0
  129. package/dist/schemas-DlOtf2vf.js.map +1 -0
  130. package/dist/server.cjs.js +6 -0
  131. package/dist/server.cjs.js.map +1 -0
  132. package/dist/server.d.ts +129 -0
  133. package/dist/server.es.js +127 -0
  134. package/dist/server.es.js.map +1 -0
  135. package/dist/session-CE2U7oL1.cjs +2 -0
  136. package/dist/session-CE2U7oL1.cjs.map +1 -0
  137. package/dist/session-CacrgFSv.cjs +2 -0
  138. package/dist/session-CacrgFSv.cjs.map +1 -0
  139. package/dist/session-D312kYKk.js +32 -0
  140. package/dist/session-D312kYKk.js.map +1 -0
  141. package/dist/session-oI-Ht2C8.js +30 -0
  142. package/dist/session-oI-Ht2C8.js.map +1 -0
  143. package/dist/settings/index.cjs.js +2 -0
  144. package/dist/settings/index.cjs.js.map +1 -0
  145. package/dist/settings/index.d.ts +76 -0
  146. package/dist/settings/index.es.js +17 -0
  147. package/dist/settings/index.es.js.map +1 -0
  148. package/dist/slices/index.cjs.js +2 -0
  149. package/dist/slices/index.cjs.js.map +1 -0
  150. package/dist/slices/index.d.ts +74 -0
  151. package/dist/slices/index.es.js +6 -0
  152. package/dist/slices/index.es.js.map +1 -0
  153. package/dist/store.d.ts +17 -0
  154. package/dist/style.css +1 -0
  155. package/dist/test.d.ts +75 -0
  156. package/dist/theme/components/index.cjs.js +2 -0
  157. package/dist/theme/components/index.cjs.js.map +1 -0
  158. package/dist/theme/components/index.d.ts +75 -0
  159. package/dist/theme/components/index.es.js +6 -0
  160. package/dist/theme/components/index.es.js.map +1 -0
  161. package/dist/theme/index.cjs.js +2 -0
  162. package/dist/theme/index.cjs.js.map +1 -0
  163. package/dist/theme/index.d.ts +79 -0
  164. package/dist/theme/index.es.js +222 -0
  165. package/dist/theme/index.es.js.map +1 -0
  166. package/dist/theme.d.ts +19 -0
  167. package/dist/urls-DtHr1d3H.js +14 -0
  168. package/dist/urls-DtHr1d3H.js.map +1 -0
  169. package/dist/urls-MaVXL_C2.cjs +2 -0
  170. package/dist/urls-MaVXL_C2.cjs.map +1 -0
  171. package/dist/utils/api.cjs.js +2 -0
  172. package/dist/utils/api.cjs.js.map +1 -0
  173. package/dist/utils/api.d.ts +144 -0
  174. package/dist/utils/api.es.js +16 -0
  175. package/dist/utils/api.es.js.map +1 -0
  176. package/dist/utils/auth.cjs.js +2 -0
  177. package/dist/utils/auth.cjs.js.map +1 -0
  178. package/dist/utils/auth.d.ts +100 -0
  179. package/dist/utils/auth.es.js +117 -0
  180. package/dist/utils/auth.es.js.map +1 -0
  181. package/dist/utils/form.cjs.js +2 -0
  182. package/dist/utils/form.cjs.js.map +1 -0
  183. package/dist/utils/form.d.ts +97 -0
  184. package/dist/utils/form.es.js +76 -0
  185. package/dist/utils/form.es.js.map +1 -0
  186. package/dist/utils/general.cjs.js +2 -0
  187. package/dist/utils/general.cjs.js.map +1 -0
  188. package/dist/utils/general.d.ts +102 -0
  189. package/{src/utils/general.ts → dist/utils/general.es.js} +87 -165
  190. package/dist/utils/general.es.js.map +1 -0
  191. package/dist/utils/router.cjs.js +2 -0
  192. package/dist/utils/router.cjs.js.map +1 -0
  193. package/dist/utils/router.d.ts +91 -0
  194. package/dist/utils/router.es.js +33 -0
  195. package/dist/utils/router.es.js.map +1 -0
  196. package/dist/utils/schema.cjs.js +2 -0
  197. package/dist/utils/schema.cjs.js.map +1 -0
  198. package/dist/utils/schema.d.ts +115 -0
  199. package/dist/utils/schema.es.js +123 -0
  200. package/dist/utils/schema.es.js.map +1 -0
  201. package/dist/utils/store.cjs.js +2 -0
  202. package/dist/utils/store.cjs.js.map +1 -0
  203. package/dist/utils/store.d.ts +82 -0
  204. package/dist/utils/store.es.js +20 -0
  205. package/dist/utils/store.es.js.map +1 -0
  206. package/dist/utils/test.cjs.js +2 -0
  207. package/dist/utils/test.cjs.js.map +1 -0
  208. package/dist/utils/test.d.ts +125 -0
  209. package/dist/utils/test.es.js +60 -0
  210. package/dist/utils/test.es.js.map +1 -0
  211. package/dist/utils/theme.cjs.js +2 -0
  212. package/dist/utils/theme.cjs.js.map +1 -0
  213. package/dist/utils/theme.d.ts +83 -0
  214. package/dist/utils/theme.es.js +12 -0
  215. package/dist/utils/theme.es.js.map +1 -0
  216. package/dist/utils/window.cjs.js +2 -0
  217. package/dist/utils/window.cjs.js.map +1 -0
  218. package/dist/utils/window.d.ts +74 -0
  219. package/dist/utils/window.es.js +11 -0
  220. package/dist/utils/window.es.js.map +1 -0
  221. package/dist/window.d.ts +5 -0
  222. package/package.json +142 -37
  223. package/.github/workflows/main.yml +0 -55
  224. package/.prettierignore +0 -1
  225. package/CHANGELOG.md +0 -2020
  226. package/CONTRIBUTING.md +0 -3
  227. package/eslint.config.js +0 -17
  228. package/src/api/createApi.ts +0 -91
  229. package/src/api/endpoints/authFactor.ts +0 -31
  230. package/src/api/endpoints/index.ts +0 -9
  231. package/src/api/endpoints/klass.ts +0 -87
  232. package/src/api/endpoints/school.ts +0 -34
  233. package/src/api/endpoints/session.ts +0 -47
  234. package/src/api/endpoints/user.ts +0 -70
  235. package/src/api/index.ts +0 -5
  236. package/src/api/models.ts +0 -145
  237. package/src/api/schemas.ts +0 -243
  238. package/src/api/tagTypes.ts +0 -12
  239. package/src/api/urls.ts +0 -13
  240. package/src/components/App.css +0 -38
  241. package/src/components/App.tsx +0 -152
  242. package/src/components/ClickableTooltip.tsx +0 -43
  243. package/src/components/CopyIconButton.test.tsx +0 -16
  244. package/src/components/CopyIconButton.tsx +0 -27
  245. package/src/components/Countdown.tsx +0 -42
  246. package/src/components/DownloadFileButton.tsx +0 -55
  247. package/src/components/ElevatedAppBar.tsx +0 -41
  248. package/src/components/Image.tsx +0 -41
  249. package/src/components/InputFileButton.tsx +0 -27
  250. package/src/components/ItemizedList.tsx +0 -61
  251. package/src/components/OrderedGrid.tsx +0 -92
  252. package/src/components/ScrollIntoViewLink.tsx +0 -22
  253. package/src/components/SyncError.tsx +0 -14
  254. package/src/components/TablePagination.tsx +0 -142
  255. package/src/components/YouTubeVideo.tsx +0 -26
  256. package/src/components/form/ApiAutocompleteField.tsx +0 -187
  257. package/src/components/form/AutocompleteField.tsx +0 -135
  258. package/src/components/form/CheckboxField.tsx +0 -86
  259. package/src/components/form/CountryField.tsx +0 -75
  260. package/src/components/form/DatePickerField.tsx +0 -126
  261. package/src/components/form/EmailField.tsx +0 -38
  262. package/src/components/form/FirstNameField.tsx +0 -40
  263. package/src/components/form/Form.tsx +0 -165
  264. package/src/components/form/OtpField.tsx +0 -28
  265. package/src/components/form/PasswordField.tsx +0 -71
  266. package/src/components/form/RepeatField.tsx +0 -123
  267. package/src/components/form/SubmitButton.tsx +0 -57
  268. package/src/components/form/TextField.tsx +0 -150
  269. package/src/components/form/UkCountyField.tsx +0 -68
  270. package/src/components/form/index.tsx +0 -35
  271. package/src/components/index.ts +0 -28
  272. package/src/components/page/Banner.tsx +0 -95
  273. package/src/components/page/Notification.tsx +0 -71
  274. package/src/components/page/Page.tsx +0 -73
  275. package/src/components/page/Section.tsx +0 -21
  276. package/src/components/page/TabBar.tsx +0 -131
  277. package/src/components/page/index.ts +0 -10
  278. package/src/components/router/Link.tsx +0 -23
  279. package/src/components/router/LinkButton.tsx +0 -22
  280. package/src/components/router/LinkIconButton.tsx +0 -22
  281. package/src/components/router/LinkListItem.tsx +0 -22
  282. package/src/components/router/LinkTab.tsx +0 -22
  283. package/src/components/router/Navigate.tsx +0 -33
  284. package/src/components/router/index.tsx +0 -9
  285. package/src/components/table/CellStack.tsx +0 -19
  286. package/src/components/table/Table.tsx +0 -55
  287. package/src/components/table/index.tsx +0 -8
  288. package/src/features/InactiveDialog.tsx +0 -40
  289. package/src/features/ScreenTimeDialog.tsx +0 -30
  290. package/src/features/index.ts +0 -4
  291. package/src/fonts/ttf/Inter-VariableFont_slnt,wght.ttf +0 -0
  292. package/src/fonts/ttf/SpaceGrotesk-VariableFont_wght.ttf +0 -0
  293. package/src/hooks/api.tsx +0 -39
  294. package/src/hooks/auth.tsx +0 -397
  295. package/src/hooks/form.tsx +0 -11
  296. package/src/hooks/general.tsx +0 -110
  297. package/src/hooks/index.ts +0 -5
  298. package/src/hooks/router.tsx +0 -168
  299. package/src/images/svg/brain.svg +0 -1
  300. package/src/index.ts +0 -2
  301. package/src/middlewares/index.ts +0 -1
  302. package/src/middlewares/session.ts +0 -21
  303. package/src/scripts/freshDesk.js +0 -473
  304. package/src/scripts/index.ts +0 -1
  305. package/src/server.js +0 -187
  306. package/src/settings/custom.ts +0 -22
  307. package/src/settings/index.ts +0 -7
  308. package/src/settings/vite.ts +0 -26
  309. package/src/setupTests.ts +0 -2
  310. package/src/slices/createSlice.ts +0 -8
  311. package/src/slices/index.ts +0 -2
  312. package/src/slices/session.ts +0 -32
  313. package/src/theme/ThemedBox.tsx +0 -265
  314. package/src/theme/colors.ts +0 -57
  315. package/src/theme/components/MuiAccordion.tsx +0 -13
  316. package/src/theme/components/MuiAutocomplete.tsx +0 -11
  317. package/src/theme/components/MuiButton.ts +0 -70
  318. package/src/theme/components/MuiCardActions.tsx +0 -12
  319. package/src/theme/components/MuiCheckbox.ts +0 -12
  320. package/src/theme/components/MuiContainer.ts +0 -19
  321. package/src/theme/components/MuiDialog.tsx +0 -16
  322. package/src/theme/components/MuiFormControlLabel.ts +0 -18
  323. package/src/theme/components/MuiFormHelperText.ts +0 -12
  324. package/src/theme/components/MuiGrid2.ts +0 -16
  325. package/src/theme/components/MuiInputBase.ts +0 -14
  326. package/src/theme/components/MuiLink.ts +0 -41
  327. package/src/theme/components/MuiList.ts +0 -12
  328. package/src/theme/components/MuiListItemText.ts +0 -18
  329. package/src/theme/components/MuiMenu.ts +0 -14
  330. package/src/theme/components/MuiMenuItem.ts +0 -15
  331. package/src/theme/components/MuiSelect.ts +0 -16
  332. package/src/theme/components/MuiTab.ts +0 -29
  333. package/src/theme/components/MuiTable.ts +0 -29
  334. package/src/theme/components/MuiTableBody.ts +0 -15
  335. package/src/theme/components/MuiTableHead.ts +0 -26
  336. package/src/theme/components/MuiTabs.ts +0 -26
  337. package/src/theme/components/MuiTextField.ts +0 -86
  338. package/src/theme/components/MuiToolbar.ts +0 -11
  339. package/src/theme/components/MuiTypography.ts +0 -12
  340. package/src/theme/components/_components.ts +0 -95
  341. package/src/theme/components/index.ts +0 -57
  342. package/src/theme/index.ts +0 -25
  343. package/src/theme/palette.ts +0 -98
  344. package/src/theme/spacing.ts +0 -8
  345. package/src/theme/typography.ts +0 -101
  346. package/src/utils/api.test.ts +0 -19
  347. package/src/utils/api.tsx +0 -339
  348. package/src/utils/auth.ts +0 -78
  349. package/src/utils/form.test.ts +0 -50
  350. package/src/utils/form.ts +0 -193
  351. package/src/utils/general.test.ts +0 -55
  352. package/src/utils/router.test.ts +0 -156
  353. package/src/utils/router.ts +0 -67
  354. package/src/utils/schema.ts +0 -290
  355. package/src/utils/store.ts +0 -31
  356. package/src/utils/test.tsx +0 -82
  357. package/src/utils/theme.tsx +0 -83
  358. package/src/utils/window.ts +0 -11
  359. package/src/vite-env.d.ts +0 -1
  360. package/tsconfig.app.json +0 -4
  361. package/tsconfig.json +0 -7
  362. package/tsconfig.node.json +0 -4
  363. package/types/fixes.d.ts +0 -18
  364. package/vite.config.ts +0 -23
@@ -1,290 +0,0 @@
1
- import {
2
- type AnyObject,
3
- type BooleanSchema,
4
- type DateSchema,
5
- type DefaultFromShape,
6
- type Flags,
7
- type InferType,
8
- type MakePartial,
9
- type NumberSchema,
10
- type ObjectSchema,
11
- type ObjectShape,
12
- type Schema,
13
- type StringSchema,
14
- type TypeFromShape,
15
- type ValidateOptions,
16
- ValidationError,
17
- number as YupNumber,
18
- string as YupString,
19
- } from "yup"
20
-
21
- export type _<T> = T extends {}
22
- ? {
23
- [k in keyof T]: T[k]
24
- }
25
- : T
26
-
27
- export type MakeKeysOptional<T> = T extends AnyObject ? _<MakePartial<T>> : T
28
-
29
- export type ObjectFromShape<Shape extends ObjectShape> = MakeKeysOptional<
30
- _<TypeFromShape<Shape, AnyObject>>
31
- >
32
-
33
- export type ObjectSchemaFromShape<Shape extends ObjectShape> = ObjectSchema<
34
- _<TypeFromShape<Shape, AnyObject>>,
35
- AnyObject,
36
- _<DefaultFromShape<Shape>>,
37
- ""
38
- >
39
-
40
- export type SchemaMap<
41
- TType,
42
- TContext = AnyObject,
43
- TDefault = any,
44
- TFlags extends Flags = "",
45
- > =
46
- NonNullable<TType> extends string
47
- ? StringSchema<
48
- // @ts-expect-error type is fine
49
- TType extends undefined ? TType | undefined : TType,
50
- TContext,
51
- TDefault,
52
- TFlags
53
- >
54
- : NonNullable<TType> extends number
55
- ? NumberSchema<
56
- // @ts-expect-error type is fine
57
- TType extends undefined ? TType | undefined : TType,
58
- TContext,
59
- TDefault,
60
- TFlags
61
- >
62
- : NonNullable<TType> extends boolean
63
- ? BooleanSchema<
64
- // @ts-expect-error type is fine
65
- TType extends undefined ? TType | undefined : TType,
66
- TContext,
67
- TDefault,
68
- TFlags
69
- >
70
- : NonNullable<TType> extends Date
71
- ? DateSchema<
72
- // @ts-expect-error type is fine
73
- TType extends undefined ? TType | undefined : TType,
74
- TContext,
75
- TDefault,
76
- TFlags
77
- >
78
- : NonNullable<TType> extends object
79
- ? ObjectSchema<
80
- // @ts-expect-error type is fine
81
- TType extends undefined ? TType | undefined : TType,
82
- TContext,
83
- TDefault,
84
- TFlags
85
- >
86
- : Schema<TType, TContext, TDefault, TFlags>
87
-
88
- export function numericId(schema: NumberSchema = YupNumber()) {
89
- return schema.min(1)
90
- }
91
-
92
- // -----------------------------------------------------------------------------
93
- // Limited Character Sets
94
- // -----------------------------------------------------------------------------
95
-
96
- export type MatchesCharSetOptions = Partial<{
97
- schema: StringSchema
98
- flags: string
99
- }>
100
-
101
- export function matchesCharSet(
102
- charSet: string,
103
- message: string,
104
- options: MatchesCharSetOptions = {},
105
- ) {
106
- const { schema = YupString(), flags } = options
107
-
108
- return schema.matches(new RegExp(`^[${charSet}]*$`, flags), message)
109
- }
110
-
111
- export type BuildCharSetOptions = MatchesCharSetOptions &
112
- Partial<{ spaces: boolean; specialChars: string }>
113
-
114
- export function buildCharSet(
115
- charSet: string,
116
- description: string,
117
- options: BuildCharSetOptions = {},
118
- ) {
119
- const { spaces = false, specialChars, ...matchesCharSetOptions } = options
120
-
121
- let message = `can only contain: ${description}`
122
-
123
- if (spaces) {
124
- charSet += " "
125
- message += ", spaces"
126
- }
127
- if (specialChars) {
128
- charSet += specialChars
129
- message += `, special characters (${specialChars})`
130
- }
131
-
132
- return matchesCharSet(charSet, message, matchesCharSetOptions)
133
- }
134
-
135
- export function buildUnicodeCharSet(
136
- charSet: string,
137
- description: string,
138
- options: BuildCharSetOptions = {},
139
- ) {
140
- let { flags = "u" } = options
141
-
142
- if (!flags.includes("u")) flags += "u"
143
-
144
- return buildCharSet(charSet, description, { ...options, flags })
145
- }
146
-
147
- export function asciiAlphaString(options?: BuildCharSetOptions) {
148
- return buildCharSet("a-zA-Z", "ASCII alpha characters (a-z, A-Z)", options)
149
- }
150
-
151
- export function lowercaseAsciiAlphaString(options?: BuildCharSetOptions) {
152
- return buildCharSet("a-z", "lowercase ASCII alpha characters (a-z)", options)
153
- }
154
-
155
- export function uppercaseAsciiAlphaString(options?: BuildCharSetOptions) {
156
- return buildCharSet("A-Z", "uppercase ASCII alpha characters (A-Z)", options)
157
- }
158
-
159
- export function asciiNumericString(options?: BuildCharSetOptions) {
160
- return buildCharSet("0-9", "ASCII numbers (0-9)", options)
161
- }
162
-
163
- export function asciiAlphanumericString(options?: BuildCharSetOptions) {
164
- return buildCharSet(
165
- "a-zA-Z0-9",
166
- "ASCII alphanumeric characters (a-z, A-Z, 0-9)",
167
- options,
168
- )
169
- }
170
-
171
- export function lowercaseAsciiAlphanumericString(
172
- options?: BuildCharSetOptions,
173
- ) {
174
- return buildCharSet(
175
- "a-z0-9",
176
- "lowercase ASCII alphanumeric characters (a-z, 0-9)",
177
- options,
178
- )
179
- }
180
-
181
- export function uppercaseAsciiAlphanumericString(
182
- options?: BuildCharSetOptions,
183
- ) {
184
- return buildCharSet(
185
- "A-Z0-9",
186
- "uppercase ASCII alphanumeric characters (A-Z, 0-9)",
187
- options,
188
- )
189
- }
190
-
191
- export function unicodeAlphaString(options?: BuildCharSetOptions) {
192
- return buildUnicodeCharSet("\\p{L}", "unicode alpha characters", options)
193
- }
194
-
195
- export function lowercaseUnicodeAlphaString(options?: BuildCharSetOptions) {
196
- return buildUnicodeCharSet(
197
- "\\p{Ll}",
198
- "lowercase unicode alpha characters",
199
- options,
200
- )
201
- }
202
-
203
- export function uppercaseUnicodeAlphaString(options?: BuildCharSetOptions) {
204
- return buildUnicodeCharSet(
205
- "\\p{Lu}",
206
- "uppercase unicode alpha characters",
207
- options,
208
- )
209
- }
210
-
211
- export function unicodeNumericString(options?: BuildCharSetOptions) {
212
- return buildUnicodeCharSet("\\p{N}", "unicode numbers", options)
213
- }
214
-
215
- export function unicodeAlphanumericString(options?: BuildCharSetOptions) {
216
- return buildUnicodeCharSet(
217
- "\\p{L}\\p{N}",
218
- "unicode alphanumeric characters",
219
- options,
220
- )
221
- }
222
-
223
- export function lowercaseUnicodeAlphanumericString(
224
- options?: BuildCharSetOptions,
225
- ) {
226
- return buildUnicodeCharSet(
227
- "\\p{Ll}\\p{N}",
228
- "lowercase unicode alphanumeric characters",
229
- options,
230
- )
231
- }
232
-
233
- export function uppercaseUnicodeAlphanumericString(
234
- options?: BuildCharSetOptions,
235
- ) {
236
- return buildUnicodeCharSet(
237
- "\\p{Lu}\\p{N}",
238
- "uppercase unicode alphanumeric characters",
239
- options,
240
- )
241
- }
242
-
243
- // -----------------------------------------------------------------------------
244
- // Try Validate Sync
245
- // -----------------------------------------------------------------------------
246
-
247
- export type TryValidateSyncOnErrorRT<S extends Schema> = InferType<S> | void
248
-
249
- export type TryValidateSyncRT<
250
- S extends Schema,
251
- OnErrorRT extends TryValidateSyncOnErrorRT<S>,
252
- > = OnErrorRT extends InferType<S> ? InferType<S> : InferType<S> | undefined
253
-
254
- export type TryValidateSyncOptions<
255
- S extends Schema,
256
- OnErrorRT extends TryValidateSyncOnErrorRT<S>,
257
- > = ValidateOptions & {
258
- onError?: (error: ValidationError) => OnErrorRT
259
- }
260
-
261
- export function tryValidateSync<S extends Schema>(
262
- value: any,
263
- schema: S,
264
- options?: ValidateOptions,
265
- ): InferType<S> | undefined
266
-
267
- export function tryValidateSync<
268
- S extends Schema,
269
- OnErrorRT extends TryValidateSyncOnErrorRT<S>,
270
- >(
271
- value: any,
272
- schema: S,
273
- options?: ValidateOptions & {
274
- onError: (error: ValidationError) => OnErrorRT
275
- },
276
- ): TryValidateSyncRT<S, OnErrorRT>
277
-
278
- export function tryValidateSync<
279
- S extends Schema,
280
- OnErrorRT extends TryValidateSyncOnErrorRT<S>,
281
- >(value: any, schema: S, options?: TryValidateSyncOptions<S, OnErrorRT>) {
282
- const { onError, ...validateOptions } = options || {}
283
-
284
- try {
285
- return schema.validateSync(value, validateOptions) as unknown
286
- } catch (error) {
287
- if (!(error instanceof ValidationError)) throw error
288
- else if (onError) return onError(error) as unknown
289
- }
290
- }
@@ -1,31 +0,0 @@
1
- import type { Middleware, Reducer } from "@reduxjs/toolkit"
2
- import { configureStore } from "@reduxjs/toolkit"
3
- import { setupListeners } from "@reduxjs/toolkit/query"
4
-
5
- // The store setup is wrapped in `makeStore` to allow reuse
6
- // when setting up tests that need the same store config
7
- export function makeStore<R extends Reducer>({
8
- reducer,
9
- middlewares = [],
10
- preloadedState = {},
11
- }: {
12
- reducer: R
13
- middlewares?: Middleware[]
14
- preloadedState?: Partial<ReturnType<R>>
15
- }) {
16
- const store = configureStore({
17
- reducer,
18
- // Adding the api middleware enables caching, invalidation, polling,
19
- // and other useful features of `rtk-query`.
20
- middleware: getDefaultMiddleware => {
21
- return getDefaultMiddleware().concat(middlewares)
22
- },
23
- preloadedState,
24
- })
25
-
26
- // configure listeners using the provided defaults
27
- // optional, but required for `refetchOnFocus`/`refetchOnReconnect` behaviors
28
- setupListeners(store.dispatch)
29
-
30
- return store
31
- }
@@ -1,82 +0,0 @@
1
- import type { Middleware, Reducer, Store } from "@reduxjs/toolkit"
2
- import type { PropsWithChildren, ReactElement } from "react"
3
- import { Provider } from "react-redux"
4
- import type { RenderOptions } from "@testing-library/react"
5
- import { render } from "@testing-library/react"
6
- import userEvent from "@testing-library/user-event"
7
-
8
- import { makeStore } from "./store"
9
-
10
- export function renderWithUser(
11
- ui: ReactElement,
12
- renderOptions: RenderOptions = {},
13
- ) {
14
- return {
15
- user: userEvent.setup(),
16
- ...render(ui, renderOptions),
17
- }
18
- }
19
-
20
- /**
21
- * Renders the given React element with Redux Provider and custom store.
22
- * This function is useful for testing components that are connected to the
23
- * Redux store.
24
- *
25
- * @param ui - The React component or element to render.
26
- * @param reducer - The root reducer to use for the store.
27
- * @param extendedRenderOptions - Optional configuration options for rendering.
28
- * This includes `preloadedState` for initial Redux state and `store` for a
29
- * specific Redux store instance. Any additional properties are passed to React
30
- * Testing Library's render function.
31
- * @returns An object containing the Redux store used in the render, User event
32
- * API for simulating user interactions in tests, and all of React Testing
33
- * Library's query functions for testing the component.
34
- */
35
- export function renderWithStore<R extends Reducer>(
36
- ui: ReactElement,
37
- reducer: R,
38
- extendedRenderOptions: RenderOptions & {
39
- /**
40
- * The middlewares used to create the Redux store.
41
- */
42
- middlewares?: Middleware[]
43
-
44
- /**
45
- * Defines a specific portion or the entire initial state for the Redux store.
46
- * This is particularly useful for initializing the state in a
47
- * controlled manner during testing, allowing components to be rendered
48
- * with predetermined state conditions.
49
- */
50
- preloadedState?: Partial<ReturnType<R>>
51
-
52
- /**
53
- * Allows the use of a specific Redux store instance instead of a
54
- * default or global store. This flexibility is beneficial when
55
- * testing components with unique store requirements or when isolating
56
- * tests from a global store state. The custom store should be configured
57
- * to match the structure and middleware of the store used by the application.
58
- *
59
- * @default makeStore({reducer,middlewares,preloadedState})
60
- */
61
- store?: Store
62
- } = {},
63
- ) {
64
- const {
65
- middlewares,
66
- preloadedState,
67
- // Automatically create a store instance if no store was passed in
68
- store = makeStore({ reducer, middlewares, preloadedState }),
69
- ...renderOptions
70
- } = extendedRenderOptions
71
-
72
- const Wrapper = ({ children }: PropsWithChildren) => (
73
- <Provider store={store}>{children}</Provider>
74
- )
75
-
76
- // Return an object with the store and all of RTL's query functions
77
- return {
78
- store,
79
- user: userEvent.setup(),
80
- ...render(ui, { wrapper: Wrapper, ...renderOptions }),
81
- }
82
- }
@@ -1,83 +0,0 @@
1
- import { Divider, type DividerProps, type ThemeOptions } from "@mui/material"
2
- import { type CommonProps } from "@mui/material/OverridableComponent"
3
- import { type ReactElement } from "react"
4
-
5
- import _components from "../theme/components"
6
-
7
- export function insertDividerBetweenElements({
8
- elements,
9
- dividerProps,
10
- }: {
11
- elements: ReactElement[]
12
- dividerProps?: DividerProps
13
- }): ReactElement[] {
14
- return elements.map((element, index) => (
15
- <>
16
- {element}
17
- {index !== elements.length - 1 ? (
18
- <Divider {...dividerProps} />
19
- ) : undefined}
20
- </>
21
- ))
22
- }
23
-
24
- export function getStyleOverrides(
25
- ownerState: CommonProps,
26
- componentKey: keyof NonNullable<ThemeOptions["components"]>,
27
- muiClassName: string = "root",
28
- components: ThemeOptions["components"] = _components,
29
- ): object {
30
- if (components !== undefined) {
31
- const component = components[componentKey]
32
-
33
- if (
34
- component !== undefined &&
35
- "styleOverrides" in component &&
36
- typeof component.styleOverrides === "object" &&
37
- muiClassName in component.styleOverrides
38
- ) {
39
- const muiClass = (component.styleOverrides as Record<string, any>)[
40
- muiClassName
41
- ] as object
42
-
43
- switch (typeof muiClass) {
44
- case "function":
45
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call
46
- return muiClass({ ownerState }) as object
47
- case "object":
48
- return muiClass
49
- }
50
- }
51
- }
52
-
53
- return {}
54
- }
55
-
56
- export function getClassNames(props: CommonProps): string[] {
57
- return props.className?.split(" ") ?? []
58
- }
59
-
60
- export function includesClassNames(
61
- propsOrClassNames: CommonProps | string[],
62
- includes: string[],
63
- ): boolean {
64
- const classNames = Array.isArray(propsOrClassNames)
65
- ? propsOrClassNames
66
- : getClassNames(propsOrClassNames)
67
-
68
- return includes.every(className => classNames.includes(className))
69
- }
70
-
71
- export function matchClassNames(
72
- propsOrClassNames: CommonProps | string[],
73
- pattern: string | RegExp,
74
- ): RegExpMatchArray[] {
75
- const classNames = Array.isArray(propsOrClassNames)
76
- ? propsOrClassNames
77
- : getClassNames(propsOrClassNames)
78
-
79
- return classNames
80
- .map(className => className.match(pattern))
81
- .filter(match => match !== null)
82
- .map(match => match)
83
- }
@@ -1,11 +0,0 @@
1
- export function configureFreshworksWidget(display: "open" | "hide"): void {
2
- // @ts-expect-error defined in external script
3
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call
4
- window.FreshworksWidget(display)
5
- }
6
-
7
- export function toggleOneTrustInfoDisplay(): void {
8
- // @ts-expect-error defined in external script
9
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
10
- window.Optanon.ToggleInfoDisplay()
11
- }
package/src/vite-env.d.ts DELETED
@@ -1 +0,0 @@
1
- /// <reference types="vite/client" />
package/tsconfig.app.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "extends": "../configs/frontend/tsconfig.app.json",
3
- "include": ["src"]
4
- }
package/tsconfig.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "files": [],
3
- "references": [
4
- { "path": "./tsconfig.app.json" },
5
- { "path": "./tsconfig.node.json" }
6
- ]
7
- }
@@ -1,4 +0,0 @@
1
- {
2
- "extends": "../configs/frontend/tsconfig.node.json",
3
- "include": ["vite.config.ts"]
4
- }
package/types/fixes.d.ts DELETED
@@ -1,18 +0,0 @@
1
- /*
2
- * Namespace 'React' has no exported member 'StatelessComponent'
3
- * in formik, react-mapbox-gl
4
- */
5
- declare namespace React {
6
- type StatelessComponent<P> = React.FunctionComponent<P>
7
- }
8
-
9
- declare module "*.svg" {
10
- const content: string
11
- export default content
12
- }
13
-
14
- /*
15
- * Don't care about the typings of external libraries.
16
- * All libraries without typings will be imported as `any`.
17
- */
18
- declare module "*" {}
package/vite.config.ts DELETED
@@ -1,23 +0,0 @@
1
- import { defineConfig } from "vitest/config"
2
- import react from "@vitejs/plugin-react"
3
-
4
- // https://vitejs.dev/config/
5
- // TODO: https://vite.dev/guide/build.html#library-mode
6
- // TODO: import common configs from src/vite.config.ts
7
- export default defineConfig({
8
- plugins: [react()],
9
- server: {
10
- open: true,
11
- },
12
- test: {
13
- globals: true,
14
- environment: "jsdom",
15
- setupFiles: "src/setupTests",
16
- mockReset: true,
17
- coverage: {
18
- enabled: true,
19
- provider: "istanbul",
20
- reporter: ["html", "cobertura"],
21
- },
22
- },
23
- })