2025-02-18 09:47:54 -08:00
import { typographyLevels } from "./constants" ;
const fontFamilyPrimary = '"Inter" , sans-serif' ;
// const fontFamilySecondary = '"Avenir", sans-serif';
/* TODO take the color out from here */
const shadow =
"0px 4px 24px -4px rgba(16, 24, 40, 0.08), 0px 3px 3px -3px rgba(16, 24, 40, 0.03)" ;
const baseTheme = ( palette ) => ({
typography : {
fontFamily : fontFamilyPrimary ,
2025-05-10 02:31:16 +10:00
fontSize : typographyLevels . base ,
2025-02-18 09:47:54 -08:00
h1 : {
fontSize : typographyLevels . xl ,
color : palette . primary . contrastText ,
fontWeight : 500 ,
},
h2 : {
fontSize : typographyLevels . l ,
color : palette . primary . contrastTextSecondary ,
fontWeight : 400 ,
},
// CAIO_REVIEW, need a brighter color for dark bg
h2DarkBg : {
fontSize : typographyLevels . l ,
color : palette . primary . contrastTextSecondaryDarkBg ,
fontWeight : 400 ,
},
body1 : {
fontSize : typographyLevels . m ,
color : palette . primary . contrastTextTertiary ,
fontWeight : 400 ,
},
body2 : {
fontSize : typographyLevels . s ,
color : palette . primary . contrastTextTertiary ,
fontWeight : 400 ,
},
},
/* TODO change to 4 */
spacing : 2 ,
/* 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*/
/* TODO All these should live inside of a component*/
components : {
MuiButton : {
defaultProps : {
disableRipple : true ,
},
styleOverrides : {
root : ({ theme }) => ({
variants : [
{
props : ( props ) => props . color === "accent" ,
style : {
"&:hover" : {
backgroundColor : theme . palette . accent . darker ,
},
},
},
{
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 ,
},
},
},
{
props : ( props ) => props . variant === "group" ,
style : {
/* color: theme.palette.secondary.contrastText, */
color : theme . palette . primary . contrastText ,
backgroundColor : theme . palette . primary . main ,
border : 1 ,
borderStyle : "solid" ,
borderColor : theme . palette . primary . lowContrast ,
},
},
{
props : ( props ) => props . variant === "group" && props . filled === "true" ,
style : {
backgroundColor : theme . palette . secondary . main ,
},
},
/* {
props: (props) => props.variant === "contained",
style: {
backgroundColor: `${theme.palette.accent.main} !important`,
},
}, */
{
props : ( props ) =>
props . variant === "contained" && props . color === "secondary" ,
style : {
border : 1 ,
borderStyle : "solid" ,
borderColor : theme . palette . primary . lowContrast ,
},
},
{
props : ( props ) => {
return (
props . variant === "contained" &&
props . disabled &&
props ? . classes ? . loadingIndicator === undefined // Do not apply to loading button
);
},
style : {
backgroundColor : ` ${ theme . palette . secondary . main } !important` ,
color : ` ${ theme . palette . secondary . contrastText } !important` ,
},
},
2025-04-17 15:25:10 -07:00
2025-03-06 17:46:43 -08:00
{
2025-04-17 15:25:10 -07:00
props : { variant : "text" , color : "info" },
2025-03-06 17:46:43 -08:00
style : {
2025-04-17 15:25:10 -07:00
textDecoration : "underline" ,
color : theme . palette . primary . contrastText ,
padding : 0 ,
margin : 0 ,
fontSize : typographyLevels . m ,
fontWeight : theme . typography . body2 . fontWeight ,
backgroundColor : "transparent" ,
"&:hover" : {
backgroundColor : "transparent" ,
textDecoration : "underline" ,
},
"&.Mui-disabled" : {
backgroundColor : "transparent" ,
color : theme . palette . text . primary ,
opacity : 0.5 ,
"&.MuiButton-text" : {
backgroundColor : "transparent" ,
},
},
minWidth : 0 ,
boxShadow : "none" ,
border : "none" ,
2025-03-06 17:46:43 -08:00
},
2025-04-17 15:25:10 -07:00
},
2025-02-18 09:47:54 -08:00
],
2025-02-20 15:18:03 -08:00
height : 34 ,
2025-02-18 09:47:54 -08:00
fontWeight : 400 ,
borderRadius : 4 ,
boxShadow : "none" ,
textTransform : "none" ,
"&:focus" : {
outline : "none" ,
},
"&:hover" : {
boxShadow : "none" ,
},
"&.Mui-disabled" : {
backgroundColor : theme . palette . secondary . main ,
color : theme . palette . primary . contrastText ,
},
"&.MuiButton-root" : {
"&:disabled" : {
backgroundColor : theme . palette . secondary . main ,
color : theme . palette . primary . contrastText ,
},
"&.MuiButton-colorAccent:hover" : {
boxShadow : `0 0 0 1px ${ theme . palette . accent . main } ` , // CAIO_REVIEW, this should really have a solid BG color
},
},
"&.MuiButton-loading" : {
"&:disabled" : {
color : "transparent" ,
},
"& .MuiButton-loadingIndicator" : {
color : theme . palette . primary . contrastText ,
},
},
}),
},
},
MuiIconButton : {
styleOverrides : {
root : ({ theme }) => ({
padding : 4 ,
transition : "none" ,
"&:hover" : {
backgroundColor : theme . palette . primary . lowContrast ,
},
}),
},
},
MuiPaper : {
styleOverrides : {
root : ({ theme }) => {
return {
marginTop : 4 ,
padding : 0 ,
border : 1 ,
borderStyle : "solid" ,
borderColor : theme . palette . primary . lowContrast ,
borderRadius : 4 ,
boxShadow : shadow ,
backgroundColor : theme . palette . primary . main ,
backgroundImage : "none" ,
};
},
},
},
MuiList : {
styleOverrides : {
root : {
padding : 0 ,
},
},
},
MuiListItemButton : {
styleOverrides : {
root : {
transition : "none" ,
},
},
},
2025-04-02 15:00:00 +05:30
MuiListItemText : {
styleOverrides : {
root : ({ theme }) => ({
"& .MuiTypography-root" : {
color : theme . palette . primary . contrastText ,
},
}),
},
},
2025-02-18 09:47:54 -08:00
MuiMenuItem : {
styleOverrides : {
root : ({ theme }) => ({
borderRadius : 4 ,
backgroundColor : "inherit" ,
padding : "4px 6px" ,
color : theme . palette . primary . contrastTextSecondary ,
fontSize : 13 ,
margin : 2 ,
minWidth : 100 ,
"&:hover, &.Mui-selected, &.Mui-selected:hover, &.Mui-selected.Mui-focusVisible" :
{
backgroundColor : theme . palette . primary . lowContrast ,
},
}),
},
},
MuiTableCell : {
styleOverrides : {
root : ({ theme }) => ({
2025-05-10 16:11:35 -07:00
fontSize : typographyLevels . base ,
2025-02-18 09:47:54 -08:00
borderBottomColor : theme . palette . primary . lowContrast ,
}),
},
},
MuiTableHead : {
styleOverrides : {
root : ({ theme }) => ({
backgroundColor : theme . palette . tertiary . main ,
}),
},
},
MuiPagination : {
styleOverrides : {
root : ({ theme }) => ({
backgroundColor : theme . palette . primary . main ,
border : 1 ,
borderStyle : "solid" ,
borderColor : theme . palette . primary . lowContrast ,
"& button" : {
color : theme . palette . primary . contrastTextTertiary ,
borderRadius : 4 ,
},
"& li:first-of-type button, & li:last-of-type button" : {
border : 1 ,
borderStyle : "solid" ,
borderColor : theme . palette . primary . lowContrast ,
},
}),
},
},
MuiPaginationItem : {
styleOverrides : {
root : ({ theme }) => ({
"&:not(.MuiPaginationItem-ellipsis):hover, &.Mui-selected" : {
backgroundColor : theme . palette . primary . lowContrast ,
},
}),
},
},
MuiSkeleton : {
styleOverrides : {
root : ({ theme }) => ({
backgroundColor : theme . palette . primary . lowContrast ,
}),
},
},
2025-05-08 10:40:36 -07:00
2025-02-18 09:47:54 -08:00
MuiTextField : {
2025-06-12 05:20:16 +05:30
styleOverrides : {
root : ({ theme }) => ({
"& fieldset" : {
borderColor : theme . palette . primary . lowContrast ,
borderRadius : theme . shape . borderRadius ,
},
2025-05-08 10:40:36 -07:00
2025-06-12 05:20:16 +05:30
"& .MuiInputBase-input" : {
padding : ".75em" ,
minHeight : "var(--env-var-height-2)" ,
fontSize : "var(--env-var-font-size-medium)" ,
fontWeight : 400 ,
color : palette . primary . contrastTextSecondary ,
"&.Mui-disabled" : {
opacity : 0.3 ,
WebkitTextFillColor : "unset" ,
},
"& .Mui-focused" : {
/* color: "#ff0000", */
/* borderColor: theme.palette.primary.contrastText, */
},
},
2025-02-18 09:47:54 -08:00
2025-06-12 05:20:16 +05:30
"& .MuiInputBase-input:-webkit-autofill" : {
transition : "background-color 5000s ease-in-out 0s" ,
WebkitBoxShadow : `0 0 0px 1000px ${ theme . palette . primary . main } inset` ,
WebkitTextFillColor : theme . palette . primary . contrastText ,
},
2025-06-12 05:01:09 +05:30
2025-06-12 05:20:16 +05:30
"& .MuiInputBase-input.MuiOutlinedInput-input" : {
padding : "0 var(--env-var-spacing-1-minus) !important" ,
},
2025-06-12 05:01:09 +05:30
2025-06-12 05:20:16 +05:30
"& .MuiOutlinedInput-root" : {
color : theme . palette . primary . contrastTextSecondary ,
borderRadius : 4 ,
},
2025-06-12 05:01:09 +05:30
2025-06-12 05:20:16 +05:30
"& .MuiOutlinedInput-notchedOutline" : {
borderRadius : 4 ,
},
2025-06-12 05:01:09 +05:30
2025-06-12 05:20:16 +05:30
"& .MuiFormHelperText-root" : {
color : palette . error . main ,
opacity : 0.8 ,
fontSize : "var(--env-var-font-size-medium)" ,
marginLeft : 0 ,
},
2025-06-12 05:01:09 +05:30
2025-06-12 05:20:16 +05:30
"& .MuiFormHelperText-root.Mui-error" : {
opacity : 0.8 ,
fontSize : "var(--env-var-font-size-medium)" ,
color : palette . error . main ,
whiteSpace : "nowrap" ,
},
}),
},
2025-02-18 09:47:54 -08:00
},
2025-06-12 05:01:09 +05:30
2025-02-18 09:47:54 -08:00
MuiOutlinedInput : {
styleOverrides : {
root : {
2025-05-08 10:40:36 -07:00
"&.Mui-disabled .MuiOutlinedInput-notchedOutline" : {
borderColor : palette . primary . contrastBorderDisabled ,
},
"&.Mui-disabled:hover .MuiOutlinedInput-notchedOutline" : {
borderColor : palette . primary . contrastBorderDisabled ,
},
"&:hover .MuiOutlinedInput-notchedOutline" : {
2025-06-12 05:01:09 +05:30
borderColor : palette . primary . lowContrast , // Adjust hover border color
2025-05-08 10:40:36 -07:00
},
2025-02-18 09:47:54 -08:00
"&.Mui-focused .MuiOutlinedInput-notchedOutline" : {
2025-05-08 10:40:36 -07:00
borderColor : palette . accent . main , // Adjust focus border color
2025-02-18 09:47:54 -08:00
},
2025-06-12 05:01:09 +05:30
color : palette . primary . contrastText ,
2025-02-18 09:47:54 -08:00
},
},
},
2025-06-13 13:49:54 +08:00
MuiAutocomplete : {
styleOverrides : {
root : ({ theme }) => ({
"& .MuiOutlinedInput-root" : {
paddingTop : 0 ,
paddingBottom : 0 ,
},
"& fieldset" : {
borderColor : theme . palette . primary . lowContrast ,
borderRadius : theme . shape . borderRadius ,
},
"& .MuiOutlinedInput-root:hover:not(:has(input:focus)):not(:has(textarea:focus)) fieldset" :
{
borderColor : theme . palette . primary . lowContrast ,
},
"& .MuiAutocomplete-tag" : {
color : theme . palette . primary . contrastText ,
backgroundColor : theme . palette . primary . lowContrast ,
},
"& .MuiChip-deleteIcon" : {
color : theme . palette . primary . contrastText , // CAIO_REVIEW
},
}),
},
},
2025-02-18 09:47:54 -08:00
MuiTab : {
styleOverrides : {
2025-04-17 15:25:10 -07:00
root : ({ theme }) => ({
color : theme . palette . tertiary . contrastText ,
height : "34px" ,
minHeight : "34px" ,
borderRadius : 0 ,
textTransform : "none" ,
minWidth : "fit-content" ,
padding : ` ${ theme . spacing ( 6 ) } px ${ theme . spacing ( 4 ) } px` ,
fontWeight : 400 ,
"&:focus-visible" : {
color : theme . palette . primary . contrastText ,
borderColor : theme . palette . tertiary . contrastText ,
borderRightColor : theme . palette . primary . lowContrast ,
},
"&.Mui-selected" : {
color : theme . palette . secondary . contrastText ,
},
"&:hover" : {
borderColor : theme . palette . primary . lowContrast ,
},
}),
2025-02-18 09:47:54 -08:00
},
2025-03-06 17:16:45 -08:00
variants : [
2025-03-08 14:40:20 -08:00
{
2025-04-17 15:25:10 -07:00
props : { orientation : "vertical" },
style : ({ theme }) => ({
alignItems : "flex-start" ,
padding : ` ${ theme . spacing ( 1 ) } px ${ theme . spacing ( 2 ) } px ${ theme . spacing ( 1 ) } px ${ theme . spacing ( 6 ) } px` ,
minHeight : theme . spacing ( 12 ),
color : theme . palette . primary . contrastText ,
backgroundColor : theme . palette . primary . main ,
border : "none" ,
borderBottom : "none" ,
borderRight : "none" ,
borderRadius : theme . shape . borderRadius * 3 ,
margin : ` ${ theme . spacing ( 1 ) } px ${ theme . spacing ( 2 ) } px` ,
"&.Mui-selected" : {
color : theme . palette . primary . contrastText ,
backgroundColor : theme . palette . tertiary . main ,
opacity : 1 ,
border : "none" ,
borderBottom : "none" ,
borderRight : "none" ,
borderRadius : theme . shape . borderRadius * 3 ,
minHeight : theme . spacing ( 14 ),
},
"&:hover" : {
backgroundColor : theme . palette . tertiary . main ,
border : "none" ,
borderRadius : theme . shape . borderRadius * 3 ,
minHeight : theme . spacing ( 14 ),
},
}),
2025-03-08 14:40:20 -08:00
},
2025-04-17 15:25:10 -07:00
],
},
2025-02-18 09:47:54 -08:00
MuiSvgIcon : {
styleOverrides : {
root : ({ theme }) => ({
color : theme . palette . primary . contrastTextTertiary ,
}),
},
},
MuiTabs : {
styleOverrides : {
2025-04-17 15:25:10 -07:00
root : ({ theme }) => ({
display : "inline-flex" ,
borderRadius : 0 ,
"& .MuiTabs-indicator" : {
backgroundColor : theme . palette . tertiary . contrastText ,
},
}),
2025-02-18 09:47:54 -08:00
},
2025-03-06 17:16:45 -08:00
variants : [
2025-04-17 15:25:10 -07:00
{
props : { orientation : "vertical" },
style : {
"& .MuiTabs-indicator" : {
display : "none" ,
},
},
2025-03-06 17:16:45 -08:00
},
],
2025-04-17 15:25:10 -07:00
},
2025-02-18 09:47:54 -08:00
MuiSwitch : {
styleOverrides : {
root : ({ theme }) => ({
2025-05-08 15:28:44 +05:30
width : 42 ,
height : 26 ,
padding : 0 ,
"& .MuiSwitch-switchBase" : {
padding : 0 ,
margin : 2 ,
transitionDuration : "300ms" ,
"&.Mui-checked" : {
transform : "translateX(16px)" ,
color : "#fff" ,
"& + .MuiSwitch-track" : {
backgroundColor : theme . palette . accent . main ,
opacity : 1 ,
border : 0 ,
},
},
},
"& .MuiSwitch-thumb" : {
boxSizing : "border-box" ,
width : 22 ,
height : 22 ,
},
2025-02-18 09:47:54 -08:00
"& .MuiSwitch-track" : {
2025-05-08 15:28:44 +05:30
borderRadius : 13 ,
backgroundColor : theme . palette . secondary . light ,
opacity : 1 ,
2025-02-18 09:47:54 -08:00
},
}),
},
},
2025-04-02 15:00:00 +05:30
MuiSelect : {
styleOverrides : {
root : ({ theme }) => ({
"& .MuiOutlinedInput-input" : {
color : theme . palette . primary . contrastText ,
},
"& .MuiOutlinedInput-notchedOutline" : {
borderColor : theme . palette . primary . lowContrast ,
borderRadius : theme . shape . borderRadius ,
},
"& .MuiSelect-icon" : {
color : theme . palette . primary . contrastTextSecondary , // Dropdown + color
},
"&:hover" : {
backgroundColor : theme . palette . primary . main , // Background on hover
},
"&:hover .MuiOutlinedInput-notchedOutline" : {
borderColor : theme . palette . primary . lowContrast ,
},
}),
},
},
2025-03-04 13:36:42 +05:30
MuiButtonGroup : {
styleOverrides : {
root : ({ theme }) => ({
ml : "auto" ,
"& .MuiButtonBase-root, & .MuiButtonBase-root:hover" : {
2025-05-08 10:40:36 -07:00
borderColor : theme . palette . primary . contrastBorder ,
2025-03-04 13:36:42 +05:30
width : "auto" ,
whiteSpace : "nowrap" ,
},
}),
},
},
2025-03-05 00:32:04 +05:30
// This code is added for clock in maintenance page
// code starts from here.
2025-03-07 01:10:06 +05:30
MuiClock : {
// Directly target the clock component
styleOverrides : {
root : ({ theme }) => ({
backgroundColor : theme . palette . primary . main , // Alternative target
"& .MuiClock-clock" : {
// Inner clock face
backgroundColor : theme . palette . secondary . main ,
},
}),
},
},
2025-03-05 00:32:04 +05:30
MuiClockPicker : {
styleOverrides : {
root : ({ theme }) => ({
2025-03-07 01:10:06 +05:30
backgroundColor : theme . palette . secondary . main , // Outer container background
"& .MuiClock-root" : {
2025-03-05 00:32:04 +05:30
color : theme . palette . primary . lowContrast ,
},
"& .MuiClock-clock" : {
2025-03-07 01:10:06 +05:30
backgroundColor : theme . palette . background . default , // Clock face background
borderColor : theme . palette . secondary . lowContrast ,
2025-03-05 00:32:04 +05:30
},
}),
},
},
// The clock pointer ( pointer to number like hour/minute hand)
MuiClockPointer : {
styleOverrides : {
root : ({ theme }) => ({
2025-03-07 01:10:06 +05:30
// Main pointer line color
2025-03-05 00:32:04 +05:30
backgroundColor : theme . palette . accent . main ,
2025-03-07 01:10:06 +05:30
"& .MuiClockPointer-thumb" : {
backgroundColor : theme . palette . grey [ 500 ], // Use your desired grey
2025-03-05 00:32:04 +05:30
},
}),
},
},
// This is for numbers in the clock (circular one's)
MuiClockNumber : {
styleOverrides : {
root : ({ theme }) => ({
color : theme . palette . primary . contrastText ,
"&.Mui-selected" : {
color : theme . palette . accent . contrastText ,
backgroundColor : theme . palette . accent . main ,
},
}),
},
},
// This is for 00:00 am and pm (top bar)
MuiTimePickerToolbar : {
styleOverrides : {
root : ({ theme }) => ({
2025-03-09 07:20:05 +05:30
backgroundColor : theme . palette . secondary . lowContrast ,
2025-03-07 01:10:06 +05:30
// General text color
2025-03-05 00:32:04 +05:30
"& .MuiTypography-root" : {
2025-03-10 05:40:12 +05:30
color : theme . palette . primary . contrastTextTertiary ,
2025-03-07 01:10:06 +05:30
},
// Selected time (hour/minute) color
"& .Mui-selected" : {
2025-03-09 07:20:05 +05:30
color : ` ${ theme . palette . accent . main } !important` ,
2025-03-07 01:10:06 +05:30
},
// AM/PM buttons color
"& .MuiButtonBase-root" : {
"&.Mui-selected" : {
backgroundColor : theme . palette . accent . main ,
},
2025-03-05 00:32:04 +05:30
},
}),
},
},
// left and right direction style
MuiPickersArrowSwitcher : {
styleOverrides : {
root : ({ theme }) => ({
"& .MuiIconButton-root" : {
color : theme . palette . primary . contrastText ,
},
}),
},
},
// cancel and okay actions style
MuiDialogActions : {
styleOverrides : {
root : ({ theme }) => ({
backgroundColor : theme . palette . primary . main ,
}),
},
},
// code ends here.
// For labels of input fields
MuiInputLabel : {
styleOverrides : {
root : ({ theme }) => ({
"&.Mui-focused" : {
color : theme . palette . accent . main ,
},
}),
},
},
2025-06-08 23:12:48 +05:30
MuiTypography : {
variants : [
{
props : { variant : "monitorName" },
style : {
fontSize : typographyLevels . xl ,
color : palette . primary . contrastText ,
fontWeight : 500 ,
overflow : "hidden" ,
textOverflow : "ellipsis" ,
whiteSpace : "nowrap" ,
maxWidth : "calc((100vw - var(--env-var-width-2)) / 2)" ,
},
},
{
props : { variant : "monitorUrl" },
style : {
fontSize : typographyLevels . l ,
color : palette . primary . contrastTextSecondary ,
fontWeight : "bolder" ,
fontFamily : "monospace" ,
overflow : "hidden" ,
textOverflow : "ellipsis" ,
whiteSpace : "nowrap" ,
maxWidth : "calc((100vw - var(--env-var-width-2)) / 2)" ,
},
},
],
},
2025-02-18 09:47:54 -08:00
},
shape : {
borderRadius : 2 ,
borderThick : 2 ,
boxShadow : shadow ,
},
});
export { baseTheme };