@verdaccio/ui-components 4.0.0-next-8.1 → 4.0.0-next-8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/build/Theme/ResetStyles.js +4 -6
  3. package/build/components/ActionBar/ActionBarAction.js +4 -4
  4. package/build/components/Author/styles.js +3 -3
  5. package/build/components/CopyClipboard/CopyToClipBoard.js +3 -3
  6. package/build/components/Dependencies/DependencyBlock.js +4 -4
  7. package/build/components/Developers/Developers.js +4 -4
  8. package/build/components/Developers/Title.js +2 -2
  9. package/build/components/Distribution/styles.js +4 -4
  10. package/build/components/Engines/styles.js +3 -3
  11. package/build/components/Forbidden/Forbidden.js +3 -3
  12. package/build/components/FundButton/FundButton.js +6 -6
  13. package/build/components/Install/Install.js +3 -3
  14. package/build/components/Install/InstallListItem.js +3 -3
  15. package/build/components/Label/Label.js +2 -2
  16. package/build/components/Loading/Spinner/Spinner.js +3 -3
  17. package/build/components/Loading/styles.js +3 -3
  18. package/build/components/LoginDialog/LoginDialogFormError.js +5 -5
  19. package/build/components/LoginDialog/LoginDialogHeader.js +8 -8
  20. package/build/components/Logo/Logo.js +4 -4
  21. package/build/components/NotFound/NotFound.js +3 -3
  22. package/build/components/Package/Package.js +5 -5
  23. package/build/components/Package/styles.js +20 -20
  24. package/build/components/RawViewer/RawViewer.js +2 -2
  25. package/build/components/RegistryInfoDialog/styles.js +8 -8
  26. package/build/components/Repository/Repository.js +5 -5
  27. package/build/components/Search/SearchItem.js +11 -11
  28. package/build/components/Search/styles.js +7 -7
  29. package/build/components/SideBarTitle/SideBarTitle.js +7 -7
  30. package/build/components/UpLinks/styles.js +6 -6
  31. package/build/components/Versions/Versions.js +1 -1
  32. package/build/components/Versions/styles.js +4 -4
  33. package/build/sections/Footer/Footer.js +7 -7
  34. package/build/sections/Footer/styles.js +12 -12
  35. package/build/sections/Header/HeaderSettingsDialog.js +2 -2
  36. package/build/sections/Header/LanguageSwitch.js +5 -5
  37. package/build/sections/Header/RegistryInfoContent/styles.js +3 -3
  38. package/build/sections/Header/styles.js +19 -19
  39. package/build/src/Theme/theme.d.ts +14 -2
  40. package/build/src/components/Dependencies/DependencyBlock.d.ts +2 -1
  41. package/build/src/components/Loading/styles.d.ts +2 -1
  42. package/build/src/components/Package/styles.d.ts +4 -3
  43. package/build/src/components/RegistryInfoDialog/styles.d.ts +3 -2
  44. package/build/src/components/Search/styles.d.ts +2 -1
  45. package/build/src/components/UpLinks/styles.d.ts +3 -2
  46. package/build/src/components/Versions/styles.d.ts +3 -2
  47. package/build/src/sections/Footer/styles.d.ts +6 -5
  48. package/build/src/sections/Header/RegistryInfoContent/styles.d.ts +3 -2
  49. package/build/src/sections/Header/styles.d.ts +3 -2
  50. package/package.json +2 -2
  51. package/src/Theme/ResetStyles.tsx +4 -4
  52. package/src/Theme/theme.ts +15 -4
  53. package/src/components/ActionBar/ActionBarAction.tsx +3 -3
  54. package/src/components/Author/styles.ts +1 -1
  55. package/src/components/CopyClipboard/CopyToClipBoard.tsx +1 -1
  56. package/src/components/Dependencies/DependencyBlock.tsx +2 -2
  57. package/src/components/Deprecated/Deprecated.tsx +3 -1
  58. package/src/components/Developers/Developers.tsx +2 -2
  59. package/src/components/Developers/Title.tsx +1 -1
  60. package/src/components/Distribution/styles.ts +1 -1
  61. package/src/components/Engines/styles.ts +1 -1
  62. package/src/components/Forbidden/Forbidden.tsx +1 -1
  63. package/src/components/FundButton/FundButton.tsx +3 -3
  64. package/src/components/Install/Install.tsx +1 -1
  65. package/src/components/Install/InstallListItem.tsx +2 -1
  66. package/src/components/Keywords/Keywords.tsx +2 -1
  67. package/src/components/Label/Label.tsx +1 -1
  68. package/src/components/Loading/Spinner/Spinner.tsx +1 -1
  69. package/src/components/Loading/styles.ts +1 -1
  70. package/src/components/LoginDialog/LoginDialogFormError.tsx +3 -3
  71. package/src/components/LoginDialog/LoginDialogHeader.tsx +6 -6
  72. package/src/components/Logo/Logo.tsx +3 -3
  73. package/src/components/NotFound/NotFound.tsx +1 -1
  74. package/src/components/Package/Package.tsx +1 -1
  75. package/src/components/Package/styles.ts +8 -8
  76. package/src/components/RawViewer/RawViewer.tsx +5 -3
  77. package/src/components/RegistryInfoDialog/styles.ts +5 -5
  78. package/src/components/Repository/Repository.tsx +2 -2
  79. package/src/components/Search/SearchItem.tsx +6 -6
  80. package/src/components/Search/styles.ts +5 -5
  81. package/src/components/SideBarTitle/SideBarTitle.tsx +3 -3
  82. package/src/components/UpLinks/styles.ts +3 -3
  83. package/src/components/Versions/HistoryList.tsx +2 -1
  84. package/src/components/Versions/Versions.tsx +1 -1
  85. package/src/components/Versions/styles.ts +2 -2
  86. package/src/sections/Footer/Footer.tsx +2 -2
  87. package/src/sections/Footer/styles.ts +7 -7
  88. package/src/sections/Header/HeaderSettingsDialog.tsx +1 -1
  89. package/src/sections/Header/LanguageSwitch.tsx +3 -3
  90. package/src/sections/Header/RegistryInfoContent/styles.ts +1 -1
  91. package/src/sections/Header/styles.ts +9 -9
@@ -3,7 +3,7 @@ import React from 'react';
3
3
 
4
4
  import { Theme } from './theme';
5
5
 
6
- const resetStyles = makeStyles(({ theme }: { theme?: Theme }) => ({
6
+ const resetStyles = makeStyles((theme: Theme) => ({
7
7
  '@global': {
8
8
  // eslint-disable-next-line max-len
9
9
  'html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video':
@@ -11,7 +11,7 @@ const resetStyles = makeStyles(({ theme }: { theme?: Theme }) => ({
11
11
  fontFamily: '"Roboto", Helvetica Neue, Arial, sans-serif',
12
12
  },
13
13
  strong: {
14
- fontWeight: theme?.fontWeight.semiBold,
14
+ fontWeight: theme.fontWeight.semiBold,
15
15
  },
16
16
  'html, body, #root': {
17
17
  height: '100%',
@@ -26,8 +26,8 @@ const resetStyles = makeStyles(({ theme }: { theme?: Theme }) => ({
26
26
  flex: 1,
27
27
  height: '100%',
28
28
 
29
- [`@media screen and (min-width: ${theme?.breakPoints.container}px)`]: {
30
- maxWidth: theme?.breakPoints.container,
29
+ [`@media screen and (min-width: ${theme.breakPoints.container}px)`]: {
30
+ maxWidth: theme.breakPoints.container,
31
31
  width: '100%',
32
32
  marginLeft: 'auto',
33
33
  marginRight: 'auto',
@@ -1,4 +1,4 @@
1
- import { createTheme } from '@mui/material/styles';
1
+ import { Theme as MuiTheme, createTheme } from '@mui/material/styles';
2
2
 
3
3
  import { PRIMARY_COLOR } from './colors';
4
4
 
@@ -92,7 +92,15 @@ const customizedTheme = {
92
92
 
93
93
  type CustomizedTheme = typeof customizedTheme;
94
94
 
95
- export const getTheme = (themeMode: ThemeMode, primaryColor: string) => {
95
+ export interface CustomTheme {
96
+ fontSize: typeof fontSize;
97
+ fontWeight: typeof fontWeight;
98
+ breakPoints: typeof breakPoints;
99
+ }
100
+
101
+ export type Theme = MuiTheme & CustomTheme;
102
+
103
+ export const getTheme = (themeMode: ThemeMode, primaryColor: string): Theme => {
96
104
  const palette = applyPrimaryColor(themeMode, primaryColor);
97
105
  return createTheme({
98
106
  typography: {
@@ -122,10 +130,13 @@ export const getTheme = (themeMode: ThemeMode, primaryColor: string) => {
122
130
  },
123
131
  },
124
132
  ...customizedTheme,
125
- });
133
+ }) as Theme;
126
134
  };
127
135
 
128
- export type Theme = ReturnType<typeof getTheme>;
136
+ declare module '@mui/material/styles' {
137
+ interface Theme extends CustomTheme {}
138
+ interface ThemeOptions extends CustomTheme {}
139
+ }
129
140
 
130
141
  declare module '@mui/material/styles/createTheme' {
131
142
  /* eslint-disable-next-line @typescript-eslint/no-empty-interface */
@@ -16,11 +16,11 @@ import LinkExternal from '../LinkExternal';
16
16
 
17
17
  export const Fab = styled(FabMUI)<{ theme?: Theme }>(({ theme }) => ({
18
18
  backgroundColor:
19
- theme?.palette.mode === 'light' ? theme?.palette.primary.main : theme?.palette.cyanBlue,
19
+ theme.palette.mode === 'light' ? theme.palette.primary.main : theme.palette.cyanBlue,
20
20
  '&:hover': {
21
- color: theme?.palette.mode === 'light' ? theme?.palette.primary.main : theme?.palette.cyanBlue,
21
+ color: theme.palette.mode === 'light' ? theme.palette.primary.main : theme.palette.cyanBlue,
22
22
  },
23
- color: theme?.palette.white,
23
+ color: theme.palette.white,
24
24
  }));
25
25
 
26
26
  type ActionType = 'VISIT_HOMEPAGE' | 'OPEN_AN_ISSUE' | 'DOWNLOAD_TARBALL' | 'RAW_DATA';
@@ -5,7 +5,7 @@ import ListItem from '@mui/material/ListItem';
5
5
  import { Theme } from '../../Theme';
6
6
 
7
7
  export const StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({
8
- fontWeight: props.theme?.fontWeight.bold,
8
+ fontWeight: props.theme.fontWeight.bold,
9
9
  }));
10
10
 
11
11
  export const AuthorListItem = styled(ListItem)({
@@ -26,7 +26,7 @@ const Content = styled('span')<{ theme?: Theme }>(({ theme }) => ({
26
26
  textOverflow: 'ellipsis',
27
27
  height: 'auto',
28
28
  whiteSpace: 'break-spaces',
29
- fontSize: theme?.fontSize.sm,
29
+ fontSize: theme.fontSize.sm,
30
30
  }));
31
31
 
32
32
  function CopyToClipBoard({ text, children, dataTestId, title, ...props }: Props) {
@@ -17,7 +17,7 @@ interface DependencyBlockProps {
17
17
  }
18
18
 
19
19
  export const StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({
20
- fontWeight: props.theme && props.theme.fontWeight.bold,
20
+ fontWeight: props.theme.fontWeight.bold,
21
21
  textTransform: 'capitalize',
22
22
  }));
23
23
 
@@ -38,7 +38,7 @@ export const Tag = styled(Chip)<{ theme?: Theme }>((props) => ({
38
38
  export const DependencyBlock: React.FC<DependencyBlockProps> = ({ title, dependencies }) => {
39
39
  const history = useHistory();
40
40
  const { t } = useTranslation();
41
- const theme = useTheme();
41
+ const theme: Theme = useTheme();
42
42
  const deps = Object.entries(dependencies);
43
43
 
44
44
  function handleClick(name: string): void {
@@ -2,12 +2,14 @@ import Alert from '@mui/material/Alert';
2
2
  import { useTheme } from '@mui/styles';
3
3
  import React from 'react';
4
4
 
5
+ import { Theme } from '../../Theme';
6
+
5
7
  export type Props = {
6
8
  message: string;
7
9
  };
8
10
 
9
11
  const Deprecated: React.FC<Props> = ({ message }) => {
10
- const theme = useTheme();
12
+ const theme: Theme = useTheme();
11
13
  return (
12
14
  <Alert severity="warning" sx={{ marginTop: theme.spacing(1), marginBottom: theme.spacing(1) }}>
13
15
  {message}
@@ -11,8 +11,8 @@ import Title from './Title';
11
11
  import getUniqueDeveloperValues from './get-unique-developer-values';
12
12
 
13
13
  export const Fab = styled(FabMUI)<{ theme?: Theme }>((props) => ({
14
- backgroundColor: props.theme?.palette.primary.main,
15
- color: props.theme?.palette.white,
14
+ backgroundColor: props.theme.palette.primary.main,
15
+ color: props.theme.palette.white,
16
16
  }));
17
17
 
18
18
  interface Props {
@@ -23,6 +23,6 @@ const Title: React.FC<Props> = ({ type }) => {
23
23
  export default Title;
24
24
 
25
25
  const StyledText = styled(Typography)<{ theme?: Theme }>(({ theme }) => ({
26
- fontWeight: theme?.fontWeight.bold,
26
+ fontWeight: theme.fontWeight.bold,
27
27
  marginBottom: '10px',
28
28
  }));
@@ -6,7 +6,7 @@ import Typography from '@mui/material/Typography';
6
6
  import { Theme } from '../../Theme';
7
7
 
8
8
  export const StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({
9
- fontWeight: props.theme?.fontWeight.bold,
9
+ fontWeight: props.theme.fontWeight.bold,
10
10
  textTransform: 'capitalize',
11
11
  }));
12
12
 
@@ -5,7 +5,7 @@ import Typography from '@mui/material/Typography';
5
5
  import { Theme } from '../../Theme';
6
6
 
7
7
  export const StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({
8
- fontWeight: props.theme?.fontWeight.bold,
8
+ fontWeight: props.theme.fontWeight.bold,
9
9
  textTransform: 'capitalize',
10
10
  }));
11
11
 
@@ -51,6 +51,6 @@ const Container = styled('div')({
51
51
  });
52
52
 
53
53
  const StyledHeading = styled(Heading)<{ theme?: Theme }>(({ theme }) => ({
54
- color: theme?.palette.mode === 'light' ? theme?.palette.primary.main : theme?.palette.white,
54
+ color: theme.palette.mode === 'light' ? theme.palette.primary.main : theme.palette.white,
55
55
  marginBottom: 16,
56
56
  }));
@@ -9,14 +9,14 @@ import { url } from '../../utils';
9
9
  import LinkExternal from '../LinkExternal';
10
10
 
11
11
  const StyledLink = styled(LinkExternal)<{ theme?: Theme }>(({ theme }) => ({
12
- marginTop: theme?.spacing(2),
13
- marginBottom: theme?.spacing(2),
12
+ marginTop: theme.spacing(2),
13
+ marginBottom: theme.spacing(2),
14
14
  textDecoration: 'none',
15
15
  display: 'block',
16
16
  }));
17
17
 
18
18
  const StyledFavoriteIcon = styled(Favorite)<{ theme?: Theme }>(({ theme }) => ({
19
- color: theme?.palette.orange,
19
+ color: theme.palette.orange,
20
20
  }));
21
21
 
22
22
  const StyledFundStrong = styled('strong')({
@@ -12,7 +12,7 @@ import { SettingsMenu } from '../SettingsMenu';
12
12
  import InstallListItem, { DependencyManager } from './InstallListItem';
13
13
 
14
14
  const StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({
15
- fontWeight: props.theme?.fontWeight.bold,
15
+ fontWeight: props.theme.fontWeight.bold,
16
16
  textTransform: 'capitalize',
17
17
  }));
18
18
 
@@ -5,6 +5,7 @@ import ListItemText from '@mui/material/ListItemText';
5
5
  import { useTheme } from '@mui/styles';
6
6
  import React from 'react';
7
7
 
8
+ import { Theme } from '../../Theme';
8
9
  import { useSettings } from '../../providers/PersistenceSettingProvider';
9
10
  import CopyToClipBoard from '../CopyClipboard';
10
11
  import { Npm, Pnpm, Yarn } from '../Icons';
@@ -55,7 +56,7 @@ const InstallListItem: React.FC<Interface> = ({
55
56
  packageVersion,
56
57
  }) => {
57
58
  const { localSettings } = useSettings();
58
- const theme = useTheme();
59
+ const theme: Theme = useTheme();
59
60
  const isLatest = localSettings[packageName]?.latest ?? false;
60
61
  const isGlobal = localSettings[packageName]?.global ?? false;
61
62
  switch (dependencyManager) {
@@ -4,12 +4,13 @@ import { useTheme } from '@mui/styles';
4
4
  import React from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
 
7
+ import { Theme } from '../../Theme';
7
8
  import { PackageMetaInterface } from '../../types/packageMeta';
8
9
  import KeywordListItems from './KeywordListItems';
9
10
 
10
11
  const Keywords: React.FC<{ packageMeta: PackageMetaInterface }> = ({ packageMeta }) => {
11
12
  const { t } = useTranslation();
12
- const theme = useTheme();
13
+ const theme: Theme = useTheme();
13
14
 
14
15
  if (!packageMeta?.latest?.keywords) {
15
16
  return null;
@@ -16,7 +16,7 @@ interface WrapperProps {
16
16
  }
17
17
 
18
18
  const Wrapper = styled('div')<WrapperProps & { theme?: Theme }>((props) => ({
19
- fontWeight: props.theme?.fontWeight[props.weight],
19
+ fontWeight: props.theme.fontWeight[props.weight],
20
20
  textTransform: props.capitalize ? 'capitalize' : 'none',
21
21
  }));
22
22
 
@@ -30,5 +30,5 @@ const Wrapper = styled('div')<Pick<Props, 'centered'>>(({ centered }) => ({
30
30
  }));
31
31
 
32
32
  const Circular = styled(CircularProgress)<{ theme?: Theme }>(({ theme }) => ({
33
- color: theme?.palette.mode === 'dark' ? theme?.palette.white : theme?.palette.primary.main,
33
+ color: theme.palette.mode === 'dark' ? theme.palette.white : theme.palette.primary.main,
34
34
  }));
@@ -14,5 +14,5 @@ export const Badge = styled('div')<{ theme?: Theme }>(({ theme }) => ({
14
14
  padding: 5,
15
15
  borderRadius: 25,
16
16
  boxShadow: '0 10px 20px 0 rgba(69, 58, 100, 0.2)',
17
- background: theme?.palette.mode === 'dark' ? theme?.palette.black : '#f7f8f6',
17
+ background: theme.palette.mode === 'dark' ? theme.palette.black : '#f7f8f6',
18
18
  }));
@@ -7,14 +7,14 @@ import React, { memo } from 'react';
7
7
  import { LoginError, Theme } from '../../';
8
8
 
9
9
  const StyledSnackbarContent = styled(SnackbarContent)<{ theme?: Theme }>(({ theme }) => ({
10
- backgroundColor: theme?.palette.error.dark,
11
- color: theme?.palette.white,
10
+ backgroundColor: theme.palette.error.dark,
11
+ color: theme.palette.white,
12
12
  }));
13
13
 
14
14
  const StyledErrorIcon = styled(Error)<{ theme?: Theme }>(({ theme }) => ({
15
15
  fontSize: 20,
16
16
  opacity: 0.9,
17
- marginRight: theme?.spacing(1),
17
+ marginRight: theme.spacing(1),
18
18
  }));
19
19
 
20
20
  export interface FormValues {
@@ -34,15 +34,15 @@ const LoginDialogHeader: React.FC<Props> = ({ onClose }) => {
34
34
  export default LoginDialogHeader;
35
35
 
36
36
  const StyledAvatar = styled(Avatar)<{ theme?: Theme }>(({ theme }) => ({
37
- margin: theme?.spacing(1),
37
+ margin: theme.spacing(1),
38
38
  backgroundColor:
39
- theme?.palette.mode === 'light' ? theme?.palette.primary.main : theme?.palette.cyanBlue,
40
- color: theme?.palette.white,
39
+ theme.palette.mode === 'light' ? theme.palette.primary.main : theme.palette.cyanBlue,
40
+ color: theme.palette.white,
41
41
  }));
42
42
 
43
43
  const StyledIconButton = styled(IconButton)<{ theme?: Theme }>(({ theme }) => ({
44
44
  position: 'absolute',
45
- right: theme?.spacing() / 2,
46
- top: theme?.spacing() / 2,
47
- color: theme?.palette.grey[500],
45
+ right: theme.spacing() / 2,
46
+ top: theme.spacing() / 2,
47
+ color: theme.palette.grey[500],
48
48
  }));
@@ -28,10 +28,10 @@ interface Props {
28
28
 
29
29
  const Logo: React.FC<Props> = ({ size, onClick, className, isDefault = false, title = '' }) => {
30
30
  const { configOptions } = useConfig();
31
- const theme = useTheme();
31
+ const theme: Theme = useTheme();
32
32
  if (!isDefault && configOptions?.logo) {
33
33
  const logoSrc =
34
- theme?.palette.mode === 'dark' && configOptions.logoDark
34
+ theme.palette.mode === 'dark' && configOptions.logoDark
35
35
  ? configOptions.logoDark
36
36
  : configOptions.logo;
37
37
  return (
@@ -64,7 +64,7 @@ const StyledLogo = styled('div')<Props & { theme?: Theme }>(({ size = 'small', t
64
64
  boxSizing: 'border-box',
65
65
  backgroundPosition: 'center',
66
66
  backgroundSize: 'contain',
67
- backgroundImage: `url(${logos[theme?.palette.mode]})`,
67
+ backgroundImage: `url(${logos[theme.palette.mode]})`,
68
68
  backgroundRepeat: ' no-repeat',
69
69
  width: sizes[size],
70
70
  height: sizes[size],
@@ -48,6 +48,6 @@ const Container = styled('div')({
48
48
  });
49
49
 
50
50
  const StyledHeading = styled(Heading)<{ theme?: Theme }>(({ theme }) => ({
51
- color: theme?.palette.mode === 'light' ? theme?.palette.primary.main : theme?.palette.white,
51
+ color: theme.palette.mode === 'light' ? theme.palette.primary.main : theme.palette.white,
52
52
  marginBottom: 16,
53
53
  }));
@@ -246,7 +246,7 @@ export default Package;
246
246
 
247
247
  const iconStyle = ({ theme }: { theme: Theme }) => css`
248
248
  margin: 0 10px 0 0;
249
- fill: ${theme?.palette.mode === 'light' ? theme?.palette.greyDark : theme?.palette.white};
249
+ fill: ${theme.palette.mode === 'light' ? theme.palette.greyDark : theme.palette.white};
250
250
  `;
251
251
 
252
252
  const StyledVersion = styled(Version)`
@@ -12,14 +12,14 @@ export const OverviewItem = styled('span')<{ theme?: Theme }>(({ theme }) => ({
12
12
  display: 'flex',
13
13
  alignItems: 'center',
14
14
  margin: '0 20px 0 0',
15
- color: theme?.palette.mode === 'light' ? theme?.palette.greyDark2 : theme?.palette.white,
15
+ color: theme.palette.mode === 'light' ? theme.palette.greyDark2 : theme.palette.white,
16
16
  fontSize: 12,
17
- [`@media (max-width: ${theme?.breakPoints.medium}px)`]: {
17
+ [`@media (max-width: ${theme.breakPoints.medium}px)`]: {
18
18
  ':nth-of-type(3)': {
19
19
  display: 'none',
20
20
  },
21
21
  },
22
- [`@media (max-width: ${theme?.breakPoints.small}px)`]: {
22
+ [`@media (max-width: ${theme.breakPoints.small}px)`]: {
23
23
  ':nth-of-type(4)': {
24
24
  display: 'none',
25
25
  },
@@ -52,14 +52,14 @@ export const WrapperLink = styled(Link)({
52
52
  });
53
53
 
54
54
  export const PackageTitle = styled('span')<{ theme?: Theme }>(({ theme }) => ({
55
- fontWeight: theme?.fontWeight.bold,
55
+ fontWeight: theme.fontWeight.bold,
56
56
  fontSize: 20,
57
57
  display: 'block',
58
58
  marginBottom: 12,
59
- color: theme?.palette.mode == 'dark' ? theme?.palette.dodgerBlue : theme?.palette.eclipse,
59
+ color: theme.palette.mode == 'dark' ? theme.palette.dodgerBlue : theme.palette.eclipse,
60
60
  cursor: 'pointer',
61
61
  textDecoration: 'none',
62
- [`@media (max-width: ${theme?.breakPoints.small}px)`]: {
62
+ [`@media (max-width: ${theme.breakPoints.small}px)`]: {
63
63
  fontSize: 14,
64
64
  marginBottom: 8,
65
65
  },
@@ -72,7 +72,7 @@ export const GridRightAligned = styled(Grid)({
72
72
  export const Wrapper = styled(List)<{ theme?: Theme }>(({ theme }) => ({
73
73
  '&:hover': {
74
74
  backgroundColor:
75
- theme?.palette?.type == 'dark' ? theme?.palette?.secondary.main : theme?.palette?.greyLight2,
75
+ theme.palette.mode == 'dark' ? theme.palette.secondary.main : theme.palette.greyLight2,
76
76
  },
77
77
  }));
78
78
 
@@ -88,7 +88,7 @@ export const PackageListItemText = styled(ListItemText)({
88
88
  });
89
89
 
90
90
  export const Description = styled('span')<{ theme?: Theme }>(({ theme }) => ({
91
- color: theme?.palette.mode === 'light' ? theme?.palette.greyDark2 : theme?.palette.white,
91
+ color: theme.palette.mode === 'light' ? theme.palette.greyDark2 : theme.palette.white,
92
92
  fontSize: '14px',
93
93
  paddingRight: 0,
94
94
  }));
@@ -1,3 +1,4 @@
1
+ import ReactJson from '@microlink/react-json-view';
1
2
  import CloseIcon from '@mui/icons-material/Close';
2
3
  import Dialog from '@mui/material/Dialog';
3
4
  import DialogContent from '@mui/material/DialogContent';
@@ -6,7 +7,8 @@ import IconButton from '@mui/material/IconButton';
6
7
  import { useTheme } from '@mui/styles';
7
8
  import React from 'react';
8
9
  import { useTranslation } from 'react-i18next';
9
- import ReactJson from 'react-json-view';
10
+
11
+ import { Theme } from '../../Theme';
10
12
 
11
13
  export interface ViewerTitleProps {
12
14
  id: string;
@@ -48,7 +50,7 @@ type Props = {
48
50
  /* eslint-disable verdaccio/jsx-spread */
49
51
  const RawViewer: React.FC<Props> = ({ isOpen = false, onClose, packageMeta }) => {
50
52
  const { t } = useTranslation();
51
- const theme = useTheme();
53
+ const theme: Theme = useTheme();
52
54
  return (
53
55
  <Dialog data-testid={'rawViewer--dialog'} fullScreen={true} open={isOpen}>
54
56
  <ViewerTitle id="viewer-title" onClose={onClose}>
@@ -61,7 +63,7 @@ const RawViewer: React.FC<Props> = ({ isOpen = false, onClose, packageMeta }) =>
61
63
  enableClipboard={true}
62
64
  groupArraysAfterLength={10}
63
65
  src={packageMeta as any}
64
- theme={theme?.palette.mode == 'light' ? 'bright:inverted' : 'bright'}
66
+ theme={theme.palette.mode == 'light' ? 'bright:inverted' : 'bright'}
65
67
  />
66
68
  </DialogContent>
67
69
  </Dialog>
@@ -6,17 +6,17 @@ import { Theme } from '../../';
6
6
 
7
7
  export const Title = styled(DialogTitle)<{ theme?: Theme }>(({ theme }) => ({
8
8
  backgroundColor:
9
- theme?.palette.mode === 'light' ? theme?.palette.primary.main : theme?.palette.cyanBlue,
10
- color: theme?.palette.white,
11
- fontSize: theme?.fontSize.lg,
9
+ theme.palette.mode === 'light' ? theme.palette.primary.main : theme.palette.cyanBlue,
10
+ color: theme.palette.white,
11
+ fontSize: theme.fontSize.lg,
12
12
  }));
13
13
 
14
14
  export const Content = styled(DialogContent)<{ theme?: Theme }>(({ theme }) => ({
15
15
  padding: '0 24px',
16
- backgroundColor: theme?.palette.background.default,
16
+ backgroundColor: theme.palette.background.default,
17
17
  }));
18
18
 
19
19
  export const TextContent = styled('div')<{ theme?: Theme }>(({ theme }) => ({
20
20
  padding: '10px 24px',
21
- backgroundColor: theme?.palette.background.default,
21
+ backgroundColor: theme.palette.background.default,
22
22
  }));
@@ -15,7 +15,7 @@ import { Git } from '../Icons';
15
15
  import LinkExternal from '../LinkExternal';
16
16
 
17
17
  const StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({
18
- fontWeight: props.theme?.fontWeight.bold,
18
+ fontWeight: props.theme.fontWeight.bold,
19
19
  textTransform: 'capitalize',
20
20
  }));
21
21
 
@@ -39,7 +39,7 @@ const RepositoryAvatar = styled(Avatar)({
39
39
 
40
40
  const Repository: React.FC<{ packageMeta: any }> = ({ packageMeta }) => {
41
41
  const { t } = useTranslation();
42
- const theme = useTheme();
42
+ const theme: Theme = useTheme();
43
43
  const url = packageMeta?.latest?.repository?.url;
44
44
  if (!url || !urlUtils.isURL(url)) {
45
45
  return null;
@@ -28,19 +28,19 @@ const Wrapper = styled.div({
28
28
 
29
29
  export const Description = styled('div')<{ theme?: Theme }>(({ theme }) => ({
30
30
  display: 'none',
31
- color: theme?.palette?.greyLight2,
31
+ color: theme.palette.greyLight2,
32
32
  lineHeight: '1.5rem',
33
33
  whiteSpace: 'nowrap',
34
34
  textOverflow: 'ellipsis',
35
35
  alignItems: 'center',
36
36
  overflow: 'hidden',
37
37
  paddingLeft: theme.spacing(),
38
- fontSize: theme?.fontSize.ssm,
39
- [`@media (min-width: ${theme?.breakPoints.medium}px)`]: {
38
+ fontSize: theme.fontSize.ssm,
39
+ [`@media (min-width: ${theme.breakPoints.medium}px)`]: {
40
40
  display: 'block',
41
41
  width: '300px',
42
42
  },
43
- [`@media (min-width: ${theme?.breakPoints.large}px)`]: {
43
+ [`@media (min-width: ${theme.breakPoints.large}px)`]: {
44
44
  display: 'block',
45
45
  width: '500px',
46
46
  },
@@ -57,11 +57,11 @@ const NameGroup = styled.span({
57
57
 
58
58
  const Name = styled('span')<{ theme?: Theme }>(({ theme }) => ({
59
59
  fontWeight: '700',
60
- fontSize: theme?.fontSize.sm,
60
+ fontSize: theme.fontSize.sm,
61
61
  }));
62
62
 
63
63
  const Version = styled('span')<{ theme?: Theme }>(({ theme }) => ({
64
- fontSize: theme?.fontSize.ssm,
64
+ fontSize: theme.fontSize.ssm,
65
65
  }));
66
66
 
67
67
  const SearchItem: React.FC<SearchItemProps> = ({
@@ -14,7 +14,7 @@ export const StyledTextField = styled(TextField)<{ theme?: Theme }>((props) => (
14
14
  border: 'none',
15
15
  },
16
16
  ':after': {
17
- borderColor: props.theme?.palette.white,
17
+ borderColor: props.theme.palette.white,
18
18
  },
19
19
  ':hover:before': {
20
20
  content: 'none',
@@ -23,19 +23,19 @@ export const StyledTextField = styled(TextField)<{ theme?: Theme }>((props) => (
23
23
  content: 'none',
24
24
  transform: 'scaleX(1)',
25
25
  },
26
- [`@media screen and (min-width: ${props.theme?.breakPoints.medium}px)`]: {
26
+ [`@media screen and (min-width: ${props.theme.breakPoints.medium}px)`]: {
27
27
  ':hover:after': {
28
28
  content: "''",
29
29
  },
30
30
  },
31
31
  },
32
32
  '& .MuiInputBase-input': {
33
- [`@media screen and (min-width: ${props.theme?.breakPoints.medium}px)`]: {
34
- color: props.theme?.palette.white,
33
+ [`@media screen and (min-width: ${props.theme.breakPoints.medium}px)`]: {
34
+ color: props.theme.palette.white,
35
35
  },
36
36
  },
37
37
  }));
38
38
 
39
39
  export const StyledInputAdornment = styled(InputAdornment)<{ theme?: Theme }>((props) => ({
40
- color: props.theme?.palette.white,
40
+ color: props.theme.palette.white,
41
41
  }));
@@ -21,7 +21,7 @@ interface Props {
21
21
  }
22
22
 
23
23
  const Icon = styled.div<{ theme?: Theme }>(({ theme }) => ({
24
- marginLeft: theme?.spacing(1),
24
+ marginLeft: theme.spacing(1),
25
25
  }));
26
26
 
27
27
  const ModuleJS: React.FC<{ module: ModuleType | void }> = ({ module }) => {
@@ -93,6 +93,6 @@ const StyledHeading = styled(Heading)({
93
93
  });
94
94
 
95
95
  const StyledBoxVersion = styled(Box)<{ theme?: Theme }>(({ theme }) => ({
96
- color: theme?.palette.text.secondary,
97
- fontSize: theme?.fontSize.sm,
96
+ color: theme.palette.text.secondary,
97
+ fontSize: theme.fontSize.sm,
98
98
  }));
@@ -5,13 +5,13 @@ import Typography from '@mui/material/Typography';
5
5
  import { Theme } from '../../Theme';
6
6
 
7
7
  export const StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({
8
- fontWeight: props.theme?.fontWeight.bold,
8
+ fontWeight: props.theme.fontWeight.bold,
9
9
  }));
10
10
 
11
11
  export const Spacer = styled('div')<{ theme?: Theme }>(({ theme }) => ({
12
12
  flex: '1 1 auto',
13
13
  borderBottom: `1px dotted ${
14
- theme?.palette.mode == 'light' ? 'rgba(0, 0, 0, 0.2)' : 'rgba(255, 255, 255, 0.2)'
14
+ theme.palette.mode == 'light' ? 'rgba(0, 0, 0, 0.2)' : 'rgba(255, 255, 255, 0.2)'
15
15
  } `,
16
16
  whiteSpace: 'nowrap',
17
17
  height: '0.5em',
@@ -20,6 +20,6 @@ export const Spacer = styled('div')<{ theme?: Theme }>(({ theme }) => ({
20
20
 
21
21
  export const ListItemText = styled(MuiListItemText)<{ theme?: Theme }>(({ theme }) => ({
22
22
  flex: 'none',
23
- color: theme?.palette.mode == 'light' ? theme?.palette.black : theme?.palette.white,
23
+ color: theme.palette.mode == 'light' ? theme.palette.black : theme.palette.white,
24
24
  opacity: 0.6,
25
25
  }));
@@ -5,6 +5,7 @@ import { useTheme } from '@mui/styles';
5
5
  import React from 'react';
6
6
  import { useTranslation } from 'react-i18next';
7
7
 
8
+ import { Theme } from '../../Theme';
8
9
  import { useConfig } from '../../providers';
9
10
  import { Time, Versions } from '../../types/packageMeta';
10
11
  import { Route, utils } from '../../utils';
@@ -31,7 +32,7 @@ export function filterDeprecated(versions: Versions) {
31
32
  const VersionsHistoryList: React.FC<Props> = ({ versions, packageName, time }) => {
32
33
  const { t } = useTranslation();
33
34
  const { configOptions } = useConfig();
34
- const theme = useTheme();
35
+ const theme: Theme = useTheme();
35
36
  const hideDeprecatedVersions = configOptions.hideDeprecatedVersions;
36
37
  const listVersions = hideDeprecatedVersions ? filterDeprecated(versions) : versions;
37
38
 
@@ -26,7 +26,7 @@ export const StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({
26
26
  const Versions: React.FC<Props> = ({ packageMeta, packageName }) => {
27
27
  const { t } = useTranslation();
28
28
  const { configOptions } = useConfig();
29
- const theme = useTheme();
29
+ const theme: Theme = useTheme();
30
30
  const { versions = {}, time = {}, ['dist-tags']: distTags = {} } = packageMeta;
31
31
 
32
32
  const [packageVersions, setPackageVersions] = useState(versions);