2024-11-12 19:10:48 -05:00
import { typographyLevels } from "./constants" ;
2024-11-08 18:36:43 -05:00
const fontFamilyPrimary = '"Inter" , sans-serif' ;
// const fontFamilySecondary = '"Avenir", sans-serif';
2024-11-12 17:24:21 -05:00
/* TODO take the color out from here */
2024-11-09 08:01:14 -05:00
const shadow =
"0px 4px 24px -4px rgba(16, 24, 40, 0.08), 0px 3px 3px -3px rgba(16, 24, 40, 0.03)" ;
2024-11-12 19:10:48 -05:00
const baseTheme = ( palette ) => ({
2024-11-08 18:36:43 -05:00
typography : {
fontFamily : fontFamilyPrimary ,
2024-11-09 08:01:14 -05:00
fontSize : 14 ,
2024-11-08 18:36:43 -05:00
h1 : {
fontSize : typographyLevels . xl ,
2025-01-14 22:58:46 -05:00
color : palette . primary . contrastText ,
2024-11-08 18:36:43 -05:00
fontWeight : 500 ,
},
h2 : {
fontSize : typographyLevels . l ,
2025-01-14 22:58:46 -05:00
color : palette . primary . contrastTextSecondary ,
2024-11-08 18:36:43 -05:00
fontWeight : 400 ,
},
2025-02-04 15:23:52 -08:00
// CAIO_REVIEW, need a brighter color for dark bg
h2DarkBg : {
fontSize : typographyLevels . l ,
color : palette . primary . contrastTextSecondaryDarkBg ,
fontWeight : 400 ,
},
2024-11-08 18:36:43 -05:00
body1 : {
fontSize : typographyLevels . m ,
2025-01-14 22:58:46 -05:00
color : palette . primary . contrastTextTertiary ,
2024-11-08 18:36:43 -05:00
fontWeight : 400 ,
},
body2 : {
fontSize : typographyLevels . s ,
2025-01-14 22:58:46 -05:00
color : palette . primary . contrastTextTertiary ,
2024-11-08 18:36:43 -05:00
fontWeight : 400 ,
},
},
2025-01-12 12:28:13 -05:00
/* TODO change to 4 */
2024-11-09 08:01:14 -05:00
spacing : 2 ,
2025-01-12 12:28:13 -05:00
/* TODO we can skip using the callback functions on the next lines since we are already accessing it on line 10. That was the last thing I managed to do, so we are sort of doing it twice*/
2024-11-12 19:10:48 -05:00
/* TODO All these should live inside of a component*/
2024-11-09 08:01:14 -05:00
components : {
MuiButton : {
defaultProps : {
disableRipple : true ,
},
2025-01-09 12:19:28 -05:00
2024-11-09 08:01:14 -05:00
styleOverrides : {
root : ({ theme }) => ({
variants : [
2025-01-12 08:33:33 -05:00
{
props : ( props ) => props . color === "accent" ,
style : {
"&:hover" : {
2025-01-21 11:38:32 -08:00
backgroundColor : theme . palette . accent . darker ,
2025-01-12 08:33:33 -05:00
},
},
},
2025-02-04 14:05:39 -08:00
{
props : ( props ) => props . color === "error" ,
style : {
"&.Mui-disabled" : {
backgroundColor : theme . palette . error . lowContrast ,
},
"& .MuiButton-loadingIndicator" : {
// styles for error variant loading indicator
color : theme . palette . error . contrastText ,
},
},
},
2024-11-09 08:01:14 -05:00
{
props : ( props ) => props . variant === "group" ,
style : {
2024-12-23 07:32:08 -05:00
/* color: theme.palette.secondary.contrastText, */
2025-01-12 09:39:31 -05:00
color : theme . palette . primary . contrastText ,
2025-01-08 21:41:59 -05:00
backgroundColor : theme . palette . primary . main ,
2024-11-09 08:01:14 -05:00
border : 1 ,
borderStyle : "solid" ,
2025-01-08 21:41:59 -05:00
borderColor : theme . palette . primary . lowContrast ,
2024-11-09 08:01:14 -05:00
},
},
{
props : ( props ) => props . variant === "group" && props . filled === "true" ,
style : {
backgroundColor : theme . palette . secondary . main ,
},
},
2025-01-09 12:19:28 -05:00
/* {
props: (props) => props.variant === "contained",
style: {
backgroundColor: `${theme.palette.accent.main} !important`,
},
}, */
2024-11-09 08:01:14 -05:00
{
props : ( props ) =>
props . variant === "contained" && props . color === "secondary" ,
style : {
border : 1 ,
borderStyle : "solid" ,
2025-01-08 21:41:59 -05:00
borderColor : theme . palette . primary . lowContrast ,
2024-11-09 08:01:14 -05:00
},
},
2024-11-12 19:10:48 -05:00
{
2024-11-27 13:54:12 +08:00
props : ( props ) => {
return (
props . variant === "contained" &&
props . disabled &&
props . classes . loadingIndicator === undefined // Do not apply to loading button
);
},
2024-11-12 19:10:48 -05:00
style : {
backgroundColor : ` ${ theme . palette . secondary . main } !important` ,
color : ` ${ theme . palette . secondary . contrastText } !important` ,
},
},
2024-11-09 08:01:14 -05:00
],
fontWeight : 400 ,
borderRadius : 4 ,
boxShadow : "none" ,
textTransform : "none" ,
"&:focus" : {
outline : "none" ,
},
"&:hover" : {
boxShadow : "none" ,
},
2024-12-03 19:12:51 -05:00
"&.MuiLoadingButton-root" : {
"&:disabled" : {
backgroundColor : theme . palette . secondary . main ,
2025-01-12 09:39:31 -05:00
color : theme . palette . primary . contrastText ,
2024-12-03 19:12:51 -05:00
},
2025-01-21 10:58:08 -08:00
"&.MuiButton-colorAccent:hover" : {
boxShadow : `0 0 0 1px ${ theme . palette . accent . main } ` , // CAIO_REVIEW, this should really have a solid BG color
},
2024-12-03 19:12:51 -05:00
},
"&.MuiLoadingButton-loading" : {
"& .MuiLoadingButton-label" : {
color : "transparent" ,
},
"& .MuiLoadingButton-loadingIndicator" : {
color : "inherit" ,
},
2024-12-02 21:27:42 -05:00
},
2024-11-09 08:01:14 -05:00
}),
},
},
2024-11-27 13:54:12 +08:00
2024-11-09 08:01:14 -05:00
MuiIconButton : {
styleOverrides : {
2024-11-12 17:24:21 -05:00
root : ({ theme }) => ({
2024-11-09 08:01:14 -05:00
padding : 4 ,
transition : "none" ,
"&:hover" : {
2025-01-08 21:41:59 -05:00
backgroundColor : theme . palette . primary . lowContrast ,
2024-11-09 08:01:14 -05:00
},
2024-11-12 17:24:21 -05:00
}),
2024-11-09 08:01:14 -05:00
},
},
MuiPaper : {
styleOverrides : {
2024-11-12 17:24:21 -05:00
root : ({ theme }) => {
return {
marginTop : 4 ,
padding : 0 ,
border : 1 ,
borderStyle : "solid" ,
2025-01-08 21:41:59 -05:00
borderColor : theme . palette . primary . lowContrast ,
2024-11-12 17:24:21 -05:00
borderRadius : 4 ,
boxShadow : shadow ,
2025-01-11 16:53:00 -05:00
backgroundColor : theme . palette . primary . main ,
2024-11-12 17:24:21 -05:00
backgroundImage : "none" ,
};
2024-11-09 08:01:14 -05:00
},
},
},
MuiList : {
styleOverrides : {
root : {
padding : 0 ,
},
},
},
MuiListItemButton : {
styleOverrides : {
root : {
transition : "none" ,
},
},
},
MuiMenuItem : {
styleOverrides : {
2024-11-12 17:24:21 -05:00
root : ({ theme }) => ({
2024-11-09 08:01:14 -05:00
borderRadius : 4 ,
backgroundColor : "inherit" ,
padding : "4px 6px" ,
2025-01-12 09:39:31 -05:00
color : theme . palette . primary . contrastTextSecondary ,
2024-11-09 08:01:14 -05:00
fontSize : 13 ,
margin : 2 ,
minWidth : 100 ,
"&:hover, &.Mui-selected, &.Mui-selected:hover, &.Mui-selected.Mui-focusVisible" :
{
2025-01-08 21:41:59 -05:00
backgroundColor : theme . palette . primary . lowContrast ,
2024-11-09 08:01:14 -05:00
},
2024-11-12 17:24:21 -05:00
}),
2024-11-09 08:01:14 -05:00
},
},
MuiTableCell : {
styleOverrides : {
2024-11-12 17:24:21 -05:00
root : ({ theme }) => ({
2025-01-08 21:41:59 -05:00
borderBottomColor : theme . palette . primary . lowContrast ,
2024-11-12 17:24:21 -05:00
}),
2024-11-09 08:01:14 -05:00
},
},
MuiTableHead : {
styleOverrides : {
2024-11-12 17:24:21 -05:00
root : ({ theme }) => ({
2025-01-11 16:50:48 -05:00
backgroundColor : theme . palette . tertiary . main ,
2024-11-12 17:24:21 -05:00
}),
2024-11-09 08:01:14 -05:00
},
},
MuiPagination : {
styleOverrides : {
2024-11-12 17:24:21 -05:00
root : ({ theme }) => ({
2025-01-11 16:53:00 -05:00
backgroundColor : theme . palette . primary . main ,
2024-11-09 08:01:14 -05:00
border : 1 ,
borderStyle : "solid" ,
2025-01-08 21:41:59 -05:00
borderColor : theme . palette . primary . lowContrast ,
2024-11-09 08:01:14 -05:00
"& button" : {
2025-01-12 09:39:31 -05:00
color : theme . palette . primary . contrastTextTertiary ,
2024-11-09 08:01:14 -05:00
borderRadius : 4 ,
},
"& li:first-of-type button, & li:last-of-type button" : {
border : 1 ,
borderStyle : "solid" ,
2025-01-08 21:41:59 -05:00
borderColor : theme . palette . primary . lowContrast ,
2024-11-09 08:01:14 -05:00
},
2024-11-12 17:24:21 -05:00
}),
2024-11-09 08:01:14 -05:00
},
},
MuiPaginationItem : {
styleOverrides : {
2024-11-12 17:24:21 -05:00
root : ({ theme }) => ({
2024-11-09 08:01:14 -05:00
"&:not(.MuiPaginationItem-ellipsis):hover, &.Mui-selected" : {
2025-01-08 21:41:59 -05:00
backgroundColor : theme . palette . primary . lowContrast ,
2024-11-09 08:01:14 -05:00
},
2024-11-12 17:24:21 -05:00
}),
2024-11-09 08:01:14 -05:00
},
},
MuiSkeleton : {
styleOverrides : {
root : ({ theme }) => ({
2025-01-08 21:41:59 -05:00
backgroundColor : theme . palette . primary . lowContrast ,
2024-11-09 08:01:14 -05:00
}),
},
},
2024-11-21 15:54:02 +08:00
MuiTextField : {
styleOverrides : {
root : ({ theme }) => ({
"& fieldset" : {
2025-01-08 21:41:59 -05:00
borderColor : theme . palette . primary . lowContrast ,
2024-11-21 15:54:02 +08:00
borderRadius : theme . shape . borderRadius ,
},
"& .MuiInputBase-input" : {
2024-11-29 14:06:59 -05:00
padding : ".75em" ,
2024-12-02 10:12:06 +08:00
minHeight : "var(--env-var-height-2)" ,
2024-11-21 15:54:02 +08:00
fontSize : "var(--env-var-font-size-medium)" ,
fontWeight : 400 ,
2025-01-14 22:58:46 -05:00
color : palette . primary . contrastTextSecondary ,
2024-12-03 19:31:00 -05:00
"&.Mui-disabled" : {
2024-12-03 21:01:54 -05:00
opacity : 0.3 ,
WebkitTextFillColor : "unset" ,
2024-12-03 19:31:00 -05:00
},
2025-01-14 22:58:46 -05:00
"& .Mui-focused" : {
/* color: "#ff0000", */
/* borderColor: theme.palette.primary.contrastText, */
},
2024-11-21 15:54:02 +08:00
},
2024-12-05 07:20:38 +05:30
"& .MuiInputBase-input:-webkit-autofill" : {
2024-12-23 07:32:08 -05:00
transition : "background-color 5000s ease-in-out 0s" ,
2025-01-11 16:53:00 -05:00
WebkitBoxShadow : `0 0 0px 1000px ${ theme . palette . primary . main } inset` ,
2025-01-12 09:39:31 -05:00
WebkitTextFillColor : theme . palette . primary . contrastText ,
2024-12-05 07:20:38 +05:30
},
2024-11-21 15:54:02 +08:00
"& .MuiInputBase-input.MuiOutlinedInput-input" : {
padding : "0 var(--env-var-spacing-1-minus) !important" ,
},
"& .MuiOutlinedInput-root" : {
2025-01-14 19:19:36 -05:00
color : theme . palette . primary . contrastTextSecondary ,
2024-11-21 15:54:02 +08:00
borderRadius : 4 ,
},
"& .MuiOutlinedInput-notchedOutline" : {
borderRadius : 4 ,
},
2024-11-27 14:50:05 +08:00
2024-11-21 15:54:02 +08:00
"& .MuiFormHelperText-root" : {
color : palette . error . main ,
opacity : 0.8 ,
fontSize : "var(--env-var-font-size-medium)" ,
marginLeft : 0 ,
},
"& .MuiFormHelperText-root.Mui-error" : {
opacity : 0.8 ,
fontSize : "var(--env-var-font-size-medium)" ,
color : palette . error . main ,
},
}),
},
},
2025-01-15 19:16:33 -05:00
MuiOutlinedInput : {
styleOverrides : {
root : {
color : palette . primary . contrastTextTertiary ,
"&.Mui-focused .MuiOutlinedInput-notchedOutline" : {
borderColor : palette . primary . contrastTextTertiary ,
},
},
},
},
2025-02-02 21:26:48 -08:00
MuiTab : {
styleOverrides : {
root : ({ theme }) => ({
fontSize : 13 ,
color : theme . palette . tertiary . contrastText ,
backgroundColor : theme . palette . tertiary . main ,
textTransform : "none" ,
minWidth : "fit-content" ,
paddingY : theme . spacing ( 6 ),
fontWeight : 400 ,
borderBottom : "2px solid transparent" ,
borderRight : `1px solid ${ theme . palette . primary . lowContrast } ` ,
"&:first-of-type" : { borderTopLeftRadius : "8px" },
"&:last-child" : { borderTopRightRadius : "8px" , borderRight : 0 },
"&:focus-visible" : {
color : theme . palette . primary . contrastText ,
borderColor : theme . palette . tertiary . contrastText ,
borderRightColor : theme . palette . primary . lowContrast ,
},
"&.Mui-selected" : {
backgroundColor : theme . palette . secondary . main ,
color : theme . palette . secondary . contrastText ,
borderColor : theme . palette . secondary . contrastText ,
borderRightColor : theme . palette . primary . lowContrast ,
},
"&:hover" : {
borderColor : theme . palette . primary . lowContrast ,
},
}),
},
},
2025-02-03 15:08:42 -08:00
MuiSvgIcon : {
styleOverrides : {
root : ({ theme }) => ({
color : theme . palette . primary . contrastTextTertiary ,
}),
},
},
2024-11-09 08:01:14 -05:00
},
shape : {
borderRadius : 2 ,
borderThick : 2 ,
boxShadow : shadow ,
},
2024-11-12 19:10:48 -05:00
});
2024-11-08 18:36:43 -05:00
export { baseTheme };