codeforlife 2.6.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 (147) hide show
  1. package/.eslintrc.json +47 -0
  2. package/.github/workflows/contributing.yaml +8 -0
  3. package/.github/workflows/main.yml +36 -0
  4. package/.prettierignore +5 -0
  5. package/.prettierrc.json +4 -0
  6. package/.vscode/launch.json +22 -0
  7. package/.vscode/settings.json +30 -0
  8. package/CHANGELOG.md +1864 -0
  9. package/CONTRIBUTING.md +3 -0
  10. package/LICENSE.md +3 -0
  11. package/README.md +94 -0
  12. package/codecov.yml +11 -0
  13. package/package.json +139 -0
  14. package/src/api/createApi.ts +84 -0
  15. package/src/api/endpoints/authFactor.ts +31 -0
  16. package/src/api/endpoints/index.ts +9 -0
  17. package/src/api/endpoints/klass.ts +87 -0
  18. package/src/api/endpoints/school.ts +34 -0
  19. package/src/api/endpoints/session.ts +40 -0
  20. package/src/api/endpoints/user.ts +70 -0
  21. package/src/api/index.ts +4 -0
  22. package/src/api/models.ts +144 -0
  23. package/src/api/tagTypes.ts +12 -0
  24. package/src/api/urls.ts +13 -0
  25. package/src/components/App.css +38 -0
  26. package/src/components/App.tsx +150 -0
  27. package/src/components/ClickableTooltip.tsx +43 -0
  28. package/src/components/CopyIconButton.test.tsx +16 -0
  29. package/src/components/CopyIconButton.tsx +27 -0
  30. package/src/components/Countdown.tsx +42 -0
  31. package/src/components/ElevatedAppBar.tsx +41 -0
  32. package/src/components/Image.tsx +41 -0
  33. package/src/components/InputFileButton.tsx +27 -0
  34. package/src/components/ItemizedList.tsx +61 -0
  35. package/src/components/OrderedGrid.tsx +92 -0
  36. package/src/components/ScrollIntoViewLink.tsx +23 -0
  37. package/src/components/SyncError.tsx +14 -0
  38. package/src/components/TablePagination.tsx +132 -0
  39. package/src/components/YouTubeVideo.tsx +26 -0
  40. package/src/components/form/ApiAutocompleteField.tsx +180 -0
  41. package/src/components/form/AutocompleteField.tsx +124 -0
  42. package/src/components/form/CheckboxField.tsx +81 -0
  43. package/src/components/form/CountryField.tsx +68 -0
  44. package/src/components/form/DatePickerField.tsx +119 -0
  45. package/src/components/form/EmailField.tsx +38 -0
  46. package/src/components/form/FirstNameField.tsx +40 -0
  47. package/src/components/form/Form.tsx +82 -0
  48. package/src/components/form/OtpField.tsx +28 -0
  49. package/src/components/form/PasswordField.tsx +71 -0
  50. package/src/components/form/RepeatField.tsx +115 -0
  51. package/src/components/form/SubmitButton.tsx +47 -0
  52. package/src/components/form/TextField.tsx +103 -0
  53. package/src/components/form/UkCountyField.tsx +67 -0
  54. package/src/components/form/index.tsx +28 -0
  55. package/src/components/index.ts +26 -0
  56. package/src/components/page/Banner.tsx +84 -0
  57. package/src/components/page/Notification.tsx +71 -0
  58. package/src/components/page/Page.tsx +73 -0
  59. package/src/components/page/Section.tsx +21 -0
  60. package/src/components/page/TabBar.tsx +131 -0
  61. package/src/components/page/index.ts +10 -0
  62. package/src/components/router/Link.tsx +22 -0
  63. package/src/components/router/LinkButton.tsx +21 -0
  64. package/src/components/router/LinkIconButton.tsx +21 -0
  65. package/src/components/router/LinkListItem.tsx +21 -0
  66. package/src/components/router/LinkTab.tsx +21 -0
  67. package/src/components/router/Navigate.tsx +33 -0
  68. package/src/components/router/index.tsx +12 -0
  69. package/src/components/table/CellStack.tsx +19 -0
  70. package/src/components/table/Table.tsx +55 -0
  71. package/src/components/table/index.tsx +10 -0
  72. package/src/features/InactiveDialog.tsx +40 -0
  73. package/src/features/ScreenTimeDialog.tsx +33 -0
  74. package/src/features/index.ts +4 -0
  75. package/src/fonts/Inter-VariableFont_slnt,wght.ttf +0 -0
  76. package/src/fonts/SpaceGrotesk-VariableFont_wght.ttf +0 -0
  77. package/src/hooks/api.tsx +37 -0
  78. package/src/hooks/auth.tsx +87 -0
  79. package/src/hooks/general.ts +110 -0
  80. package/src/hooks/index.ts +4 -0
  81. package/src/hooks/router.tsx +168 -0
  82. package/src/index.ts +2 -0
  83. package/src/middlewares/index.ts +1 -0
  84. package/src/middlewares/session.ts +16 -0
  85. package/src/public/images/brain.svg +1 -0
  86. package/src/schemas/user.ts +4 -0
  87. package/src/scripts/freshDesk.js +473 -0
  88. package/src/scripts/index.ts +1 -0
  89. package/src/server.js +181 -0
  90. package/src/settings/custom.ts +22 -0
  91. package/src/settings/index.ts +5 -0
  92. package/src/settings/vite.ts +26 -0
  93. package/src/setupTests.ts +1 -0
  94. package/src/slices/createSlice.ts +8 -0
  95. package/src/slices/index.ts +2 -0
  96. package/src/slices/session.ts +32 -0
  97. package/src/theme/ThemedBox.tsx +265 -0
  98. package/src/theme/colors.ts +57 -0
  99. package/src/theme/components/MuiAccordion.tsx +13 -0
  100. package/src/theme/components/MuiAutocomplete.tsx +11 -0
  101. package/src/theme/components/MuiButton.ts +70 -0
  102. package/src/theme/components/MuiCardActions.tsx +12 -0
  103. package/src/theme/components/MuiCheckbox.ts +12 -0
  104. package/src/theme/components/MuiContainer.ts +19 -0
  105. package/src/theme/components/MuiDialog.tsx +16 -0
  106. package/src/theme/components/MuiFormControlLabel.ts +18 -0
  107. package/src/theme/components/MuiFormHelperText.ts +12 -0
  108. package/src/theme/components/MuiGrid2.ts +16 -0
  109. package/src/theme/components/MuiInputBase.ts +14 -0
  110. package/src/theme/components/MuiLink.ts +41 -0
  111. package/src/theme/components/MuiList.ts +12 -0
  112. package/src/theme/components/MuiListItemText.ts +18 -0
  113. package/src/theme/components/MuiMenu.ts +14 -0
  114. package/src/theme/components/MuiMenuItem.ts +15 -0
  115. package/src/theme/components/MuiSelect.ts +16 -0
  116. package/src/theme/components/MuiTab.ts +29 -0
  117. package/src/theme/components/MuiTable.ts +29 -0
  118. package/src/theme/components/MuiTableBody.ts +15 -0
  119. package/src/theme/components/MuiTableHead.ts +26 -0
  120. package/src/theme/components/MuiTabs.ts +26 -0
  121. package/src/theme/components/MuiTextField.ts +86 -0
  122. package/src/theme/components/MuiToolbar.ts +11 -0
  123. package/src/theme/components/MuiTypography.ts +12 -0
  124. package/src/theme/components/_components.ts +93 -0
  125. package/src/theme/components/index.ts +57 -0
  126. package/src/theme/index.ts +25 -0
  127. package/src/theme/palette.ts +98 -0
  128. package/src/theme/spacing.ts +8 -0
  129. package/src/theme/typography.ts +101 -0
  130. package/src/utils/api.test.ts +19 -0
  131. package/src/utils/api.tsx +327 -0
  132. package/src/utils/auth.ts +17 -0
  133. package/src/utils/form.ts +153 -0
  134. package/src/utils/general.test.ts +42 -0
  135. package/src/utils/general.ts +498 -0
  136. package/src/utils/router.test.ts +156 -0
  137. package/src/utils/router.ts +67 -0
  138. package/src/utils/schema.ts +80 -0
  139. package/src/utils/store.ts +31 -0
  140. package/src/utils/test.tsx +82 -0
  141. package/src/utils/theme.tsx +82 -0
  142. package/src/utils/window.ts +9 -0
  143. package/src/vite-env.d.ts +1 -0
  144. package/tsconfig.json +31 -0
  145. package/tsconfig.node.json +11 -0
  146. package/types/fixes.d.ts +18 -0
  147. package/vite.config.ts +21 -0
@@ -0,0 +1,70 @@
1
+ import { buttonClasses } from "@mui/material"
2
+
3
+ import { includesClassNames } from "../../utils/theme"
4
+ import typography from "../typography"
5
+ import type Components from "./_components"
6
+
7
+ const MuiButton: Components["MuiButton"] = {
8
+ defaultProps: {
9
+ variant: "contained",
10
+ size: "medium",
11
+ },
12
+ styleOverrides: {
13
+ root: ({ ownerState }) => ({
14
+ color: "black",
15
+ textTransform: "none",
16
+ textAlign: "center",
17
+ borderRadius: "0px",
18
+ padding: "11px 12px",
19
+ height: "42px",
20
+ whiteSpace: "nowrap",
21
+ width: "fit-content",
22
+ minWidth: "150px",
23
+ boxShadow: "none",
24
+ ...(ownerState.size === "small" && {
25
+ height: "27px",
26
+ padding: "4.5px 9px",
27
+ letterSpacing: "0",
28
+ }),
29
+ ...(includesClassNames(ownerState, ["body"]) && {
30
+ marginBottom: typography.body1?.marginBottom,
31
+ }),
32
+ }),
33
+ contained: ({ ownerState }) => ({
34
+ backgroundColor: "#ffd23b",
35
+ "&:hover": {
36
+ backgroundColor: "#ffc709",
37
+ boxShadow: [
38
+ "0px 6px 10px 0px rgba(0, 0, 0, 0.14)",
39
+ "0px 1px 18px 0px rgba(0, 0, 0, 0.12)",
40
+ "0px 3px 5px 0px rgba(0, 0, 0, 0.2);",
41
+ ].join(),
42
+ },
43
+ [`&.${buttonClasses.disabled}`]: {
44
+ backgroundColor: "#ffe382",
45
+ color: "#7A5F01",
46
+ },
47
+ ...(includesClassNames(ownerState, ["alert"]) && {
48
+ color: "white",
49
+ backgroundColor: "#ff0000",
50
+ "&:hover": {
51
+ backgroundColor: "#df0531",
52
+ },
53
+ [`&.${buttonClasses.disabled}`]: {
54
+ backgroundColor: "#E76A6A",
55
+ color: "white",
56
+ },
57
+ }),
58
+ }),
59
+ outlined: {
60
+ border: "2px solid #eab502",
61
+ "&:hover": {
62
+ border: "2px solid #eab502",
63
+ backgroundColor: "transparent",
64
+ textDecoration: "underline",
65
+ },
66
+ },
67
+ },
68
+ }
69
+
70
+ export default MuiButton
@@ -0,0 +1,12 @@
1
+ import spacing from "../spacing"
2
+ import type Components from "./_components"
3
+
4
+ const MuiCardActions: Components["MuiCardActions"] = {
5
+ styleOverrides: {
6
+ root: {
7
+ padding: spacing(2),
8
+ },
9
+ },
10
+ }
11
+
12
+ export default MuiCardActions
@@ -0,0 +1,12 @@
1
+ import type Components from "./_components"
2
+
3
+ const MuiCheckbox: Components["MuiCheckbox"] = {
4
+ styleOverrides: {
5
+ root: {
6
+ paddingLeft: "0px",
7
+ marginLeft: "-2px",
8
+ },
9
+ },
10
+ }
11
+
12
+ export default MuiCheckbox
@@ -0,0 +1,19 @@
1
+ import spacing from "../spacing"
2
+ import type Components from "./_components"
3
+ import { getFlexStyleOverrides } from "./_components"
4
+
5
+ const MuiContainer: Components["MuiContainer"] = {
6
+ defaultProps: {
7
+ maxWidth: "lg",
8
+ },
9
+ styleOverrides: {
10
+ root: ({ ownerState }) => ({
11
+ ...getFlexStyleOverrides(ownerState),
12
+ paddingLeft: spacing(2, true),
13
+ paddingRight: spacing(2, true),
14
+ padding: spacing(7),
15
+ }),
16
+ },
17
+ }
18
+
19
+ export default MuiContainer
@@ -0,0 +1,16 @@
1
+ import type Components from "./_components"
2
+
3
+ const MuiDialog: Components["MuiDialog"] = {
4
+ defaultProps: {
5
+ maxWidth: "sm",
6
+ },
7
+ styleOverrides: {
8
+ paper: {
9
+ borderRadius: "0px !important",
10
+ padding: "24px",
11
+ alignItems: "center",
12
+ },
13
+ },
14
+ }
15
+
16
+ export default MuiDialog
@@ -0,0 +1,18 @@
1
+ import { typographyClasses } from "@mui/material"
2
+
3
+ import { form } from "../typography"
4
+ import type Components from "./_components"
5
+
6
+ const MuiFormControlLabel: Components["MuiFormControlLabel"] = {
7
+ styleOverrides: {
8
+ root: {
9
+ [`.${typographyClasses.root}`]: {
10
+ ...form,
11
+ marginBottom: 0,
12
+ },
13
+ margin: 0,
14
+ },
15
+ },
16
+ }
17
+
18
+ export default MuiFormControlLabel
@@ -0,0 +1,12 @@
1
+ import { form } from "../typography"
2
+ import type Components from "./_components"
3
+
4
+ const MuiFormHelperText: Components["MuiFormHelperText"] = {
5
+ styleOverrides: {
6
+ root: {
7
+ ...form,
8
+ },
9
+ },
10
+ }
11
+
12
+ export default MuiFormHelperText
@@ -0,0 +1,16 @@
1
+ import type Components from "./_components"
2
+ import { getFlexStyleOverrides } from "./_components"
3
+
4
+ const MuiGrid2: Components["MuiGrid2"] = {
5
+ defaultProps: {
6
+ disableEqualOverflow: true,
7
+ // padding: 0 // TODO: normalize padding.
8
+ },
9
+ styleOverrides: {
10
+ root: ({ ownerState }) => ({
11
+ ...getFlexStyleOverrides(ownerState),
12
+ }),
13
+ },
14
+ }
15
+
16
+ export default MuiGrid2
@@ -0,0 +1,14 @@
1
+ import typography from "../typography"
2
+ import type Components from "./_components"
3
+
4
+ const MuiInputBase: Components["MuiInputBase"] = {
5
+ styleOverrides: {
6
+ root: {
7
+ backgroundColor: "white",
8
+ marginBottom: 0,
9
+ color: typography.body1?.color,
10
+ },
11
+ },
12
+ }
13
+
14
+ export default MuiInputBase
@@ -0,0 +1,41 @@
1
+ import { includesClassNames } from "../../utils/theme"
2
+ import typography from "../typography"
3
+ import type Components from "./_components"
4
+
5
+ const MuiLink: Components["MuiLink"] = {
6
+ defaultProps: {
7
+ underline: "none", // BUG: if not set, MUI fails to run.
8
+ color: "inherit",
9
+ },
10
+ styleOverrides: {
11
+ root: ({ ownerState }) => ({
12
+ cursor: "pointer",
13
+ ...(includesClassNames(ownerState, ["no-decor"])
14
+ ? {
15
+ ":hover": {
16
+ textDecoration: "underline",
17
+ },
18
+ }
19
+ : {
20
+ textDecoration: "underline",
21
+ ":hover": {
22
+ fontWeight: "bold",
23
+ },
24
+ }),
25
+ ...(includesClassNames(ownerState, ["back-to"]) && {
26
+ textDecoration: "none",
27
+ display: "inline-block",
28
+ marginBottom: typography.body1?.marginBottom,
29
+ ":hover": {
30
+ fontWeight: "bold",
31
+ textDecoration: "underline",
32
+ },
33
+ ":before": {
34
+ content: '"< Back to "',
35
+ },
36
+ }),
37
+ }),
38
+ },
39
+ }
40
+
41
+ export default MuiLink
@@ -0,0 +1,12 @@
1
+ import type Components from "./_components"
2
+
3
+ const MuiList: Components["MuiList"] = {
4
+ styleOverrides: {
5
+ root: {
6
+ paddingTop: 0,
7
+ paddingBottom: 0,
8
+ },
9
+ },
10
+ }
11
+
12
+ export default MuiList
@@ -0,0 +1,18 @@
1
+ import { listItemTextClasses } from "@mui/material"
2
+
3
+ import { includesClassNames } from "../../utils/theme"
4
+ import type Components from "./_components"
5
+
6
+ const MuiListItemText: Components["MuiListItemText"] = {
7
+ styleOverrides: {
8
+ root: ({ ownerState }) => ({
9
+ ...(includesClassNames(ownerState, ["last"]) && {
10
+ [`.${listItemTextClasses.primary}`]: {
11
+ marginBottom: 0,
12
+ },
13
+ }),
14
+ }),
15
+ },
16
+ }
17
+
18
+ export default MuiListItemText
@@ -0,0 +1,14 @@
1
+ import type Components from "./_components"
2
+
3
+ const MuiMenu: Components["MuiMenu"] = {
4
+ styleOverrides: {
5
+ paper: {
6
+ borderRadius: 0,
7
+ },
8
+ list: {
9
+ padding: 0,
10
+ },
11
+ },
12
+ }
13
+
14
+ export default MuiMenu
@@ -0,0 +1,15 @@
1
+ import { includesClassNames } from "../../utils/theme"
2
+ import type Components from "./_components"
3
+
4
+ const MuiMenuItem: Components["MuiMenuItem"] = {
5
+ styleOverrides: {
6
+ root: ({ ownerState }) => ({
7
+ ...(includesClassNames(ownerState, ["header"]) && {
8
+ pointerEvents: "none",
9
+ fontWeight: "bold",
10
+ }),
11
+ }),
12
+ },
13
+ }
14
+
15
+ export default MuiMenuItem
@@ -0,0 +1,16 @@
1
+ import { type StyleOverridesWithRoot } from "./_components"
2
+ import type Components from "./_components"
3
+
4
+ const MuiSelect: Components["MuiSelect"] = {
5
+ defaultProps: {
6
+ color: "black",
7
+ },
8
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
9
+ styleOverrides: {
10
+ root: {
11
+ borderRadius: "0px",
12
+ },
13
+ } as StyleOverridesWithRoot<"MuiSelect">,
14
+ }
15
+
16
+ export default MuiSelect
@@ -0,0 +1,29 @@
1
+ import { tabClasses } from "@mui/material"
2
+
3
+ import type Components from "./_components"
4
+ import { primary } from "../colors"
5
+
6
+ const MuiTab: Components["MuiTab"] = {
7
+ styleOverrides: {
8
+ root: {
9
+ textTransform: "none",
10
+ fontSize: "16px",
11
+ fontWeight: 600,
12
+ minWidth: "150px",
13
+ border: "2px solid white",
14
+ [`&.${tabClasses.selected}`]: {
15
+ color: primary[300],
16
+ backgroundColor: "white",
17
+ cursor: "default",
18
+ },
19
+ [`:not(.${tabClasses.selected})`]: {
20
+ color: "white",
21
+ ":hover": {
22
+ textDecoration: "underline",
23
+ },
24
+ },
25
+ },
26
+ },
27
+ }
28
+
29
+ export default MuiTab
@@ -0,0 +1,29 @@
1
+ import { tableCellClasses } from "@mui/material"
2
+
3
+ import { includesClassNames } from "../../utils/theme"
4
+ import typography from "../typography"
5
+ import type Components from "./_components"
6
+
7
+ const MuiTable: Components["MuiTable"] = {
8
+ styleOverrides: {
9
+ root: ({ ownerState }) => ({
10
+ borderStyle: "hidden",
11
+ overflowX: "auto",
12
+ [`.${tableCellClasses.root}`]: {
13
+ border: "2px solid white",
14
+ },
15
+ ...(includesClassNames(ownerState, ["text"]) && {
16
+ borderStyle: "unset",
17
+ display: "block",
18
+ [`.${tableCellClasses.root}`]: {
19
+ border: "1px solid #DDD",
20
+ },
21
+ }),
22
+ ...(includesClassNames(ownerState, ["body"]) && {
23
+ marginBottom: typography.body1?.marginBottom,
24
+ }),
25
+ }),
26
+ },
27
+ }
28
+
29
+ export default MuiTable
@@ -0,0 +1,15 @@
1
+ import { includesClassNames } from "../../utils/theme"
2
+ import type Components from "./_components"
3
+
4
+ const MuiTableBody: Components["MuiTableBody"] = {
5
+ styleOverrides: {
6
+ root: ({ ownerState }) => ({
7
+ backgroundColor: "#F1ECEC",
8
+ ...(includesClassNames(ownerState, ["text"]) && {
9
+ backgroundColor: "white",
10
+ }),
11
+ }),
12
+ },
13
+ }
14
+
15
+ export default MuiTableBody
@@ -0,0 +1,26 @@
1
+ import { typographyClasses, tableCellClasses } from "@mui/material"
2
+
3
+ import { includesClassNames } from "../../utils/theme"
4
+ import type Components from "./_components"
5
+
6
+ const MuiTableHead: Components["MuiTableHead"] = {
7
+ styleOverrides: {
8
+ root: ({ ownerState }) => ({
9
+ backgroundColor: "#6E7171",
10
+ ...(includesClassNames(ownerState, ["light"]) && {
11
+ backgroundColor: "#9A9C9E",
12
+ }),
13
+ [`.${typographyClasses.root}`]: {
14
+ color: "white",
15
+ fontWeight: 600,
16
+ marginBottom: 0,
17
+ },
18
+ [`.${tableCellClasses.head}`]: {
19
+ color: "white",
20
+ fontWeight: 600,
21
+ },
22
+ }),
23
+ },
24
+ }
25
+
26
+ export default MuiTableHead
@@ -0,0 +1,26 @@
1
+ import { tabClasses } from "@mui/material"
2
+
3
+ import type Components from "./_components"
4
+
5
+ const MuiTabs: Components["MuiTabs"] = {
6
+ defaultProps: {
7
+ variant: "scrollable",
8
+ scrollButtons: true,
9
+ allowScrollButtonsMobile: true,
10
+ },
11
+ styleOverrides: {
12
+ root: ({ ownerState }) => ({
13
+ ...(ownerState !== undefined && // NOTE: this is a bug with MUI
14
+ [undefined, "horizontal"].includes(ownerState.orientation) && {
15
+ [`.${tabClasses.root}:not(:last-of-type)`]: {
16
+ marginRight: "30px",
17
+ },
18
+ }),
19
+ }),
20
+ indicator: {
21
+ display: "none",
22
+ },
23
+ },
24
+ }
25
+
26
+ export default MuiTabs
@@ -0,0 +1,86 @@
1
+ import {
2
+ filledInputClasses,
3
+ formHelperTextClasses,
4
+ formLabelClasses,
5
+ inputBaseClasses,
6
+ inputClasses,
7
+ outlinedInputClasses,
8
+ svgIconClasses,
9
+ } from "@mui/material"
10
+
11
+ import { includesClassNames } from "../../utils/theme"
12
+ import palette from "../palette"
13
+ import typography from "../typography"
14
+ import type Components from "./_components"
15
+
16
+ const MuiTextField: Components["MuiTextField"] = {
17
+ defaultProps: {
18
+ size: "small",
19
+ variant: "filled",
20
+ },
21
+ styleOverrides: {
22
+ root: ({ ownerState }) => ({
23
+ width: "100%",
24
+ backgroundColor: "transparent",
25
+ [`& > .${inputBaseClasses.root}`]: {
26
+ ...(ownerState.disabled
27
+ ? {
28
+ [`.${inputBaseClasses.disabled}`]: {
29
+ color: `${typography.body1!.color} !important`,
30
+ "-webkit-text-fill-color": "unset",
31
+ },
32
+ border: "0px !important",
33
+ borderRadius: "0px !important",
34
+ // @ts-expect-error
35
+ backgroundColor: `${palette.info!.main} !important`,
36
+ }
37
+ : {
38
+ border: "1px solid black !important",
39
+ borderRadius: "0px !important",
40
+ backgroundColor: "white !important",
41
+ }),
42
+ },
43
+ [`& > .${inputBaseClasses.root}.${inputBaseClasses.error}`]: {
44
+ // @ts-expect-error
45
+ border: `1px solid ${palette.error!.main} !important`,
46
+ },
47
+ [`& .${outlinedInputClasses.root}.${inputClasses.focused} > fieldset`]: {
48
+ borderColor: "black !important",
49
+ },
50
+ [`.${svgIconClasses.root}`]: {
51
+ color: `${typography.body1!.color} !important`,
52
+ },
53
+ [`.${filledInputClasses.root}::after`]: {
54
+ borderColor: `${typography.body1!.color} !important`,
55
+ },
56
+ [`.${formLabelClasses.root}`]: {
57
+ color: `${typography.body1!.color} !important`,
58
+ },
59
+ [`.${formHelperTextClasses.root}`]: {
60
+ fontSize: "12px !important",
61
+ },
62
+ ...(ownerState.multiline === true && {
63
+ ...((includesClassNames(ownerState, ["resize"]) ||
64
+ includesClassNames(ownerState, ["resize-both"])) && {
65
+ width: "auto",
66
+ [`.${inputClasses.inputMultiline}`]: {
67
+ resize: "both",
68
+ },
69
+ }),
70
+ ...(includesClassNames(ownerState, ["resize-horizontal"]) && {
71
+ width: "auto",
72
+ [`.${inputClasses.inputMultiline}`]: {
73
+ resize: "horizontal",
74
+ },
75
+ }),
76
+ ...(includesClassNames(ownerState, ["resize-vertical"]) && {
77
+ [`.${inputClasses.inputMultiline}`]: {
78
+ resize: "vertical",
79
+ },
80
+ }),
81
+ }),
82
+ }),
83
+ },
84
+ }
85
+
86
+ export default MuiTextField
@@ -0,0 +1,11 @@
1
+ import type Components from "./_components"
2
+
3
+ const MuiToolbar: Components["MuiToolbar"] = {
4
+ styleOverrides: {
5
+ root: {
6
+ padding: "15px 0px !important",
7
+ },
8
+ },
9
+ }
10
+
11
+ export default MuiToolbar
@@ -0,0 +1,12 @@
1
+ import type Components from "./_components"
2
+ import { getFontStyleOverrides } from "./_components"
3
+
4
+ const MuiTypography: Components["MuiTypography"] = {
5
+ styleOverrides: {
6
+ root: ({ ownerState }) => ({
7
+ ...getFontStyleOverrides(ownerState),
8
+ }),
9
+ },
10
+ }
11
+
12
+ export default MuiTypography
@@ -0,0 +1,93 @@
1
+ import {
2
+ type CSSObject,
3
+ type ComponentsOverrides,
4
+ type ComponentsPropsList,
5
+ type Theme,
6
+ type ThemeOptions,
7
+ } from "@mui/material"
8
+ import { type CommonProps } from "@mui/material/OverridableComponent"
9
+ import { type OverridesStyleRules } from "@mui/material/styles/overrides"
10
+
11
+ import {
12
+ getClassNames,
13
+ includesClassNames,
14
+ matchClassNames,
15
+ } from "../../utils/theme"
16
+ import typography from "../typography"
17
+
18
+ export default interface Components
19
+ extends NonNullable<ThemeOptions["components"]> {}
20
+
21
+ export type StyleOverridesWithRoot<
22
+ Component extends keyof ComponentsOverrides<Theme>,
23
+ > = ComponentsOverrides<Theme>[Component] & {
24
+ root: OverridesStyleRules<"root", Component, Theme>["root"]
25
+ }
26
+
27
+ export type OwnerState<ComponentName extends keyof ComponentsPropsList> =
28
+ ComponentsPropsList[ComponentName] & Record<string, unknown>
29
+
30
+ export function getFlexStyleOverrides(props: CommonProps): CSSObject {
31
+ const styleOverrides: CSSObject = {}
32
+
33
+ const classNames = getClassNames(props)
34
+
35
+ if (classNames.some(className => className.startsWith("flex-"))) {
36
+ styleOverrides.display = "flex"
37
+ if (includesClassNames(classNames, ["flex-center"])) {
38
+ styleOverrides.justifyContent = "center"
39
+ styleOverrides.alignItems = "center"
40
+ } else if (includesClassNames(classNames, ["flex-center-x"])) {
41
+ styleOverrides.justifyContent = "center"
42
+ styleOverrides.alignItems = "start"
43
+ } else if (includesClassNames(classNames, ["flex-center-y"])) {
44
+ styleOverrides.justifyContent = "start"
45
+ styleOverrides.alignItems = "center"
46
+ } else if (includesClassNames(classNames, ["flex-end"])) {
47
+ styleOverrides.justifyContent = "end"
48
+ styleOverrides.alignItems = "end"
49
+ } else if (includesClassNames(classNames, ["flex-end-x"])) {
50
+ styleOverrides.justifyContent = "end"
51
+ styleOverrides.alignItems = "start"
52
+ } else if (includesClassNames(classNames, ["flex-end-y"])) {
53
+ styleOverrides.justifyContent = "start"
54
+ styleOverrides.alignItems = "end"
55
+ }
56
+ }
57
+
58
+ return styleOverrides
59
+ }
60
+
61
+ export function getFontStyleOverrides(props: CommonProps): CSSObject {
62
+ let styleOverrides: CSSObject = {}
63
+
64
+ const classNames = getClassNames(props)
65
+
66
+ if (includesClassNames(classNames, ["nowrap-ellipsis"])) {
67
+ styleOverrides.whiteSpace = "nowrap"
68
+ styleOverrides.overflow = "hidden"
69
+ styleOverrides.textOverflow = "ellipsis"
70
+ }
71
+
72
+ ;["h1", "h2", "h3", "h4", "h5", "h6", "body1", "body2"]
73
+ .filter(className => className in typography)
74
+ .forEach(className => {
75
+ // @ts-expect-error
76
+ const typographyClass = typography[className]
77
+
78
+ if (includesClassNames(classNames, [className])) {
79
+ styleOverrides = { ...styleOverrides, ...typographyClass }
80
+ }
81
+
82
+ matchClassNames(classNames, new RegExp(`^${className}-(\\w+)$`)).forEach(
83
+ match => {
84
+ const prop = match[1]
85
+ if (prop in typographyClass) {
86
+ styleOverrides[prop] = typographyClass[prop]
87
+ }
88
+ },
89
+ )
90
+ })
91
+
92
+ return styleOverrides
93
+ }