Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | 10x 108x 6x 102x 102x 108x 101x 10x 10x 2009x 2009x 2009x 10x 10x 10x 789x 789x 789x | import { alpha } from "@mui/material/styles";
/** Active theme preset gradient, with a primary/secondary fallback. */
export const getThemeGradient = (theme) => {
if (theme.presetGradient) {
return theme.presetGradient;
}
const main = theme.palette.primary.main;
const secondary = theme.palette.secondary?.main || theme.palette.primary.dark || main;
return `linear-gradient(135deg, ${main} 0%, ${secondary} 100%)`;
};
/** Shared sx for primary gradient bars (app headers, footers). */
export const getThemeGradientBarSx = (theme) => ({
background: getThemeGradient(theme),
color: theme.palette.primary.contrastText || "#FFFFFF",
});
/** Shared table spacing aligned with MUI table overrides */
export const HERO_TABLE_SPACING = {
cellPx: 2.5,
cellPy: 1.75,
headPy: 2,
edgePx: 3.5,
toolbarPx: 2.5,
toolbarPy: 2,
footerPx: 2.5,
footerPy: 1.25,
};
/** Theme-aware table + soft chip tokens */
export const getHeroTableTokens = (theme) => {
const isDark = theme.palette.mode === "dark";
const divider = theme.palette.divider;
return {
border: divider,
headerBg: theme.palette.background.neutral,
headerText: theme.palette.text.secondary,
bodyText: theme.palette.text.primary,
rowBg: theme.palette.background.paper,
rowHover: isDark ? alpha(theme.palette.common.white, 0.06) : alpha(theme.palette.grey[500], 0.08),
rowBorder: divider,
toolbarBg: theme.palette.background.neutral,
inputBg: theme.palette.background.paper,
paper: theme.palette.background.paper,
accent: theme.palette.primary.main,
accentSoft: alpha(theme.palette.primary.main, isDark ? 0.2 : 0.16),
radius: `${(theme.shape.borderRadius || 8) * 2}px`,
cellRadius: `${theme.shape.borderRadius || 8}px`,
};
};
/** Map semantic color names to MUI palette keys */
export const SOFT_CHIP_COLOR_MAP = {
accent: "primary",
default: "default",
success: "success",
warning: "warning",
danger: "error",
info: "info",
};
/** Soft chip colors — mirrors chip override logic */
export const getSoftChipColors = (theme, color = "default") => {
const lightMode = theme.palette.mode === "light";
const mapped = SOFT_CHIP_COLOR_MAP[color] || color;
if (mapped === "default" || !theme.palette[mapped]?.main) {
return {
bgcolor: alpha(theme.palette.grey[500], 0.16),
color: theme.palette.text.primary,
};
}
const paletteColor = theme.palette[mapped];
return {
bgcolor: alpha(paletteColor.main, 0.16),
color: paletteColor[lightMode ? "dark" : "light"],
};
};
export const getCatalogRowSoftSx = (locked, theme) => {
const paletteKey = locked ? "warning" : "success";
const color = theme.palette[paletteKey]?.main || theme.palette.primary.main;
return {
borderLeft: "3px solid",
borderLeftColor: color,
"& td": {
bgcolor: alpha(color, theme.palette.mode === "dark" ? 0.12 : 0.14),
},
"&:hover td": {
bgcolor: `${alpha(color, theme.palette.mode === "dark" ? 0.18 : 0.22)} !important`,
},
};
};
|