@verdaccio/ui-components 4.0.0-next-8.0 → 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 (115) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/build/AppTest/pages/Version/Version.js +1 -4
  3. package/build/Theme/ResetStyles.js +4 -6
  4. package/build/Theme/ThemeProvider.js +1 -2
  5. package/build/components/ActionBar/ActionBar.js +3 -3
  6. package/build/components/ActionBar/ActionBarAction.js +5 -8
  7. package/build/components/Author/styles.js +4 -7
  8. package/build/components/CopyClipboard/CopyToClipBoard.js +4 -4
  9. package/build/components/Dependencies/DependencyBlock.js +4 -4
  10. package/build/components/Developers/Developers.js +6 -9
  11. package/build/components/Developers/Title.js +2 -2
  12. package/build/components/Distribution/Dist.js +3 -3
  13. package/build/components/Distribution/styles.js +6 -9
  14. package/build/components/Engines/Engines.js +1 -2
  15. package/build/components/Engines/styles.js +5 -8
  16. package/build/components/Forbidden/Forbidden.js +3 -3
  17. package/build/components/FundButton/FundButton.js +7 -8
  18. package/build/components/Install/Install.js +8 -12
  19. package/build/components/Install/InstallListItem.js +5 -6
  20. package/build/components/Keywords/Keywords.js +2 -3
  21. package/build/components/Label/Label.js +4 -7
  22. package/build/components/LinkExternal/LinkExternal.js +1 -1
  23. package/build/components/Loading/Spinner/Spinner.js +3 -3
  24. package/build/components/Loading/styles.js +3 -3
  25. package/build/components/LoginDialog/LoginDialogForm.js +2 -3
  26. package/build/components/LoginDialog/LoginDialogFormError.js +5 -5
  27. package/build/components/LoginDialog/LoginDialogHeader.js +8 -8
  28. package/build/components/Logo/Logo.js +5 -5
  29. package/build/components/NotFound/NotFound.js +3 -3
  30. package/build/components/Package/Package.js +10 -13
  31. package/build/components/Package/styles.js +23 -26
  32. package/build/components/RawViewer/RawViewer.js +2 -2
  33. package/build/components/RegistryInfoDialog/styles.js +8 -8
  34. package/build/components/Repository/Repository.js +8 -12
  35. package/build/components/Search/Search.js +13 -17
  36. package/build/components/Search/SearchItem.js +29 -32
  37. package/build/components/Search/styles.js +28 -34
  38. package/build/components/SettingsMenu/SettingsMenu.js +9 -12
  39. package/build/components/SideBarTitle/SideBarTitle.js +7 -7
  40. package/build/components/UpLinks/UpLinks.js +1 -1
  41. package/build/components/UpLinks/styles.js +7 -10
  42. package/build/components/Versions/HistoryList.js +26 -29
  43. package/build/components/Versions/Versions.js +1 -1
  44. package/build/components/Versions/styles.js +4 -4
  45. package/build/providers/AppConfigurationProvider/AppConfigurationProvider.js +3 -5
  46. package/build/providers/TranslatorProvider/TranslatorProvider.js +1 -2
  47. package/build/providers/VersionProvider/VersionProvider.js +1 -4
  48. package/build/sections/Detail/Detail.js +2 -3
  49. package/build/sections/Footer/Footer.js +8 -8
  50. package/build/sections/Footer/styles.js +12 -12
  51. package/build/sections/Header/Header.js +2 -2
  52. package/build/sections/Header/HeaderSettingsDialog.js +2 -2
  53. package/build/sections/Header/LanguageSwitch.js +6 -8
  54. package/build/sections/Header/RegistryInfoContent/RegistryInfoContent.js +3 -4
  55. package/build/sections/Header/RegistryInfoContent/styles.js +3 -3
  56. package/build/sections/Header/styles.js +29 -35
  57. package/build/sections/Home/Home.js +1 -4
  58. package/build/sections/SideBar/Sidebar.js +4 -5
  59. package/build/src/Theme/theme.d.ts +14 -2
  60. package/build/src/components/Dependencies/DependencyBlock.d.ts +2 -1
  61. package/build/src/components/Loading/styles.d.ts +2 -1
  62. package/build/src/components/Package/styles.d.ts +4 -3
  63. package/build/src/components/RegistryInfoDialog/styles.d.ts +3 -2
  64. package/build/src/components/Search/styles.d.ts +2 -1
  65. package/build/src/components/UpLinks/styles.d.ts +3 -2
  66. package/build/src/components/Versions/styles.d.ts +3 -2
  67. package/build/src/sections/Footer/styles.d.ts +6 -5
  68. package/build/src/sections/Header/RegistryInfoContent/styles.d.ts +3 -2
  69. package/build/src/sections/Header/styles.d.ts +3 -2
  70. package/build/store/api.js +5 -6
  71. package/build/store/models/configuration.js +1 -2
  72. package/build/store/models/search.js +1 -1
  73. package/build/utils/utils.js +2 -2
  74. package/package.json +3 -3
  75. package/src/Theme/ResetStyles.tsx +4 -4
  76. package/src/Theme/theme.ts +15 -4
  77. package/src/components/ActionBar/ActionBarAction.tsx +3 -3
  78. package/src/components/Author/styles.ts +1 -1
  79. package/src/components/CopyClipboard/CopyToClipBoard.tsx +1 -1
  80. package/src/components/Dependencies/DependencyBlock.tsx +2 -2
  81. package/src/components/Deprecated/Deprecated.tsx +3 -1
  82. package/src/components/Developers/Developers.tsx +2 -2
  83. package/src/components/Developers/Title.tsx +1 -1
  84. package/src/components/Distribution/styles.ts +1 -1
  85. package/src/components/Engines/styles.ts +1 -1
  86. package/src/components/Forbidden/Forbidden.tsx +1 -1
  87. package/src/components/FundButton/FundButton.tsx +3 -3
  88. package/src/components/Install/Install.tsx +1 -1
  89. package/src/components/Install/InstallListItem.tsx +2 -1
  90. package/src/components/Keywords/Keywords.tsx +2 -1
  91. package/src/components/Label/Label.tsx +1 -1
  92. package/src/components/Loading/Spinner/Spinner.tsx +1 -1
  93. package/src/components/Loading/styles.ts +1 -1
  94. package/src/components/LoginDialog/LoginDialogFormError.tsx +3 -3
  95. package/src/components/LoginDialog/LoginDialogHeader.tsx +6 -6
  96. package/src/components/Logo/Logo.tsx +3 -3
  97. package/src/components/NotFound/NotFound.tsx +1 -1
  98. package/src/components/Package/Package.tsx +1 -1
  99. package/src/components/Package/styles.ts +8 -8
  100. package/src/components/RawViewer/RawViewer.tsx +5 -3
  101. package/src/components/RegistryInfoDialog/styles.ts +5 -5
  102. package/src/components/Repository/Repository.tsx +2 -2
  103. package/src/components/Search/SearchItem.tsx +6 -6
  104. package/src/components/Search/styles.ts +5 -5
  105. package/src/components/SideBarTitle/SideBarTitle.tsx +3 -3
  106. package/src/components/UpLinks/styles.ts +3 -3
  107. package/src/components/Versions/HistoryList.tsx +2 -1
  108. package/src/components/Versions/Versions.tsx +1 -1
  109. package/src/components/Versions/styles.ts +2 -2
  110. package/src/sections/Footer/Footer.tsx +2 -2
  111. package/src/sections/Footer/styles.ts +7 -7
  112. package/src/sections/Header/HeaderSettingsDialog.tsx +1 -1
  113. package/src/sections/Header/LanguageSwitch.tsx +3 -3
  114. package/src/sections/Header/RegistryInfoContent/styles.ts +1 -1
  115. package/src/sections/Header/styles.ts +9 -9
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import { Theme } from '../../Theme';
2
3
  export declare const InnerNavBar: import("@emotion/styled").StyledComponent<any, {}, {}>;
3
4
  export declare const Greetings: import("@emotion/styled").StyledComponent<{
4
5
  theme?: import("@emotion/react").Theme | undefined;
@@ -8,13 +9,13 @@ export declare const MobileNavBar: import("@emotion/styled").StyledComponent<{
8
9
  theme?: import("@emotion/react").Theme | undefined;
9
10
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
10
11
  } & {
11
- theme?: import("@mui/material").Theme | undefined;
12
+ theme?: Theme | undefined;
12
13
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
13
14
  export declare const InnerMobileNavBar: import("@emotion/styled").StyledComponent<{
14
15
  theme?: import("@emotion/react").Theme | undefined;
15
16
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
16
17
  } & {
17
- theme?: import("@mui/material").Theme | undefined;
18
+ theme?: Theme | undefined;
18
19
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
19
20
  export declare const IconSearchButton: import("@emotion/styled").StyledComponent<any, {}, {}>;
20
21
  export declare const InfoButton: import("@emotion/styled").StyledComponent<any, {}, {}>;
@@ -17,14 +17,14 @@ class CustomError extends Error {}
17
17
  function handleResponseType(response) {
18
18
  if (response.headers) {
19
19
  const contentType = response.headers.get('Content-Type');
20
- if (contentType !== null && contentType !== void 0 && contentType.includes('application/pdf')) {
20
+ if (contentType?.includes('application/pdf')) {
21
21
  return Promise.all([response.ok, response.blob()]);
22
22
  }
23
- if (contentType !== null && contentType !== void 0 && contentType.includes('application/json')) {
23
+ if (contentType?.includes('application/json')) {
24
24
  return Promise.all([response.ok, response.json()]);
25
25
  }
26
26
  // it includes all text types
27
- if (contentType !== null && contentType !== void 0 && contentType.includes('text/')) {
27
+ if (contentType?.includes('text/')) {
28
28
  return Promise.all([response.ok, response.text()]);
29
29
  }
30
30
 
@@ -60,9 +60,8 @@ class API {
60
60
  if (ok === true) {
61
61
  resolve(data);
62
62
  } else {
63
- var _data$statusText, _data$status;
64
- const error = new CustomError((_data$statusText = data === null || data === void 0 ? void 0 : data.statusText) !== null && _data$statusText !== void 0 ? _data$statusText : 'Unknown error');
65
- error.code = (_data$status = data === null || data === void 0 ? void 0 : data.status) !== null && _data$status !== void 0 ? _data$status : 500;
63
+ const error = new CustomError(data?.statusText ?? 'Unknown error');
64
+ error.code = data?.status ?? 500;
66
65
  reject(error);
67
66
  }
68
67
  }).catch(error => {
@@ -23,8 +23,7 @@ const defaultValues = {
23
23
  title: 'Verdaccio'
24
24
  };
25
25
  function getConfiguration() {
26
- var _window$__VERDACCIO_B, _window;
27
- const uiConfiguration = (_window$__VERDACCIO_B = (_window = window) === null || _window === void 0 ? void 0 : _window.__VERDACCIO_BASENAME_UI_OPTIONS) !== null && _window$__VERDACCIO_B !== void 0 ? _window$__VERDACCIO_B : defaultValues;
26
+ const uiConfiguration = window?.__VERDACCIO_BASENAME_UI_OPTIONS ?? defaultValues;
28
27
  if ((0, _isNil.default)(uiConfiguration.primaryColor) || (0, _isEmpty.default)(uiConfiguration.primaryColor)) {
29
28
  uiConfiguration.primaryColor = _Theme.colors.PRIMARY_COLOR;
30
29
  }
@@ -23,7 +23,7 @@ const search = exports.search = (0, _core.createModel)()({
23
23
  clearRequestQueue(state) {
24
24
  const controllers = state.controller;
25
25
  controllers.forEach(request => {
26
- request === null || request === void 0 || request.abort();
26
+ request?.abort();
27
27
  });
28
28
  return {
29
29
  ...state,
@@ -33,7 +33,7 @@ function formatLicense(license) {
33
33
  if ((0, _isString.default)(license)) {
34
34
  return license;
35
35
  }
36
- if (license !== null && license !== void 0 && license.type) {
36
+ if (license?.type) {
37
37
  return license.type;
38
38
  }
39
39
  return;
@@ -49,7 +49,7 @@ function formatRepository(repository) {
49
49
  if ((0, _isString.default)(repository)) {
50
50
  return repository;
51
51
  }
52
- if (repository !== null && repository !== void 0 && repository.url) {
52
+ if (repository?.url) {
53
53
  return repository.url;
54
54
  }
55
55
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdaccio/ui-components",
3
- "version": "4.0.0-next-8.0",
3
+ "version": "4.0.0-next-8.2",
4
4
  "description": "theme ui component",
5
5
  "author": "Juan Picado <juanpicado19@gmail.com>",
6
6
  "license": "MIT",
@@ -12,6 +12,7 @@
12
12
  "@emotion/styled": "11.10.6",
13
13
  "@fontsource/material-icons": "^4.5.4",
14
14
  "@fontsource/roboto": "^4.5.8",
15
+ "@microlink/react-json-view": "^1.23.3",
15
16
  "@mui/icons-material": "5.16.5",
16
17
  "@mui/material": "5.16.5",
17
18
  "@mui/styles": "5.16.5",
@@ -35,7 +36,6 @@
35
36
  "react-dom": "18.2.0",
36
37
  "react-hook-form": "7.52.1",
37
38
  "react-i18next": "15.0.0",
38
- "react-json-view": "1.21.3",
39
39
  "react-markdown": "9.0.1",
40
40
  "react-redux": "8.1.3",
41
41
  "react-router": "5.3.4",
@@ -63,7 +63,7 @@
63
63
  "@types/hast": "^2.0.0",
64
64
  "@types/react-router": "^5.1.20",
65
65
  "@types/unist": "^2.0.0",
66
- "@verdaccio/types": "13.0.0-next-8.0",
66
+ "@verdaccio/types": "13.0.0-next-8.1",
67
67
  "babel-loader": "9.1.3",
68
68
  "mockdate": "3.0.5",
69
69
  "msw": "0.49.3",
@@ -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;