codeforlife 2.7.2 → 2.8.1

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 (103) hide show
  1. package/.github/workflows/main.yml +0 -3
  2. package/CHANGELOG.md +14 -0
  3. package/eslint.config.js +17 -0
  4. package/package.json +45 -24
  5. package/src/api/createApi.ts +4 -4
  6. package/src/api/endpoints/authFactor.ts +2 -2
  7. package/src/api/endpoints/klass.ts +8 -8
  8. package/src/api/endpoints/school.ts +2 -2
  9. package/src/api/endpoints/session.ts +2 -1
  10. package/src/api/endpoints/user.ts +3 -3
  11. package/src/api/models.ts +1 -1
  12. package/src/api/schemas.ts +16 -16
  13. package/src/components/App.css +2 -2
  14. package/src/components/App.tsx +7 -5
  15. package/src/components/CopyIconButton.test.tsx +1 -1
  16. package/src/components/CopyIconButton.tsx +2 -2
  17. package/src/components/Countdown.tsx +3 -3
  18. package/src/components/DownloadFileButton.tsx +2 -1
  19. package/src/components/ElevatedAppBar.tsx +5 -5
  20. package/src/components/Image.tsx +7 -7
  21. package/src/components/InputFileButton.tsx +2 -2
  22. package/src/components/ItemizedList.tsx +4 -4
  23. package/src/components/OrderedGrid.tsx +3 -3
  24. package/src/components/ScrollIntoViewLink.tsx +1 -2
  25. package/src/components/SyncError.tsx +1 -1
  26. package/src/components/TablePagination.tsx +19 -9
  27. package/src/components/YouTubeVideo.tsx +2 -2
  28. package/src/components/form/ApiAutocompleteField.tsx +48 -41
  29. package/src/components/form/AutocompleteField.tsx +22 -11
  30. package/src/components/form/CheckboxField.tsx +14 -9
  31. package/src/components/form/CountryField.tsx +5 -4
  32. package/src/components/form/DatePickerField.tsx +18 -11
  33. package/src/components/form/EmailField.tsx +1 -1
  34. package/src/components/form/FirstNameField.tsx +2 -2
  35. package/src/components/form/Form.tsx +13 -12
  36. package/src/components/form/PasswordField.tsx +2 -2
  37. package/src/components/form/RepeatField.tsx +18 -10
  38. package/src/components/form/SubmitButton.tsx +14 -10
  39. package/src/components/form/TextField.tsx +17 -11
  40. package/src/components/form/UkCountyField.tsx +3 -2
  41. package/src/components/form/index.tsx +35 -28
  42. package/src/components/page/Banner.tsx +3 -3
  43. package/src/components/page/Notification.tsx +3 -3
  44. package/src/components/page/Page.tsx +5 -5
  45. package/src/components/page/Section.tsx +1 -1
  46. package/src/components/page/TabBar.tsx +5 -5
  47. package/src/components/router/Link.tsx +2 -1
  48. package/src/components/router/LinkButton.tsx +1 -0
  49. package/src/components/router/LinkIconButton.tsx +1 -0
  50. package/src/components/router/LinkListItem.tsx +1 -0
  51. package/src/components/router/LinkTab.tsx +1 -0
  52. package/src/components/router/Navigate.tsx +2 -2
  53. package/src/components/router/index.tsx +9 -12
  54. package/src/components/table/CellStack.tsx +2 -2
  55. package/src/components/table/index.tsx +2 -4
  56. package/src/features/InactiveDialog.tsx +2 -2
  57. package/src/features/ScreenTimeDialog.tsx +3 -6
  58. package/src/hooks/api.tsx +4 -2
  59. package/src/hooks/auth.tsx +14 -12
  60. package/src/hooks/{general.ts → general.tsx} +3 -3
  61. package/src/hooks/router.tsx +9 -9
  62. package/src/middlewares/session.ts +15 -10
  63. package/src/settings/index.ts +3 -6
  64. package/src/setupTests.ts +1 -0
  65. package/src/theme/ThemedBox.tsx +9 -9
  66. package/src/theme/components/MuiButton.ts +1 -1
  67. package/src/theme/components/MuiCardActions.tsx +1 -1
  68. package/src/theme/components/MuiContainer.ts +1 -1
  69. package/src/theme/components/MuiFormControlLabel.ts +1 -1
  70. package/src/theme/components/MuiFormHelperText.ts +1 -1
  71. package/src/theme/components/MuiInputBase.ts +1 -1
  72. package/src/theme/components/MuiLink.ts +1 -1
  73. package/src/theme/components/MuiListItemText.ts +1 -1
  74. package/src/theme/components/MuiMenuItem.ts +1 -1
  75. package/src/theme/components/MuiSelect.ts +2 -2
  76. package/src/theme/components/MuiTable.ts +1 -1
  77. package/src/theme/components/MuiTableBody.ts +1 -1
  78. package/src/theme/components/MuiTableHead.ts +2 -2
  79. package/src/theme/components/MuiTextField.ts +3 -3
  80. package/src/theme/components/_components.ts +4 -2
  81. package/src/theme/palette.ts +2 -2
  82. package/src/theme/typography.ts +1 -1
  83. package/src/utils/api.tsx +6 -4
  84. package/src/utils/auth.ts +1 -1
  85. package/src/utils/form.test.ts +1 -1
  86. package/src/utils/form.ts +14 -9
  87. package/src/utils/general.test.ts +7 -7
  88. package/src/utils/general.ts +10 -12
  89. package/src/utils/router.test.ts +1 -1
  90. package/src/utils/router.ts +2 -2
  91. package/src/utils/schema.ts +11 -11
  92. package/src/utils/test.tsx +2 -2
  93. package/src/utils/theme.tsx +7 -6
  94. package/src/utils/window.ts +2 -0
  95. package/tsconfig.app.json +4 -0
  96. package/tsconfig.json +4 -28
  97. package/tsconfig.node.json +3 -10
  98. package/vite.config.ts +1 -1
  99. package/.eslintrc.json +0 -47
  100. package/src/vite.config.ts +0 -49
  101. /package/src/fonts/{Inter-VariableFont_slnt,wght.ttf → ttf/Inter-VariableFont_slnt,wght.ttf} +0 -0
  102. /package/src/fonts/{SpaceGrotesk-VariableFont_wght.ttf → ttf/SpaceGrotesk-VariableFont_wght.ttf} +0 -0
  103. /package/src/{public/images → images/svg}/brain.svg +0 -0
@@ -1,10 +1,10 @@
1
1
  import { Stack, Typography } from "@mui/material"
2
2
 
3
+ import Image, { type ImageProps } from "../Image"
3
4
  import { LinkButton, type LinkButtonProps } from "../router"
4
5
  import { primary, secondary, tertiary } from "../../theme/colors"
5
- import palette from "../../theme/palette"
6
- import Image, { type ImageProps } from "../Image"
7
6
  import Section from "./Section"
7
+ import palette from "../../theme/palette"
8
8
 
9
9
  export interface BannerProps<
10
10
  Button1State extends Record<string, any> = Record<string, any>,
@@ -32,7 +32,7 @@ const Banner = <
32
32
  bgcolor = "primary",
33
33
  }: BannerProps<Button1State, Button2State>) => {
34
34
  // @ts-expect-error guaranteed to be in palette
35
- const contrastText = palette[bgcolor].contrastText
35
+ const contrastText = palette[bgcolor].contrastText as string
36
36
 
37
37
  return (
38
38
  <Section
@@ -3,11 +3,11 @@ import {
3
3
  ErrorOutline as ErrorOutlineIcon,
4
4
  InfoOutlined as InfoOutlinedIcon,
5
5
  } from "@mui/icons-material"
6
+ import { type FC, type ReactNode, useEffect, useState } from "react"
6
7
  import { IconButton, Stack, Typography } from "@mui/material"
7
- import { useEffect, useState, type FC, type ReactNode } from "react"
8
8
 
9
- import palette from "../../theme/palette"
10
9
  import Section from "./Section"
10
+ import palette from "../../theme/palette"
11
11
 
12
12
  export interface NotificationProps {
13
13
  open?: boolean
@@ -33,7 +33,7 @@ const Notification: FC<NotificationProps> = ({
33
33
  if (!_open) return <></>
34
34
 
35
35
  // @ts-expect-error guaranteed to be in palette
36
- const contrastText = palette[bgcolor].contrastText
36
+ const contrastText = palette[bgcolor].contrastText as string
37
37
 
38
38
  return (
39
39
  <Section
@@ -1,14 +1,14 @@
1
- import { Children, useEffect } from "react"
2
- import { useLocation, type Location } from "react-router-dom"
1
+ import { Children, type JSX, useEffect } from "react"
2
+ import { type Location, useLocation } from "react-router-dom"
3
3
 
4
+ import Notification, { type NotificationProps } from "./Notification"
4
5
  import {
5
- useSession,
6
6
  type SessionMetadata,
7
7
  type UseSessionChildren,
8
8
  type UseSessionChildrenFunction,
9
9
  type UseSessionOptions,
10
+ useSession,
10
11
  } from "../../hooks/auth"
11
- import Notification, { type NotificationProps } from "./Notification"
12
12
 
13
13
  export type PageState = {
14
14
  notifications: Array<{
@@ -54,7 +54,7 @@ const Page = <
54
54
  const childrenArray = Children.toArray(children)
55
55
 
56
56
  notifications.forEach((notification, index) => {
57
- childrenArray.splice(
57
+ void childrenArray.splice(
58
58
  notification.index ?? index,
59
59
  0,
60
60
  <Notification {...notification.props} />,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Box,
3
- Container,
4
3
  type BoxProps,
4
+ Container,
5
5
  type ContainerProps,
6
6
  } from "@mui/material"
7
7
  import type { FC } from "react"
@@ -2,20 +2,20 @@ import {
2
2
  ChevronLeft as ChevronLeftIcon,
3
3
  ChevronRight as ChevronRightIcon,
4
4
  } from "@mui/icons-material"
5
+ import { type FC, type ReactNode, useEffect, useState } from "react"
5
6
  import {
6
7
  IconButton,
7
8
  Tab,
9
+ type TabScrollButtonProps,
8
10
  Tabs,
9
11
  Typography,
10
- type TabScrollButtonProps,
11
12
  } from "@mui/material"
12
- import { useEffect, useState, type FC, type ReactNode } from "react"
13
- import { generatePath, useNavigate, useParams } from "react-router-dom"
14
13
  import { object as YupObject, string as YupString } from "yup"
14
+ import { generatePath, useNavigate, useParams } from "react-router-dom"
15
15
 
16
+ import Section from "./Section"
16
17
  import { primary } from "../../theme/colors"
17
18
  import { tryValidateSync } from "../../utils/schema"
18
- import Section from "./Section"
19
19
 
20
20
  export interface TabBarProps {
21
21
  header: string
@@ -79,7 +79,7 @@ const TabBar: FC<TabBarProps> = ({ header, tabs, originalPath, value = 0 }) => {
79
79
  >
80
80
  <Tabs
81
81
  value={_value}
82
- onChange={(_, value) => {
82
+ onChange={(_, value: number) => {
83
83
  navigate(
84
84
  generatePath(originalPath, {
85
85
  tab: paths[value],
@@ -1,4 +1,5 @@
1
1
  import { Link as MuiLink, type LinkProps as MuiLinkProps } from "@mui/material"
2
+ import { type JSX } from "react"
2
3
  import { Link as RouterLink } from "react-router-dom"
3
4
 
4
5
  import { type LinkProps as RouterLinkProps } from "../../utils/router"
@@ -15,7 +16,7 @@ const Link: {
15
16
  props: LinkProps<"to", State>,
16
17
  ): JSX.Element
17
18
  } = (props: LinkProps<"delta"> | LinkProps<"to">) => {
18
- // @ts-expect-error
19
+ // @ts-expect-error props are assignable
19
20
  return <MuiLink component={RouterLink} {...props} />
20
21
  }
21
22
 
@@ -1,4 +1,5 @@
1
1
  import { Button, type ButtonProps } from "@mui/material"
2
+ import { type JSX } from "react"
2
3
  import { Link } from "react-router-dom"
3
4
 
4
5
  import { type LinkProps } from "../../utils/router"
@@ -1,4 +1,5 @@
1
1
  import { IconButton, type IconButtonProps } from "@mui/material"
2
+ import { type JSX } from "react"
2
3
  import { Link } from "react-router-dom"
3
4
 
4
5
  import { type LinkProps } from "../../utils/router"
@@ -1,4 +1,5 @@
1
1
  import { ListItem, type ListItemProps } from "@mui/material"
2
+ import { type JSX } from "react"
2
3
  import { Link } from "react-router-dom"
3
4
 
4
5
  import { type LinkProps } from "../../utils/router"
@@ -1,4 +1,5 @@
1
1
  import { Tab, type TabProps } from "@mui/material"
2
+ import { type JSX } from "react"
2
3
  import { Link } from "react-router-dom"
3
4
 
4
5
  import { type LinkProps } from "../../utils/router"
@@ -1,7 +1,7 @@
1
- import { useEffect } from "react"
1
+ import { type JSX, useEffect } from "react"
2
2
  import { type To } from "react-router-dom"
3
3
 
4
- import { useNavigate, type NavigateOptions } from "../../hooks"
4
+ import { type NavigateOptions, useNavigate } from "../../hooks"
5
5
 
6
6
  export type NavigateProps<
7
7
  Override extends "delta" | "to",
@@ -1,12 +1,9 @@
1
- export * from "./Link"
2
- export { default as Link } from "./Link"
3
- export * from "./LinkButton"
4
- export { default as LinkButton } from "./LinkButton"
5
- export * from "./LinkIconButton"
6
- export { default as LinkIconButton } from "./LinkIconButton"
7
- export * from "./LinkListItem"
8
- export { default as LinkListItem } from "./LinkListItem"
9
- export * from "./LinkTab"
10
- export { default as LinkTab } from "./LinkTab"
11
- export * from "./Navigate"
12
- export { default as Navigate } from "./Navigate"
1
+ export { default as Link, type LinkProps } from "./Link"
2
+ export { default as LinkButton, type LinkButtonProps } from "./LinkButton"
3
+ export {
4
+ default as LinkIconButton,
5
+ type LinkIconButtonProps,
6
+ } from "./LinkIconButton"
7
+ export { default as LinkListItem, type LinkListItemProps } from "./LinkListItem"
8
+ export { default as LinkTab, type LinkTabProps } from "./LinkTab"
9
+ export { default as Navigate, type NavigateProps } from "./Navigate"
@@ -1,10 +1,10 @@
1
- import { type FC } from "react"
2
1
  import {
3
2
  Stack,
3
+ type StackProps,
4
4
  TableCell,
5
5
  type TableCellProps,
6
- type StackProps,
7
6
  } from "@mui/material"
7
+ import { type FC } from "react"
8
8
 
9
9
  export interface CellStackProps extends StackProps {
10
10
  cellProps?: TableCellProps
@@ -1,7 +1,5 @@
1
- export { default as Table } from "./Table"
2
- export * from "./Table"
3
- export { default as CellStack } from "./CellStack"
4
- export * from "./CellStack"
1
+ export { default as Table, type TableProps } from "./Table"
2
+ export { default as CellStack, type CellStackProps } from "./CellStack"
5
3
  export {
6
4
  TableCell as Cell,
7
5
  type TableCellProps as CellProps,
@@ -1,5 +1,5 @@
1
- import type React from "react"
2
1
  import { Button, Dialog, Typography } from "@mui/material"
2
+ import { type FC } from "react"
3
3
 
4
4
  import { Countdown } from "../components"
5
5
 
@@ -8,7 +8,7 @@ export interface InactiveDialogProps {
8
8
  onClose: () => void
9
9
  }
10
10
 
11
- const InactiveDialog: React.FC<InactiveDialogProps> = ({ open, onClose }) => {
11
+ const InactiveDialog: FC<InactiveDialogProps> = ({ open, onClose }) => {
12
12
  return (
13
13
  <Dialog open={open} onClose={onClose}>
14
14
  <Typography variant="h5" textAlign="center">
@@ -1,18 +1,15 @@
1
- import type React from "react"
2
1
  import { Button, Dialog, Typography } from "@mui/material"
2
+ import { type FC } from "react"
3
3
 
4
+ import BrainImage from "../images/svg/brain.svg"
4
5
  import { Image } from "../components"
5
- import BrainImage from "../public/images/brain.svg"
6
6
 
7
7
  export interface ScreenTimeDialogProps {
8
8
  open: boolean
9
9
  onClose: () => void
10
10
  }
11
11
 
12
- const ScreenTimeDialog: React.FC<ScreenTimeDialogProps> = ({
13
- open,
14
- onClose,
15
- }) => {
12
+ const ScreenTimeDialog: FC<ScreenTimeDialogProps> = ({ open, onClose }) => {
16
13
  return (
17
14
  <Dialog open={open} onClose={onClose} maxWidth="sm">
18
15
  <Image src={BrainImage} alt="brain" maxWidth={100} marginY={3} />
package/src/hooks/api.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import { useState, type Dispatch, type SetStateAction } from "react"
1
+ import { type Dispatch, type SetStateAction, useState } from "react"
2
2
 
3
3
  export type Pagination = { page: number; limit: number; offset: number }
4
4
  export type SetPagination = Dispatch<
@@ -22,10 +22,12 @@ export function usePagination(
22
22
 
23
23
  const setPagination: SetPagination = value => {
24
24
  _setPagination(({ page: previousPage, limit: previousLimit }) => {
25
- let { page, limit } =
25
+ const pagination =
26
26
  typeof value === "function"
27
27
  ? value({ page: previousPage, limit: previousLimit })
28
28
  : value
29
+ let page = pagination.page
30
+ const limit = pagination.limit
29
31
 
30
32
  if (limit !== previousLimit) page = 0
31
33
 
@@ -1,23 +1,24 @@
1
1
  import * as yup from "yup"
2
+ import { type ReactNode, useCallback, useEffect, useState } from "react"
2
3
  import Cookies from "js-cookie"
3
- import { useEffect, useState, useCallback, type ReactNode } from "react"
4
- import { createSearchParams } from "react-router-dom"
5
4
  import type { TypedUseMutation } from "@reduxjs/toolkit/query/react"
5
+ import { createSearchParams } from "react-router-dom"
6
+ // eslint-disable-next-line @typescript-eslint/no-restricted-imports
6
7
  import { useSelector } from "react-redux"
7
8
 
8
9
  import { type AuthFactor, type User } from "../api"
9
- import { generateSecureRandomString } from "../utils/general"
10
10
  import {
11
- makeOAuth2StorageKey,
12
- generateOAuth2CodeChallenge,
13
- type OAuth2CodeChallengeLengths,
14
11
  type OAuth2CodeChallenge,
15
- type OAuth2RequestCodeUrlSearchParams,
12
+ type OAuth2CodeChallengeLengths,
16
13
  type OAuth2ReceiveCodeUrlSearchParams,
14
+ type OAuth2RequestCodeUrlSearchParams,
15
+ generateOAuth2CodeChallenge,
16
+ makeOAuth2StorageKey,
17
17
  } from "../utils/auth"
18
+ import { useLocation, useNavigate, useSearchParams } from "./router"
18
19
  import { type ExchangeOAuth2CodeArg } from "../api/endpoints/session"
19
- import { useSearchParams, useLocation, useNavigate } from "./router"
20
20
  import { SESSION_METADATA_COOKIE_NAME } from "../settings"
21
+ import { generateSecureRandomString } from "../utils/general"
21
22
  import { selectIsLoggedIn } from "../slices/session"
22
23
 
23
24
  // -----------------------------------------------------------------------------
@@ -232,7 +233,7 @@ interface UseOAuth2KwArgs<SessionMetadata>
232
233
  export type OAuth2 = [string, OAuth2RequestCodeUrlSearchParams] | []
233
234
 
234
235
  // https://datatracker.ietf.org/doc/html/rfc7636
235
- function _useOAuth2<SessionMetadata>({
236
+ function useOAuth2Internal<SessionMetadata>({
236
237
  provider,
237
238
  authUri,
238
239
  clientId,
@@ -389,7 +390,8 @@ export const useOAuth2: {
389
390
  | UseOAuth2KwArgs<_SessionMetadata>
390
391
  | BaseUseOAuth2KwArgs<SessionMetadata>,
391
392
  ): OAuth2 => {
392
- return "useSessionMetadata" in kwargs
393
- ? _useOAuth2(kwargs)
394
- : _useOAuth2({ ...kwargs, useSessionMetadata })
393
+ return useOAuth2Internal(
394
+ // @ts-expect-error value is assignable
395
+ "useSessionMetadata" in kwargs ? kwargs : { ...kwargs, useSessionMetadata },
396
+ )
395
397
  }
@@ -1,9 +1,9 @@
1
1
  import {
2
- useEffect,
3
- useState,
4
2
  type DependencyList,
5
3
  type Dispatch,
6
4
  type SetStateAction,
5
+ useEffect,
6
+ useState,
7
7
  } from "react"
8
8
 
9
9
  export function useExternalScript<EventType extends keyof HTMLElementEventMap>({
@@ -27,7 +27,7 @@ export function useExternalScript<EventType extends keyof HTMLElementEventMap>({
27
27
  const script = document.createElement("script")
28
28
 
29
29
  Object.entries(props).forEach(([key, value]) => {
30
- // @ts-expect-error
30
+ // @ts-expect-error value is assignable
31
31
  script[key] = value
32
32
  })
33
33
 
@@ -1,25 +1,25 @@
1
- import { useEffect, type ReactNode } from "react"
2
1
  import {
2
+ type Location,
3
+ type Params,
4
+ type To,
5
+ type NavigateOptions as _NavigateOptions,
3
6
  useLocation as _useLocation,
4
7
  useNavigate as _useNavigate,
5
8
  useParams as _useParams,
6
9
  useSearchParams as _useSearchParams,
7
- type Location,
8
- type NavigateOptions as _NavigateOptions,
9
- type Params,
10
- type To,
11
10
  } from "react-router-dom"
12
- import { object as objectSchema, type ObjectShape } from "yup"
11
+ import { type ObjectShape, object as objectSchema } from "yup"
12
+ import { type ReactNode, useEffect } from "react"
13
13
 
14
- import { type PageState } from "../components/page"
15
- import { type ReadOnly } from "../utils/router"
16
14
  import {
17
- tryValidateSync,
18
15
  type ObjectSchemaFromShape,
19
16
  type TryValidateSyncOnErrorRT,
20
17
  type TryValidateSyncOptions,
21
18
  type TryValidateSyncRT,
19
+ tryValidateSync,
22
20
  } from "../utils/schema"
21
+ import { type PageState } from "../components/page"
22
+ import { type ReadOnly } from "../utils/router"
23
23
 
24
24
  export type NavigateOptions<
25
25
  State extends Record<string, any> = Record<string, any>,
@@ -2,15 +2,20 @@ import { type Middleware, isAction } from "@reduxjs/toolkit"
2
2
 
3
3
  import { logout } from "../utils/auth"
4
4
 
5
- export const logoutMiddleware: Middleware = _ => next => action => {
6
- const response = next(action)
5
+ export const logoutMiddleware: Middleware =
6
+ (
7
+ _, // eslint-disable-line @typescript-eslint/no-unused-vars
8
+ ) =>
9
+ next =>
10
+ action => {
11
+ const response = next(action)
7
12
 
8
- // The backend should delete these cookie upon calling the logout endpoint.
9
- // However, as a precaution, we also delete the session cookies in case the
10
- // backend fails to delete the cookies.
11
- if (isAction(action) && action.type === "session/logout") {
12
- logout()
13
- }
13
+ // The backend should delete these cookie upon calling the logout endpoint.
14
+ // However, as a precaution, we also delete the session cookies in case the
15
+ // backend fails to delete the cookies.
16
+ if (isAction(action) && action.type === "session/logout") {
17
+ logout()
18
+ }
14
19
 
15
- return response
16
- }
20
+ return response
21
+ }
@@ -1,10 +1,7 @@
1
1
  // Shorthand to access environment variables.
2
- export default Object.defineProperty(import.meta.env, "vite", {
3
- writable: false,
4
- value: new Proxy(import.meta.env, {
5
- get: (target, name: string) => target[`VITE_${name}`],
6
- }),
7
- }) as ImportMetaEnv & { vite: Record<string, string> }
2
+ export default new Proxy(import.meta.env, {
3
+ get: (target, name: string) => target[`VITE_${name}`] as string,
4
+ }) as Record<string, string>
8
5
 
9
6
  export * from "./custom"
10
7
  export * from "./vite"
package/src/setupTests.ts CHANGED
@@ -1 +1,2 @@
1
+ // TODO: investigate if this can be moved to the workspace
1
2
  import "@testing-library/jest-dom/vitest"
@@ -1,27 +1,27 @@
1
- import {
2
- Circle as CircleIcon,
3
- Hexagon as HexagonIcon,
4
- } from "@mui/icons-material"
5
1
  import {
6
2
  Box,
7
- ThemeProvider,
8
- buttonClasses,
9
- createTheme,
10
- responsiveFontSizes,
11
3
  type BoxProps,
12
4
  type CSSObject,
13
5
  type PaletteColor,
14
6
  type SxProps,
15
7
  type ThemeOptions,
8
+ ThemeProvider,
9
+ buttonClasses,
10
+ createTheme,
11
+ responsiveFontSizes,
16
12
  } from "@mui/material"
13
+ import {
14
+ Circle as CircleIcon,
15
+ Hexagon as HexagonIcon,
16
+ } from "@mui/icons-material"
17
17
  import { type CommonProps } from "@mui/material/OverridableComponent"
18
18
  import type React from "react"
19
19
 
20
- import { themeOptions } from "."
21
20
  import { getStyleOverrides, includesClassNames } from "../utils/theme"
22
21
  import { primary, secondary, tertiary } from "./colors"
23
22
  import type Components from "./components/_components"
24
23
  import palette from "./palette"
24
+ import { themeOptions } from "."
25
25
 
26
26
  export interface ThemedBoxProps extends BoxProps {
27
27
  options?: ThemeOptions
@@ -1,8 +1,8 @@
1
1
  import { buttonClasses } from "@mui/material"
2
2
 
3
+ import type Components from "./_components"
3
4
  import { includesClassNames } from "../../utils/theme"
4
5
  import typography from "../typography"
5
- import type Components from "./_components"
6
6
 
7
7
  const MuiButton: Components["MuiButton"] = {
8
8
  defaultProps: {
@@ -1,5 +1,5 @@
1
- import spacing from "../spacing"
2
1
  import type Components from "./_components"
2
+ import spacing from "../spacing"
3
3
 
4
4
  const MuiCardActions: Components["MuiCardActions"] = {
5
5
  styleOverrides: {
@@ -1,6 +1,6 @@
1
- import spacing from "../spacing"
2
1
  import type Components from "./_components"
3
2
  import { getFlexStyleOverrides } from "./_components"
3
+ import spacing from "../spacing"
4
4
 
5
5
  const MuiContainer: Components["MuiContainer"] = {
6
6
  defaultProps: {
@@ -1,7 +1,7 @@
1
1
  import { typographyClasses } from "@mui/material"
2
2
 
3
- import { form } from "../typography"
4
3
  import type Components from "./_components"
4
+ import { form } from "../typography"
5
5
 
6
6
  const MuiFormControlLabel: Components["MuiFormControlLabel"] = {
7
7
  styleOverrides: {
@@ -1,5 +1,5 @@
1
- import { form } from "../typography"
2
1
  import type Components from "./_components"
2
+ import { form } from "../typography"
3
3
 
4
4
  const MuiFormHelperText: Components["MuiFormHelperText"] = {
5
5
  styleOverrides: {
@@ -1,5 +1,5 @@
1
- import typography from "../typography"
2
1
  import type Components from "./_components"
2
+ import typography from "../typography"
3
3
 
4
4
  const MuiInputBase: Components["MuiInputBase"] = {
5
5
  styleOverrides: {
@@ -1,6 +1,6 @@
1
+ import type Components from "./_components"
1
2
  import { includesClassNames } from "../../utils/theme"
2
3
  import typography from "../typography"
3
- import type Components from "./_components"
4
4
 
5
5
  const MuiLink: Components["MuiLink"] = {
6
6
  defaultProps: {
@@ -1,7 +1,7 @@
1
1
  import { listItemTextClasses } from "@mui/material"
2
2
 
3
- import { includesClassNames } from "../../utils/theme"
4
3
  import type Components from "./_components"
4
+ import { includesClassNames } from "../../utils/theme"
5
5
 
6
6
  const MuiListItemText: Components["MuiListItemText"] = {
7
7
  styleOverrides: {
@@ -1,5 +1,5 @@
1
- import { includesClassNames } from "../../utils/theme"
2
1
  import type Components from "./_components"
2
+ import { includesClassNames } from "../../utils/theme"
3
3
 
4
4
  const MuiMenuItem: Components["MuiMenuItem"] = {
5
5
  styleOverrides: {
@@ -1,11 +1,11 @@
1
- import { type StyleOverridesWithRoot } from "./_components"
2
1
  import type Components from "./_components"
2
+ import { type StyleOverridesWithRoot } from "./_components"
3
3
 
4
4
  const MuiSelect: Components["MuiSelect"] = {
5
5
  defaultProps: {
6
6
  color: "black",
7
7
  },
8
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
8
+
9
9
  styleOverrides: {
10
10
  root: {
11
11
  borderRadius: "0px",
@@ -1,8 +1,8 @@
1
1
  import { tableCellClasses } from "@mui/material"
2
2
 
3
+ import type Components from "./_components"
3
4
  import { includesClassNames } from "../../utils/theme"
4
5
  import typography from "../typography"
5
- import type Components from "./_components"
6
6
 
7
7
  const MuiTable: Components["MuiTable"] = {
8
8
  styleOverrides: {
@@ -1,5 +1,5 @@
1
- import { includesClassNames } from "../../utils/theme"
2
1
  import type Components from "./_components"
2
+ import { includesClassNames } from "../../utils/theme"
3
3
 
4
4
  const MuiTableBody: Components["MuiTableBody"] = {
5
5
  styleOverrides: {
@@ -1,7 +1,7 @@
1
- import { typographyClasses, tableCellClasses } from "@mui/material"
1
+ import { tableCellClasses, typographyClasses } from "@mui/material"
2
2
 
3
- import { includesClassNames } from "../../utils/theme"
4
3
  import type Components from "./_components"
4
+ import { includesClassNames } from "../../utils/theme"
5
5
 
6
6
  const MuiTableHead: Components["MuiTableHead"] = {
7
7
  styleOverrides: {
@@ -8,10 +8,10 @@ import {
8
8
  svgIconClasses,
9
9
  } from "@mui/material"
10
10
 
11
+ import type Components from "./_components"
11
12
  import { includesClassNames } from "../../utils/theme"
12
13
  import palette from "../palette"
13
14
  import typography from "../typography"
14
- import type Components from "./_components"
15
15
 
16
16
  const MuiTextField: Components["MuiTextField"] = {
17
17
  defaultProps: {
@@ -31,7 +31,7 @@ const MuiTextField: Components["MuiTextField"] = {
31
31
  },
32
32
  border: "0px !important",
33
33
  borderRadius: "0px !important",
34
- // @ts-expect-error
34
+ // @ts-expect-error value is assignable
35
35
  backgroundColor: `${palette.info!.main} !important`,
36
36
  }
37
37
  : {
@@ -41,7 +41,7 @@ const MuiTextField: Components["MuiTextField"] = {
41
41
  }),
42
42
  },
43
43
  [`& > .${inputBaseClasses.root}.${inputBaseClasses.error}`]: {
44
- // @ts-expect-error
44
+ // @ts-expect-error value is assignable
45
45
  border: `1px solid ${palette.error!.main} !important`,
46
46
  },
47
47
  [`& .${outlinedInputClasses.root}.${inputClasses.focused} > fieldset`]: {