|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472 |
- import { ThemeOptions, createTheme } from "@mui/material";
- import palette from "./palette";
-
- // Used only to create transitions
- const defaultFontSize = 18;
- const muiTheme = createTheme();
-
- const components: ThemeOptions["components"] = {
- MuiAppBar: {
- styleOverrides: {
- colorDefault: {
- backgroundColor: palette.background.paper,
- },
- },
- },
- MuiAvatar: {
- styleOverrides: {
- root: {
- fontSize: defaultFontSize,
- fontWeight: 600,
- letterSpacing: 0,
- },
- },
- },
- MuiButton: {
- styleOverrides: {
- root: {
- borderRadius: "12px",
- textTransform: "none",
- },
- sizeSmall: {
- padding: "6px 16px",
- },
- sizeMedium: {
- padding: "8px 20px",
- },
- sizeLarge: {
- padding: "11px 24px",
- },
- textSizeSmall: {
- padding: "7px 12px",
- },
- textSizeMedium: {
- padding: "9px 16px",
- },
- textSizeLarge: {
- padding: "12px 16px",
- },
- },
- },
- MuiAlert: {
- styleOverrides: {
- root: {
- borderRadius: 8,
- },
- },
- },
- MuiPaper: {
- styleOverrides: {
- rounded: {
- borderRadius: 20,
- [`&.MuiPaper-elevation1`]: {
- boxShadow:
- "0px 5px 22px rgba(0, 0, 0, 0.04), 0px 0px 0px 0.5px rgba(0, 0, 0, 0.03)",
- },
- },
- outlined: {
- borderStyle: "solid",
- borderWidth: 1,
- overflow: "hidden",
- borderColor: palette.neutral[200],
- "&.MuiPaper-rounded": {
- borderRadius: 8,
- },
- },
- },
- },
- MuiCard: {
- styleOverrides: {
- root: {
- borderRadius: 20,
- [`&.MuiPaper-elevation1`]: {
- boxShadow:
- "0px 5px 22px rgba(0, 0, 0, 0.04), 0px 0px 0px 0.5px rgba(0, 0, 0, 0.03)",
- },
- },
- },
- },
- MuiCardContent: {
- styleOverrides: {
- root: {
- padding: "32px 24px",
- "&:last-child": {
- paddingBottom: "32px",
- },
- },
- },
- },
- MuiCardHeader: {
- defaultProps: {
- titleTypographyProps: {
- variant: "h6",
- },
- subheaderTypographyProps: {
- variant: "body2",
- },
- },
- styleOverrides: {
- root: {
- padding: "32px 24px 16px",
- },
- },
- },
- MuiCssBaseline: {
- styleOverrides: {
- "*": {
- boxSizing: "border-box",
- },
- html: {
- MozOsxFontSmoothing: "grayscale",
- WebkitFontSmoothing: "antialiased",
- display: "flex",
- flexDirection: "column",
- minHeight: "100%",
- width: "100%",
- },
- body: {
- display: "flex",
- flex: "1 1 auto",
- flexDirection: "column",
- minHeight: "100%",
- width: "100%",
- },
- "#__next": {
- display: "flex",
- flex: "1 1 auto",
- flexDirection: "column",
- height: "100%",
- width: "100%",
- },
- "#nprogress": {
- pointerEvents: "none",
- },
- "#nprogress .bar": {
- backgroundColor: palette.primary.main,
- height: 3,
- left: 0,
- position: "fixed",
- top: 0,
- width: "100%",
- zIndex: 2000,
- },
- ".swal2-custom-zindex": {
- zIndex: 10000, // Set z-index for SweetAlert2 modals
- },
- },
- },
- MuiInputBase: {
- styleOverrides: {
- root: {
- "&:not(.Mui-disabled)": {
- backgroundColor: "rgba(200, 230, 255, 0.2)", // Slightly cyan-ish background
- "&:hover": {
- backgroundColor: "rgba(200, 230, 255, 0.25)", // Slightly darker on hover
- },
- "&.Mui-focused": {
- backgroundColor: "rgba(200, 230, 255, 0.3)", // More pronounced on focus
- },
- },
- "&.Mui-disabled": {
- backgroundColor: "#ffffff", // White background
- opacity: 1, // Remove MUI's default opacity reduction
- "& .MuiInputBase-input": {
- color: "#000", // Black text
- cursor: "default", // Default cursor
- WebkitTextFillColor: "#000", // Ensure text color isn't grayed out in WebKit browsers
- },
- "& fieldset": {
- backgroundColor: "transparent", // Ensure no extra background effects
- boxShadow: "none", // Remove any box-shadow
- },
- },
- },
- input: {
- "&::placeholder": {
- opacity: 1,
- },
- },
- },
- },
- MuiInput: {
- styleOverrides: {
- input: {
- fontSize: defaultFontSize,
- fontWeight: 500,
- lineHeight: "24px",
- "&::placeholder": {
- color: palette.text.secondary,
- },
- },
- },
- },
- MuiAutocomplete: {
- styleOverrides: {
- root: {
- "& .MuiFilledInput-root": {
- paddingTop: 16,
- paddingBottom: 8,
- },
- },
- },
- },
- MuiFilledInput: {
- styleOverrides: {
- root: {
- backgroundColor: "transparent",
- borderRadius: 8,
- borderStyle: "solid",
- borderWidth: 1,
- overflow: "hidden",
- borderColor: palette.neutral[200],
- transition: muiTheme.transitions.create(["border-color", "box-shadow"]),
- "&:hover": {
- backgroundColor: palette.action.hover,
- },
- "&:before": {
- display: "none",
- },
- "&:after": {
- display: "none",
- },
- [`&.Mui-disabled`]: {
- backgroundColor: "transparent",
- },
- [`&.Mui-focused`]: {
- backgroundColor: "transparent",
- borderColor: palette.primary.main,
- boxShadow: `${palette.primary.main} 0 0 0 2px`,
- },
- [`&.Mui-error`]: {
- borderColor: palette.error.main,
- boxShadow: `${palette.error.main} 0 0 0 2px`,
- },
- },
- input: {
- fontSize: defaultFontSize,
- fontWeight: 500,
- lineHeight: "24px",
- },
- },
- },
- MuiOutlinedInput: {
- styleOverrides: {
- root: {
- "&:hover": {
- backgroundColor: palette.action.hover,
- [`& .MuiOutlinedInput-notchedOutline`]: {
- borderColor: palette.neutral[200],
- },
- },
- [`&.Mui-focused`]: {
- backgroundColor: "transparent",
- [`& .MuiOutlinedInput-notchedOutline`]: {
- borderColor: palette.primary.main,
- boxShadow: `${palette.primary.main} 0 0 0 2px`,
- },
- },
- [`&.Mui-error`]: {
- [`& .MuiOutlinedInput-notchedOutline`]: {
- borderColor: palette.error.main,
- boxShadow: `${palette.error.main} 0 0 0 2px`,
- },
- },
- "&:not(.Mui-disabled)": {
- "&:hover .MuiOutlinedInput-notchedOutline": {
- borderColor: "rgba(0, 0, 0, 0.6)", // Darker border on hover
- },
- "&.Mui-focused .MuiOutlinedInput-notchedOutline": {
- borderColor: "rgba(0, 0, 0, 0.7)", // Darkest border when focused
- },
- },
- "&.Mui-disabled .MuiOutlinedInput-notchedOutline": {
- border: "1px solid #ccc", // Simple gray border for disabled
- },
- },
- input: {
- fontSize: defaultFontSize,
- fontWeight: 500,
- lineHeight: "24px",
- },
- notchedOutline: {
- borderColor: palette.neutral[200],
- transition: muiTheme.transitions.create(["border-color", "box-shadow"]),
- legend: { width: 0 },
- },
- },
- },
- MuiFormLabel: {
- styleOverrides: {
- root: {
- fontSize: defaultFontSize,
- fontWeight: 500,
- [`&.MuiInputLabel-filled`]: {
- transform: "translate(12px, 18px) scale(1)",
- },
- [`&.MuiInputLabel-shrink`]: {
- [`&.MuiInputLabel-standard`]: {
- transform: "translate(0, -1.5px) scale(0.85)",
- },
- [`&.MuiInputLabel-filled`]: {
- transform: "translate(12px, 6px) scale(0.85)",
- },
- [`&.MuiInputLabel-outlined`]: {
- transform: "translate(14px, -9px) scale(0.85)",
- padding: "0 0.25rem",
- background: palette.primary.contrastText,
- },
- },
- "&.Mui-disabled": {
- color: "rgba(0, 0, 0, 0.6)", // Black label
- transform: "translate(14px, 16px) scale(1)", // Position like placeholder
- "&.Mui-focused": {
- transform: "translate(14px, 16px) scale(1)", // Keep label in place when "focused"
- },
- },
- },
- },
- },
- MuiTab: {
- styleOverrides: {
- root: {
- fontSize: defaultFontSize,
- fontWeight: 500,
- lineHeight: 1.71,
- minWidth: "auto",
- minHeight: 48,
- paddingLeft: 0,
- paddingRight: 0,
- textTransform: "none",
- "& + &": {
- marginLeft: 24,
- },
- },
- },
- },
- MuiTableRow: {
- styleOverrides: {
- root: {
- // '&:nth-of-type(odd)': {
- // backgroundColor: 'rgba(0, 0, 0, 0.04)', // Example for odd rows
- // },
- '&:nth-of-type(even)': {
- backgroundColor: palette.neutral[50], // Example for even rows
- },
- },
- },
- },
- MuiTableCell: {
- styleOverrides: {
- root: {
- borderBottomColor: palette.divider,
- padding: "10px 6px",
- fontSize: defaultFontSize - 2,
- // padding: "15px 16px",
- // lineHeight: 1.5,
- },
- },
- },
- MuiTableHead: {
- styleOverrides: {
- root: {
- borderBottom: "none",
- [`& .MuiTableCell-root`]: {
- borderBottom: "none",
- backgroundColor: palette.neutral[50],
- color: palette.neutral[700],
- fontSize: defaultFontSize - 2,
- fontWeight: 600,
- lineHeight: 2,
- letterSpacing: 0.5,
- textTransform: "uppercase",
- },
- [`& .MuiTableCell-paddingCheckbox`]: {
- paddingTop: 4,
- paddingBottom: 4,
- },
- },
- },
- },
- // MuiTableFooter: {
- // styleOverrides: {
- // root: {
- // padding: "1px 6px",
- // },
- // },
- // },
- MuiTextField: {
- defaultProps: {
- variant: "filled",
- },
- },
- MuiMenu: {
- styleOverrides: {
- list: {
- padding: 0,
- },
- },
- },
- MuiMenuItem: {
- styleOverrides: {
- root: {
- margin: "0.5rem",
- borderRadius: 8,
- },
- },
- },
- MuiList: {
- styleOverrides: {
- padding: {
- paddingBlock: "1rem",
- paddingInline: "1rem",
- "&.MuiDataGrid-menuList": {
- paddingBlock: "0.25rem",
- paddingInline: "0.25rem",
- },
- },
- },
- },
- MuiListItem: {
- styleOverrides: {
- root: {
- ":hover": {
- backgroundColor: palette.neutral[100],
- },
- },
- },
- },
- MuiListItemButton: {
- styleOverrides: {
- root: {
- borderRadius: 8,
- marginBlockEnd: "0.5rem",
- },
- },
- },
- MuiListItemText: {
- styleOverrides: {
- root: {
- marginInlineEnd: "2rem",
- },
- primary: {
- fontWeight: 500,
- },
- },
- },
- MuiListItemIcon: {
- styleOverrides: {
- root: {
- color: "inherit",
- },
- },
- },
- MuiSelect: {
- styleOverrides: {
- select: {
- borderRadius: 8,
- },
- },
- },
- };
-
- export default components;
|