Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

583 righe
19 KiB

  1. import {createTheme} from "@mui/material";
  2. import Palette from "./palette";
  3. import Typography from "./typography";
  4. import {GENERAL_TABLE_BOARDER_COLOR, TABLE_HEADER_TEXT_COLOR, CONTAINED_PRIMARY_BLUE, VALIDATION_ERROR_COLOR} from "./colorConst";
  5. const FONT_SIZE = '1.1rem';
  6. const TABLE_FONT_SIZE = '1.0rem';
  7. const HELPER_FONT_SIZE = '0.9rem';
  8. const ROW_HEIGHT = '46px';
  9. const theme = Palette('light', 'default');
  10. export const CARD_MAX_WIDTH = "98%"
  11. const themeTypography = Typography(
  12. `'Public Sans', sans-serif`,
  13. );
  14. export const PNSPS_THEME = createTheme({
  15. palette: theme.palette,
  16. typography: themeTypography,
  17. cancel: {
  18. main: '#424242', // dark gray, WCAG safe
  19. contrastText: '#FFFFFF'
  20. },
  21. components: {
  22. MuiImage: {
  23. root: {
  24. position: 'relative',
  25. '&:hover': {
  26. '&::after': {
  27. content: '""',
  28. position: 'absolute',
  29. top: 0,
  30. left: 0,
  31. width: '100%',
  32. height: '100%',
  33. background: 'rgba(0, 0, 0, 0.5)',
  34. opacity: 0,
  35. transition: 'opacity 0.3s ease',
  36. },
  37. '&:hover::after': {
  38. opacity: 1,
  39. },
  40. },
  41. },
  42. },
  43. MuiButton: {
  44. defaultProps: {
  45. disableRipple: true,
  46. },
  47. styleOverrides: {
  48. root: ({ ownerState }) => ({
  49. ...(ownerState.color === "cancel" && {
  50. borderColor: "#9E9E9E",
  51. }),
  52. '&:active': {
  53. boxShadow: 'none',
  54. transform: 'none',
  55. },
  56. }),
  57. contained: ({ theme, ownerState }) => ({
  58. ...(ownerState.color === "cancel" && {
  59. border: "2px solid #9E9E9E",
  60. boxShadow: "none",
  61. }),
  62. '&:active': {
  63. backgroundColor: theme.palette[ownerState.color]?.main ?? theme.palette.primary.main,
  64. boxShadow: 'none',
  65. },
  66. }),
  67. outlined: {
  68. '&:active': {
  69. backgroundColor: 'transparent',
  70. },
  71. },
  72. },
  73. },
  74. MuiInputAdornment: {
  75. styleOverrides: {
  76. root: {
  77. marginLeft: '-1px',
  78. //marginRight: '0px',
  79. },
  80. },
  81. },
  82. MuiFormHelperText: {
  83. styleOverrides: {
  84. root: {
  85. fontSize: HELPER_FONT_SIZE, // Adjust the font size as needed
  86. },
  87. },
  88. },
  89. MuiPickersBasePicker: {
  90. styleOverrides: {
  91. toolbar: {
  92. height: ROW_HEIGHT // Set the desired height value here
  93. }
  94. }
  95. },
  96. MuiPickersDay: {
  97. root:{
  98. height: ROW_HEIGHT,
  99. },
  100. day: {
  101. padding: '20px', // Set the desired padding value here
  102. },
  103. },
  104. MuiButtonBase:{
  105. styleOverrides:{
  106. root:{
  107. '&.MuiChip-root.Mui-disabled':{
  108. opacity: 0.75,
  109. },
  110. '&.MuiButton-root':{
  111. fontSize: '1.2rem',
  112. fontWeight: '600',
  113. alignItems: 'center',
  114. },
  115. }
  116. }
  117. },
  118. MuiIconButton: {
  119. styleOverrides: {
  120. root: {
  121. marginRight: '-2px',
  122. borderRadius: 3
  123. },
  124. marginRight: '-3px',
  125. sizeLarge: {
  126. width: theme.spacing(5.5),
  127. height: theme.spacing(5.5),
  128. fontSize: '1.25rem'
  129. },
  130. sizeMedium: {
  131. width: theme.spacing(4.5),
  132. height: theme.spacing(4.5),
  133. fontSize: '1rem'
  134. },
  135. sizeSmall: {
  136. width: theme.spacing(3.75),
  137. height: theme.spacing(3.75),
  138. fontSize: '0.75rem'
  139. }
  140. }
  141. },
  142. MuiInputLabel: {
  143. styleOverrides: {
  144. root: {
  145. color: 'rgba(0, 0, 0, 0.8)',
  146. fontSize: '1.15rem',
  147. '&.Mui-focused': {
  148. color: CONTAINED_PRIMARY_BLUE,
  149. },
  150. '&.Mui-error': {
  151. color: VALIDATION_ERROR_COLOR,
  152. },
  153. '&.Mui-focused.Mui-error': {
  154. color: VALIDATION_ERROR_COLOR,
  155. },
  156. },
  157. },
  158. },
  159. MuiChip:{
  160. styleOverrides: {
  161. label: {
  162. lineHeight: 'normal',
  163. whiteSpace: "inherit",
  164. paddingTop: '2px',
  165. paddingBottom: '2px'
  166. },
  167. },
  168. },
  169. MuiAutocomplete: {
  170. styleOverrides: {
  171. tag: {
  172. height: 'auto',
  173. whiteSpace: 'normal',
  174. },
  175. inputRoot: {
  176. maxHeight: '30vh', // Set the desired height value here
  177. },
  178. root: {
  179. minHeight: ROW_HEIGHT,
  180. '&:MuiAutocomplete-input': {
  181. display: 'flex',
  182. alignItems: 'center',
  183. },
  184. },
  185. popupIndicator: {
  186. height: '30px',
  187. width: '30px',
  188. },
  189. endAdornment: {
  190. root: {
  191. height: '30px',
  192. width: '30px',
  193. marginRight: '-2px',
  194. marginBottom: '3px',
  195. borderRadius: 3
  196. },
  197. marginRight: '-3px',
  198. sizeLarge: {
  199. width: theme.spacing(5.5),
  200. height: theme.spacing(5.5),
  201. fontSize: '1.25rem'
  202. },
  203. sizeMedium: {
  204. width: theme.spacing(3.75),
  205. height: theme.spacing(3.75),
  206. fontSize: '1rem'
  207. },
  208. sizeSmall: {
  209. width: theme.spacing(3.75),
  210. height: theme.spacing(3.75),
  211. fontSize: '0.75rem'
  212. },
  213. top: "auto"
  214. },
  215. },
  216. },
  217. MuiInputBase: {
  218. root: {
  219. padding: '2px', // Set the desired padding value here
  220. },
  221. },
  222. MuiOutlinedInput: {
  223. styleOverrides: {
  224. input: {
  225. padding: '10.5px 14px 10.5px 12px',
  226. '&.MuiOutlinedInput-input.Mui-disabled': {
  227. WebkitTextFillColor: 'rgba(0, 0, 0, 1)',
  228. },
  229. color: 'rgba(0, 0, 0, 0.85)',
  230. },
  231. root: {
  232. /* =============================
  233. Issue 1: Input boundary contrast
  234. ============================= */
  235. '& .MuiOutlinedInput-notchedOutline': {
  236. borderColor: '#767676', // >= 3:1 on white
  237. borderWidth: 1,
  238. },
  239. '&:hover .MuiOutlinedInput-notchedOutline': {
  240. borderColor: '#767676',
  241. },
  242. '&.Mui-focused .MuiOutlinedInput-notchedOutline': {
  243. borderColor: CONTAINED_PRIMARY_BLUE,
  244. borderWidth: 3, // thick focus indicator
  245. },
  246. /* Prevent “shrinking” of inner area when border gets thicker */
  247. '&.Mui-focused .MuiOutlinedInput-input': {
  248. padding: '8.5px 12px 8.5px 10px', // 10.5-2, 14-2, 10.5-2, 12-2
  249. },
  250. '&.Mui-focused.MuiInputBase-sizeSmall .MuiOutlinedInput-input': {
  251. padding: '5.5px 6px 5.5px 10px', // 7.5-2, 8-2, 7.5-2, 12-2
  252. },
  253. /* Error state — same red as FormHelperText (#B00020) */
  254. '&.Mui-error .MuiOutlinedInput-notchedOutline': {
  255. borderColor: VALIDATION_ERROR_COLOR,
  256. borderWidth: 1,
  257. },
  258. '&.Mui-error:hover .MuiOutlinedInput-notchedOutline': {
  259. borderColor: VALIDATION_ERROR_COLOR,
  260. },
  261. '&.Mui-error.Mui-focused .MuiOutlinedInput-notchedOutline': {
  262. borderColor: VALIDATION_ERROR_COLOR,
  263. borderWidth: 3,
  264. },
  265. height: ROW_HEIGHT,
  266. },
  267. inputSizeSmall: {
  268. padding: '7.5px 8px 7.5px 12px',
  269. },
  270. inputMultiline: {
  271. root: {
  272. minHeight: ROW_HEIGHT,
  273. maxHeight: '50vh',
  274. },
  275. padding: '7.5px 8px 7.5px 12px',
  276. },
  277. },
  278. },
  279. MuiCheckbox: {
  280. defaultProps: {
  281. disableRipple: true,
  282. },
  283. styleOverrides: {
  284. root: {
  285. /* Default (unchecked) state — darker */
  286. color: '#595959', // >= 3:1 on white
  287. /* Hover (keep contrast) */
  288. '&:hover': {
  289. backgroundColor: 'transparent',
  290. },
  291. '&:active': {
  292. backgroundColor: 'transparent',
  293. },
  294. /* Checked state — same blue as applyPublicNotice button */
  295. '&.Mui-checked': {
  296. color: CONTAINED_PRIMARY_BLUE,
  297. },
  298. /* Focus-visible */
  299. '&.Mui-focusVisible': {
  300. boxShadow: '0 0 0 3px rgba(25, 118, 210, 0.35)',
  301. },
  302. },
  303. },
  304. },
  305. MuiRadio: {
  306. defaultProps: {
  307. disableRipple: true,
  308. },
  309. styleOverrides: {
  310. root: {
  311. color: '#595959',
  312. '&:hover': {
  313. backgroundColor: 'transparent',
  314. },
  315. '&:active': {
  316. backgroundColor: 'transparent',
  317. },
  318. '&.Mui-checked': {
  319. color: CONTAINED_PRIMARY_BLUE,
  320. },
  321. '&.Mui-focusVisible': {
  322. boxShadow: '0 0 0 3px rgba(25, 118, 210, 0.35)',
  323. },
  324. },
  325. },
  326. },
  327. MuiTextField: {
  328. styleOverrides: {
  329. root: {
  330. '& .MuiInputBase-input': {
  331. fontSize: FONT_SIZE,
  332. display: 'flex',
  333. alignItems: 'center',
  334. color: 'rgba(0, 0, 0, 0.85)'
  335. },
  336. '& .MuiInputBase-root': {
  337. //height: '40px',
  338. minHeight: ROW_HEIGHT,
  339. maxHeight: ROW_HEIGHT,
  340. boxSizing: 'border-box', // Ensure the background shape follows the size of the TextField
  341. //padding: '1px', // Adjust the padding as needed
  342. },
  343. '& .MuiInputBase-input:disabled': {
  344. color: 'rgba(0, 0, 0, 1)',
  345. backgroundColor: "#f8f8f8",
  346. //backgroundColor: '#777777', // Set background color to #777777 for disabled state
  347. //color: '#010101', // Set text color to #111111 for disabled state
  348. },
  349. '& .Mui-focused.MuiAutocomplete-input': {
  350. color: "red"
  351. },
  352. },
  353. },
  354. },
  355. MuiTableCell: {
  356. styleOverrides: {
  357. root: {
  358. fontSize: TABLE_FONT_SIZE,
  359. borderColor: theme.palette.divider
  360. },
  361. head: {
  362. fontWeight: 600,
  363. paddingTop: 3,
  364. paddingBottom: 3
  365. }
  366. }
  367. },
  368. MuiTablePagination:{
  369. styleOverrides:{
  370. root:{
  371. fontSize: HELPER_FONT_SIZE,
  372. },
  373. selectLabel:{
  374. fontSize: HELPER_FONT_SIZE,
  375. },
  376. displayedRows:{
  377. fontSize: HELPER_FONT_SIZE,
  378. }
  379. }
  380. },
  381. MuiDataGrid: {
  382. styleOverrides: {
  383. '&>.MuiDataGrid-main': {
  384. '&>.MuiDataGrid-columnHeaders': {
  385. borderBottom: 'none',
  386. fontWeight: '900',
  387. },
  388. },
  389. root: {
  390. fontSize: TABLE_FONT_SIZE, // Set the font size
  391. maxWidth: '98vw',
  392. border: 'none !important',
  393. '& .MuiDataGrid-cell': {
  394. whiteSpace: 'normal', // Enable auto-wrapping
  395. wordBreak: 'break-word', // Break words if needed
  396. },
  397. },
  398. footerContainer:{
  399. maxHeight: "40px",
  400. minHeight: "40px",
  401. },
  402. editInputCell:{
  403. fontSize: TABLE_FONT_SIZE,
  404. },
  405. cell: {
  406. fontSize: TABLE_FONT_SIZE,
  407. borderBottom: 'none',
  408. '& .MuiDataGrid-cellValue': {
  409. whiteSpace: 'normal', // Enable auto-wrapping
  410. wordBreak: 'break-word', // Break words if needed
  411. },
  412. },
  413. columnHeaderCell: {
  414. '&:focus': {
  415. outline: 'none', // Remove the outline on focus
  416. },
  417. },
  418. columnHeaders: {
  419. borderBottom: '1px solid ' + GENERAL_TABLE_BOARDER_COLOR + ' !important',
  420. },
  421. columnHeader: {
  422. color: TABLE_HEADER_TEXT_COLOR,
  423. fontSize: TABLE_FONT_SIZE,
  424. '&:focus': {
  425. outline: 'none', // Remove the outline on focus
  426. },
  427. '&:not(:last-child)': {
  428. borderRight: 'none', // Remove the border between column headers
  429. },
  430. fontWeight: '900',
  431. },
  432. row: {
  433. borderBottom: 'none',
  434. },
  435. pagination: {
  436. borderTop: 'none !important',
  437. fontSize: TABLE_FONT_SIZE,
  438. "& .MuiTablePagination-actions": {
  439. border: 'none', // Remove the border around the pagination actions
  440. }
  441. },
  442. '& .MuiPaginationItem-root': {
  443. borderRadius: 0,
  444. },
  445. },
  446. },
  447. MuiCssBaseline: {
  448. styleOverrides: {
  449. '.MuiDataGrid-root .MuiDataGrid-row': {
  450. borderBottom: 'none', // Disable the border under each record
  451. },
  452. '.MuiDataGrid-root .MuiDataGrid-columnHeader': {
  453. borderBottom: 'none', // Disable the border near the column headers
  454. },
  455. },
  456. },
  457. MuiTab: {
  458. defaultProps: {
  459. disableRipple: true,
  460. },
  461. styleOverrides: {
  462. root: {
  463. fontSize: TABLE_FONT_SIZE, // ✅ unchanged
  464. minHeight: 46,
  465. textTransform: 'none',
  466. // Unselected tab text on white – AA compliant
  467. color: '#424242',
  468. // Selected tab text – AA compliant blue
  469. '&.Mui-selected': {
  470. color: '#1565C0',
  471. },
  472. // Hover (optional but consistent)
  473. '&:hover': {
  474. color: '#1565C0',
  475. },
  476. '&:active': {
  477. backgroundColor: 'transparent',
  478. },
  479. '&:active:not(.Mui-selected)': {
  480. color: '#424242',
  481. },
  482. // ✅ Keyboard TAB focus (visible & accessible)
  483. '&.Mui-focusVisible': {
  484. outline: '3px solid rgba(21, 101, 192, 0.55)',
  485. outlineOffset: '3px',
  486. borderRadius: '6px',
  487. },
  488. },
  489. },
  490. },
  491. MuiTabs: {
  492. styleOverrides: {
  493. vertical: {
  494. overflow: 'visible',
  495. },
  496. // ✅ Selected tab indicator – AA compliant blue
  497. indicator: {
  498. backgroundColor: '#1565C0',
  499. height: '3px',
  500. },
  501. },
  502. },
  503. MuiFormLabel: {
  504. styleOverrides: {
  505. root:{
  506. color: "#000000"
  507. }
  508. }
  509. },
  510. MuiTabPanel:{
  511. styleOverrides:{
  512. root:{
  513. padding: 0
  514. }
  515. }
  516. }
  517. },
  518. });
  519. export const ARS_NAV_THEME = createTheme({
  520. typography: {
  521. fontSize: 14,
  522. },
  523. });
  524. export const ARS_LOGIN_THEME = createTheme({
  525. components: {
  526. MuiFormHelperText: {
  527. styleOverrides: {
  528. root: {
  529. fontSize: HELPER_FONT_SIZE, // Adjust the font size as needed
  530. },
  531. },
  532. },
  533. MuiInputLabel: {
  534. styleOverrides: {
  535. root: {
  536. fontSize: '1.15rem',
  537. },
  538. },
  539. },
  540. MuiTextField: {
  541. styleOverrides: {
  542. root: {
  543. '& .MuiInputBase-input': {
  544. fontSize: '1.3rem',
  545. display: 'flex',
  546. alignItems: 'flex-end',
  547. },
  548. '& .MuiInputBase-root': {
  549. height: '50px',
  550. },
  551. },
  552. },
  553. },
  554. },
  555. });