@verdaccio/ui-components 3.0.0-next-7.7 → 3.0.0-next-7.8

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 (300) hide show
  1. package/.eslintrc +1 -1
  2. package/CHANGELOG.md +6 -0
  3. package/build/Theme/theme.js +3 -3
  4. package/build/components/ActionBar/ActionBar.js +3 -1
  5. package/build/components/ActionBar/ActionBarAction.js +7 -6
  6. package/build/components/Author/Author.js +13 -42
  7. package/build/components/CopyClipboard/utils.js +3 -12
  8. package/build/components/Dependencies/Dependencies.js +12 -13
  9. package/build/components/Dependencies/DependencyBlock.js +5 -4
  10. package/build/components/Developers/DeveloperType.js +12 -0
  11. package/build/components/Developers/Developers.js +20 -22
  12. package/build/components/Developers/Title.js +5 -9
  13. package/build/components/Developers/index.js +4 -4
  14. package/build/components/Distribution/Dist.js +1 -1
  15. package/build/components/Distribution/styles.js +10 -23
  16. package/build/components/Engines/Engines.js +7 -1
  17. package/build/components/Engines/styles.js +6 -6
  18. package/build/components/FundButton/FundButton.js +7 -8
  19. package/build/components/HeaderInfoDialog/HeaderInfoDialog.js +2 -1
  20. package/build/components/Icons/DevsIcons/CommonJS.js +1 -12
  21. package/build/components/Icons/DevsIcons/ES6Module.js +2 -13
  22. package/build/components/Icons/DevsIcons/Git.js +1 -12
  23. package/build/components/Icons/DevsIcons/NodeJS.js +1 -12
  24. package/build/components/Icons/DevsIcons/TypeScript.js +1 -12
  25. package/build/components/Icons/FileBinary.js +11 -5
  26. package/build/components/Icons/Law.js +12 -6
  27. package/build/components/Icons/Managers/Npm.js +1 -12
  28. package/build/components/Icons/Managers/Pnpm.js +1 -12
  29. package/build/components/Icons/Managers/Yarn.js +1 -12
  30. package/build/components/Install/Install.js +23 -18
  31. package/build/components/Install/InstallListItem.js +19 -18
  32. package/build/components/Keywords/KeywordListItems.js +34 -0
  33. package/build/components/Keywords/Keywords.js +39 -0
  34. package/build/{sections/Header/RegistryInfoDialog → components/Keywords}/index.js +2 -2
  35. package/build/components/Link/Link.js +4 -16
  36. package/build/components/Link/index.js +1 -1
  37. package/build/components/LinkExternal/LinkExternal.js +32 -0
  38. package/build/components/LinkExternal/index.js +14 -0
  39. package/build/components/Loading/styles.js +3 -2
  40. package/build/components/LoginDialog/LoginDialog.js +12 -1
  41. package/build/components/LoginDialog/LoginDialogCloseButton.js +3 -2
  42. package/build/components/LoginDialog/LoginDialogForm.js +2 -14
  43. package/build/components/LoginDialog/LoginDialogFormError.js +3 -2
  44. package/build/components/Logo/Logo.js +13 -6
  45. package/build/components/Package/Package.js +43 -34
  46. package/build/components/Package/styles.js +46 -58
  47. package/build/components/Person/Person.js +48 -0
  48. package/build/components/Person/PersonTooltip.js +22 -0
  49. package/build/components/{Package/Tag → Person}/index.js +2 -2
  50. package/build/components/Person/utils.js +17 -0
  51. package/build/components/RawViewer/RawViewer.js +11 -5
  52. package/build/components/Readme/Readme.js +15 -6
  53. package/build/components/Readme/Readme.js.map +1 -1
  54. package/build/components/Readme/Readme.spec.js +19 -0
  55. package/build/components/Readme/Readme.spec.js.map +1 -1
  56. package/build/components/Readme/utils.js +2 -5
  57. package/build/components/RegistryInfoDialog/styles.js +9 -10
  58. package/build/components/Repository/Repository.js +19 -31
  59. package/build/components/Search/AutoComplete/styles.js +4 -41
  60. package/build/components/Search/Search.js +4 -2
  61. package/build/components/Search/SearchItem.js +51 -38
  62. package/build/components/Search/utils.js +23 -0
  63. package/build/components/SettingsMenu/SettingsMenu.js +35 -9
  64. package/build/components/SideBarTitle/SideBarTitle.js +16 -6
  65. package/build/components/UpLinks/UpLinks.js +35 -6
  66. package/build/components/UpLinks/UplinkLink.js +22 -0
  67. package/build/components/UpLinks/styles.js +5 -4
  68. package/build/components/Versions/HistoryList.js +8 -5
  69. package/build/components/Versions/TagList.js +8 -4
  70. package/build/components/Versions/Versions.js +30 -7
  71. package/build/index.js +27 -3
  72. package/build/providers/AppConfigurationProvider/AppConfigurationProvider.js +1 -0
  73. package/build/providers/PersistenceSettingProvider/PersistenceSettingProvider.js +1 -0
  74. package/build/sections/Detail/Detail.js +6 -2
  75. package/build/sections/Detail/Tabs.js +4 -3
  76. package/build/sections/Footer/Footer.js +17 -8
  77. package/build/sections/Footer/styles.js +13 -10
  78. package/build/sections/Header/HeaderLeft.js +14 -17
  79. package/build/sections/Header/HeaderMenu.js +1 -1
  80. package/build/sections/Header/HeaderRight.js +12 -3
  81. package/build/sections/Header/HeaderSettingsDialog.js +2 -2
  82. package/build/sections/Header/styles.js +43 -82
  83. package/build/sections/SideBar/Sidebar.js +10 -15
  84. package/build/src/Theme/ThemeProvider.test.d.ts +1 -0
  85. package/build/src/components/Author/Author.d.ts +0 -5
  86. package/build/src/components/CopyClipboard/CopyToClipBoard.test.d.ts +1 -0
  87. package/build/src/components/Dependencies/Dependencies.d.ts +0 -1
  88. package/build/src/components/Developers/DeveloperType.d.ts +4 -0
  89. package/build/src/components/Developers/Developers.d.ts +1 -4
  90. package/build/src/components/Developers/Title.d.ts +1 -4
  91. package/build/src/components/Developers/index.d.ts +2 -1
  92. package/build/src/components/Distribution/styles.d.ts +0 -1
  93. package/build/src/components/ErrorBoundary/ErrorBoundary.test.d.ts +1 -0
  94. package/build/src/components/HeaderInfoDialog/HeaderInfoDialog.test.d.ts +1 -0
  95. package/build/src/components/Heading/Heading.test.d.ts +1 -0
  96. package/build/src/components/Icons/Icons.test.d.ts +1 -0
  97. package/build/src/components/Install/InstallListItem.d.ts +1 -1
  98. package/build/src/components/Keywords/KeywordListItems.d.ts +5 -0
  99. package/build/src/components/Keywords/Keywords.d.ts +6 -0
  100. package/build/src/components/Keywords/Keywords.stories.d.ts +5 -0
  101. package/build/src/components/Keywords/Keywords.test.d.ts +1 -0
  102. package/build/src/components/Keywords/index.d.ts +1 -0
  103. package/build/src/components/Link/Link.d.ts +0 -3
  104. package/build/src/components/Link/Link.test.d.ts +1 -0
  105. package/build/src/components/Link/index.d.ts +1 -1
  106. package/build/src/components/LinkExternal/LinkExternal.d.ts +3 -0
  107. package/build/src/components/LinkExternal/LinkExternal.test.d.ts +1 -0
  108. package/build/src/components/LinkExternal/index.d.ts +1 -0
  109. package/build/src/components/Logo/Logo.d.ts +1 -0
  110. package/build/src/components/Logo/Logo.stories.d.ts +5 -0
  111. package/build/src/components/Package/Package.d.ts +1 -1
  112. package/build/src/components/Package/styles.d.ts +0 -8
  113. package/build/src/components/Person/Person.d.ts +9 -0
  114. package/build/src/components/Person/Person.test.d.ts +1 -0
  115. package/build/src/components/Person/PersonTooltip.d.ts +6 -0
  116. package/build/src/components/Person/index.d.ts +1 -0
  117. package/build/src/components/Person/utils.d.ts +3 -0
  118. package/build/src/components/Readme/Readme.d.ts +0 -1
  119. package/build/src/components/Search/AutoComplete/styles.d.ts +0 -8
  120. package/build/src/components/Search/utils.d.ts +1 -0
  121. package/build/src/components/SettingsMenu/SettingsMenu.d.ts +2 -2
  122. package/build/src/components/SettingsMenu/SettingsMenu.test.d.ts +1 -0
  123. package/build/src/components/UpLinks/UplinkLink.d.ts +6 -0
  124. package/build/src/components/Versions/Versions.d.ts +1 -0
  125. package/build/src/index.d.ts +4 -1
  126. package/build/src/sections/Detail/Tabs.d.ts +1 -0
  127. package/build/src/sections/Header/styles.d.ts +0 -7
  128. package/build/src/store/models/routes.d.ts +8 -0
  129. package/build/src/store/models/utils.d.ts +1 -0
  130. package/build/src/types/packageMeta.d.ts +7 -5
  131. package/build/src/utils/routes.d.ts +1 -0
  132. package/build/src/utils/utils.d.ts +1 -0
  133. package/build/store/models/configuration.js +2 -1
  134. package/build/store/models/login.js +4 -2
  135. package/build/store/models/manifest.js +5 -3
  136. package/build/store/models/packages.js +4 -2
  137. package/build/store/models/routes.js +18 -0
  138. package/build/store/models/search.js +4 -2
  139. package/build/store/models/utils.js +10 -0
  140. package/build/utils/routes.js +1 -0
  141. package/build/utils/utils.js +20 -1
  142. package/package.json +2 -2
  143. package/src/AppTest/AppRoute.test.tsx +65 -0
  144. package/src/Theme/ThemeProvider.test.tsx +27 -0
  145. package/src/Theme/theme.ts +3 -3
  146. package/src/components/ActionBar/ActionBar.test.tsx +36 -15
  147. package/src/components/ActionBar/ActionBar.tsx +1 -1
  148. package/src/components/ActionBar/ActionBarAction.tsx +8 -5
  149. package/src/components/Author/Author.test.tsx +7 -1
  150. package/src/components/Author/Author.tsx +3 -41
  151. package/src/components/CopyClipboard/CopyToClipBoard.test.tsx +23 -0
  152. package/src/components/CopyClipboard/utils.ts +2 -13
  153. package/src/components/Dependencies/Dependencies.tsx +9 -9
  154. package/src/components/Dependencies/DependencyBlock.tsx +2 -1
  155. package/src/components/Developers/DeveloperType.tsx +4 -0
  156. package/src/components/Developers/Developers.test.tsx +37 -10
  157. package/src/components/Developers/Developers.tsx +13 -13
  158. package/src/components/Developers/Title.tsx +1 -5
  159. package/src/components/Developers/index.ts +2 -1
  160. package/src/components/Distribution/Dist.test.tsx +1 -1
  161. package/src/components/Distribution/Dist.tsx +2 -4
  162. package/src/components/Distribution/styles.ts +0 -6
  163. package/src/components/Engines/Engines.tsx +6 -2
  164. package/src/components/Engines/styles.ts +1 -1
  165. package/src/components/ErrorBoundary/ErrorBoundary.test.tsx +39 -0
  166. package/src/components/FundButton/FundButton.tsx +5 -5
  167. package/src/components/HeaderInfoDialog/HeaderInfoDialog.test.tsx +51 -0
  168. package/src/components/HeaderInfoDialog/HeaderInfoDialog.tsx +2 -2
  169. package/src/components/Heading/Heading.test.tsx +20 -0
  170. package/src/components/Icons/DevsIcons/CommonJS.tsx +1 -7
  171. package/src/components/Icons/DevsIcons/ES6Module.tsx +2 -8
  172. package/src/components/Icons/DevsIcons/Git.tsx +1 -7
  173. package/src/components/Icons/DevsIcons/NodeJS.tsx +1 -7
  174. package/src/components/Icons/DevsIcons/TypeScript.tsx +1 -7
  175. package/src/components/Icons/FileBinary.tsx +2 -1
  176. package/src/components/Icons/Icons.stories.tsx +21 -5
  177. package/src/components/Icons/Icons.test.tsx +70 -0
  178. package/src/components/Icons/Law.tsx +2 -1
  179. package/src/components/Icons/Managers/Npm.tsx +1 -7
  180. package/src/components/Icons/Managers/Pnpm.tsx +1 -7
  181. package/src/components/Icons/Managers/Yarn.tsx +1 -7
  182. package/src/components/Install/Install.test.tsx +54 -13
  183. package/src/components/Install/Install.tsx +12 -11
  184. package/src/components/Install/InstallListItem.tsx +12 -11
  185. package/src/components/Keywords/KeywordListItems.tsx +22 -0
  186. package/src/components/Keywords/Keywords.stories.tsx +19 -0
  187. package/src/components/Keywords/Keywords.test.tsx +57 -0
  188. package/src/components/Keywords/Keywords.tsx +35 -0
  189. package/src/components/Keywords/index.ts +1 -0
  190. package/src/components/Link/Link.test.tsx +25 -0
  191. package/src/components/Link/Link.tsx +4 -18
  192. package/src/components/Link/index.ts +1 -1
  193. package/src/components/LinkExternal/LinkExternal.test.tsx +18 -0
  194. package/src/components/LinkExternal/LinkExternal.tsx +22 -0
  195. package/src/components/LinkExternal/index.ts +1 -0
  196. package/src/components/Loading/Loading.test.tsx +8 -5
  197. package/src/components/Loading/styles.ts +1 -0
  198. package/src/components/LoginDialog/LoginDialog.test.tsx +1 -1
  199. package/src/components/LoginDialog/LoginDialog.tsx +10 -1
  200. package/src/components/LoginDialog/LoginDialogCloseButton.tsx +1 -0
  201. package/src/components/LoginDialog/LoginDialogForm.tsx +0 -2
  202. package/src/components/LoginDialog/LoginDialogFormError.tsx +1 -1
  203. package/src/components/Logo/Logo.stories.tsx +16 -0
  204. package/src/components/Logo/Logo.test.tsx +8 -1
  205. package/src/components/Logo/Logo.tsx +19 -3
  206. package/src/components/Package/Package.test.tsx +47 -14
  207. package/src/components/Package/Package.tsx +41 -44
  208. package/src/components/Package/styles.ts +7 -17
  209. package/src/components/PackageList/Packagelist.test.tsx +1 -0
  210. package/src/components/Person/Person.test.tsx +50 -0
  211. package/src/components/Person/Person.tsx +45 -0
  212. package/src/components/Person/PersonTooltip.tsx +26 -0
  213. package/src/components/Person/index.ts +1 -0
  214. package/src/components/Person/utils.ts +20 -0
  215. package/src/components/RawViewer/RawViewer.tsx +8 -4
  216. package/src/components/Readme/Readme.spec.tsx +17 -0
  217. package/src/components/Readme/Readme.tsx +10 -5
  218. package/src/components/Readme/utils.ts +2 -5
  219. package/src/components/RegistryInfoDialog/styles.ts +5 -4
  220. package/src/components/Repository/Repository.tsx +9 -14
  221. package/src/components/Search/AutoComplete/styles.ts +7 -0
  222. package/src/components/Search/Search.test.tsx +36 -9
  223. package/src/components/Search/Search.tsx +4 -2
  224. package/src/components/Search/SearchItem.tsx +19 -8
  225. package/src/components/Search/utils.ts +17 -0
  226. package/src/components/SettingsMenu/SettingsMenu.test.tsx +41 -0
  227. package/src/components/SettingsMenu/SettingsMenu.tsx +48 -10
  228. package/src/components/SideBarTitle/SideBarTitle.tsx +19 -3
  229. package/src/components/UpLinks/UpLinks.test.tsx +7 -0
  230. package/src/components/UpLinks/UpLinks.tsx +38 -15
  231. package/src/components/UpLinks/UplinkLink.tsx +20 -0
  232. package/src/components/UpLinks/styles.ts +1 -0
  233. package/src/components/Versions/HistoryList.tsx +9 -4
  234. package/src/components/Versions/TagList.tsx +4 -3
  235. package/src/components/Versions/Versions.test.tsx +2 -0
  236. package/src/components/Versions/Versions.tsx +57 -32
  237. package/src/index.ts +4 -1
  238. package/src/providers/AppConfigurationProvider/AppConfigurationProvider.tsx +1 -0
  239. package/src/providers/PersistenceSettingProvider/PersistenceSettingProvider.tsx +2 -0
  240. package/src/providers/VersionProvider/VersionProvider.test.tsx +3 -3
  241. package/src/sections/Detail/Detail.test.tsx +8 -1
  242. package/src/sections/Detail/Detail.tsx +11 -4
  243. package/src/sections/Detail/Tabs.tsx +5 -2
  244. package/src/sections/Footer/Footer.tsx +15 -4
  245. package/src/sections/Footer/styles.ts +4 -0
  246. package/src/sections/Header/Header.test.tsx +12 -10
  247. package/src/sections/Header/HeaderLeft.tsx +19 -11
  248. package/src/sections/Header/HeaderMenu.tsx +1 -1
  249. package/src/sections/Header/HeaderRight.tsx +14 -3
  250. package/src/sections/Header/HeaderSettingsDialog.tsx +1 -1
  251. package/src/sections/Header/RegistryInfoContent/RegistryInfoContent.test.tsx +1 -1
  252. package/src/sections/Header/styles.ts +4 -16
  253. package/src/sections/Home/Home.test.tsx +12 -4
  254. package/src/sections/SideBar/Sidebar.test.tsx +20 -13
  255. package/src/sections/SideBar/Sidebar.tsx +5 -9
  256. package/src/store/api.test.ts +16 -0
  257. package/src/store/models/configuration.ts +2 -1
  258. package/src/store/models/login.ts +10 -12
  259. package/src/store/models/manifest.ts +6 -5
  260. package/src/store/models/packages.ts +4 -5
  261. package/src/store/models/routes.ts +10 -0
  262. package/src/store/models/search.ts +4 -2
  263. package/src/store/models/utils.ts +3 -0
  264. package/src/types/packageMeta.ts +7 -5
  265. package/src/utils/routes.ts +1 -0
  266. package/src/utils/utils.test.ts +34 -0
  267. package/src/utils/utils.ts +20 -5
  268. package/tsconfig.json +1 -1
  269. package/build/components/Developers/styles.js +0 -65
  270. package/build/components/Distribution/utils.js +0 -25
  271. package/build/components/Distribution/utilts.spec.js +0 -18
  272. package/build/components/Package/Tag/Tag.js +0 -14
  273. package/build/components/Package/Tag/styles.js +0 -24
  274. package/build/sections/Header/RegistryInfoDialog/RegistryInfoDialog.js +0 -36
  275. package/build/sections/Header/RegistryInfoDialog/styles.js +0 -46
  276. package/build/sections/Header/RegistryInfoDialog/types.js +0 -6
  277. package/build/src/components/Developers/styles.d.ts +0 -11
  278. package/build/src/components/Distribution/utils.d.ts +0 -7
  279. package/build/src/components/Package/Tag/Tag.d.ts +0 -6
  280. package/build/src/components/Package/Tag/index.d.ts +0 -1
  281. package/build/src/components/Package/Tag/styles.d.ts +0 -5
  282. package/build/src/sections/Header/RegistryInfoDialog/RegistryInfoDialog.d.ts +0 -4
  283. package/build/src/sections/Header/RegistryInfoDialog/index.d.ts +0 -1
  284. package/build/src/sections/Header/RegistryInfoDialog/styles.d.ts +0 -13
  285. package/build/src/sections/Header/RegistryInfoDialog/types.d.ts +0 -7
  286. package/src/components/Developers/styles.ts +0 -31
  287. package/src/components/Distribution/utils.ts +0 -32
  288. package/src/components/Distribution/utilts.spec.ts +0 -17
  289. package/src/components/Package/Tag/Tag.test.tsx +0 -15
  290. package/src/components/Package/Tag/Tag.tsx +0 -11
  291. package/src/components/Package/Tag/index.ts +0 -1
  292. package/src/components/Package/Tag/styles.ts +0 -11
  293. package/src/components/Search/AutoComplete/styles.tsx +0 -42
  294. package/src/sections/Header/RegistryInfoDialog/RegistryInfoDialog.tsx +0 -31
  295. package/src/sections/Header/RegistryInfoDialog/index.ts +0 -1
  296. package/src/sections/Header/RegistryInfoDialog/styles.ts +0 -21
  297. package/src/sections/Header/RegistryInfoDialog/types.ts +0 -8
  298. /package/build/components/Icons/DevsIcons/{es6modules.svg → es6module.svg} +0 -0
  299. /package/build/src/{components/Package/Tag/Tag.test.d.ts → AppTest/AppRoute.test.d.ts} +0 -0
  300. /package/src/components/Icons/DevsIcons/{es6modules.svg → es6module.svg} +0 -0
@@ -4,11 +4,7 @@ import React from 'react';
4
4
  import { useTranslation } from 'react-i18next';
5
5
 
6
6
  import { Theme } from '../../Theme';
7
-
8
- export enum DeveloperType {
9
- CONTRIBUTORS = 'contributors',
10
- MAINTAINERS = 'maintainers',
11
- }
7
+ import { DeveloperType } from './';
12
8
 
13
9
  interface Props {
14
10
  type: DeveloperType;
@@ -1 +1,2 @@
1
- export { default, DeveloperType } from './Developers';
1
+ export { default } from './Developers';
2
+ export { DeveloperType } from './DeveloperType';
@@ -33,7 +33,7 @@ describe('<Dist /> component', () => {
33
33
  expect(getByText('sidebar.distribution.size')).toBeInTheDocument();
34
34
  expect(getByText('sidebar.distribution.size')).toBeInTheDocument();
35
35
  expect(getByText('7', { exact: false })).toBeInTheDocument();
36
- expect(getByText('10.00 Bytes', { exact: false })).toBeInTheDocument();
36
+ expect(getByText('10 Bytes', { exact: false })).toBeInTheDocument();
37
37
  });
38
38
 
39
39
  test('should render the component with license as string', () => {
@@ -3,8 +3,8 @@ import React, { FC } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
 
5
5
  import { PackageMetaInterface } from '../../types/packageMeta';
6
+ import { fileSizeSI, formatLicense } from '../../utils/utils';
6
7
  import { DistChips, DistListItem, StyledText } from './styles';
7
- import { fileSizeSI, formatLicense } from './utils';
8
8
 
9
9
  const DistChip: FC<{ name: string; children?: React.ReactElement | string }> = ({
10
10
  name,
@@ -47,9 +47,7 @@ const Dist: FC<{ packageMeta: PackageMetaInterface }> = ({ packageMeta }) => {
47
47
  <DistChip name={t('sidebar.distribution.size')}>{fileSizeSI(dist.unpackedSize)}</DistChip>
48
48
  ) : null}
49
49
 
50
- <DistChip name={t('sidebar.distribution.license')}>
51
- {formatLicense(license as string)}
52
- </DistChip>
50
+ <DistChip name={t('sidebar.distribution.license')}>{formatLicense(license)}</DistChip>
53
51
  </DistListItem>
54
52
  </List>
55
53
  );
@@ -1,6 +1,5 @@
1
1
  import styled from '@emotion/styled';
2
2
  import Chip from '@mui/material/Chip';
3
- import FabMUI from '@mui/material/Fab';
4
3
  import ListItem from '@mui/material/ListItem';
5
4
  import Typography from '@mui/material/Typography';
6
5
 
@@ -22,8 +21,3 @@ export const DistChips = styled(Chip)({
22
21
  textTransform: 'capitalize',
23
22
  marginTop: 5,
24
23
  });
25
-
26
- export const DownloadButton = styled(FabMUI)<{ theme?: Theme }>((props) => ({
27
- backgroundColor: props.theme?.palette.primary.main,
28
- color: props.theme?.palette.white,
29
- }));
@@ -23,8 +23,12 @@ const EngineItem: FC<EngineItemProps> = ({ title, element, engineText }) => (
23
23
  <Grid item={true} xs={6}>
24
24
  <List subheader={<StyledText variant={'subtitle1'}>{title}</StyledText>}>
25
25
  <EngineListItem>
26
- <Avatar sx={{ bgcolor: 'transparent' }}>{element}</Avatar>
27
- <Typography variant="subtitle2">{engineText}</Typography>
26
+ <Avatar sx={{ backgroundColor: 'transparent', marginLeft: 0, padding: 0 }}>
27
+ {element}
28
+ </Avatar>
29
+ <Typography sx={{ margin: 0, padding: '0 0 0 10px' }} variant="subtitle2">
30
+ {engineText}
31
+ </Typography>
28
32
  </EngineListItem>
29
33
  </List>
30
34
  </Grid>
@@ -10,5 +10,5 @@ export const StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({
10
10
  }));
11
11
 
12
12
  export const EngineListItem = styled(ListItem)({
13
- paddingLeft: 0,
13
+ padding: 0,
14
14
  });
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+
3
+ import { render, screen } from '../../test/test-react-testing-library';
4
+ import ErrorBoundary from './ErrorBoundary';
5
+
6
+ describe('ErrorBoundary component', () => {
7
+ test('should render children when no error is caught', () => {
8
+ render(
9
+ <ErrorBoundary>
10
+ <div>{'Test'}</div>
11
+ </ErrorBoundary>
12
+ );
13
+
14
+ expect(screen.getByText('Test')).toBeInTheDocument();
15
+ });
16
+
17
+ test('should render error information when error is caught', () => {
18
+ const ErrorComponent = () => {
19
+ throw new Error('Test error');
20
+ };
21
+
22
+ // Suppress error messages for this test
23
+ const spy = jest.spyOn(console, 'error');
24
+ spy.mockImplementation(() => {});
25
+
26
+ render(
27
+ <ErrorBoundary>
28
+ <ErrorComponent />
29
+ </ErrorBoundary>
30
+ );
31
+
32
+ expect(screen.getByText('Something went wrong.')).toBeInTheDocument();
33
+ expect(screen.getByText(/error:/)).toBeInTheDocument();
34
+ expect(screen.getByText(/info:/)).toBeInTheDocument();
35
+
36
+ // Restore console.error after test
37
+ spy.mockRestore();
38
+ });
39
+ });
@@ -6,11 +6,11 @@ import { Trans } from 'react-i18next';
6
6
 
7
7
  import { Theme } from '../../Theme';
8
8
  import { url } from '../../utils';
9
- import { Link } from '../Link';
9
+ import LinkExternal from '../LinkExternal';
10
10
 
11
- const StyledLink = styled(Link)<{ theme?: Theme }>(({ theme }) => ({
12
- marginTop: theme?.spacing(1),
13
- marginBottom: theme?.spacing(1),
11
+ const StyledLink = styled(LinkExternal)<{ theme?: Theme }>(({ theme }) => ({
12
+ marginTop: theme?.spacing(2),
13
+ marginBottom: theme?.spacing(2),
14
14
  textDecoration: 'none',
15
15
  display: 'block',
16
16
  }));
@@ -32,7 +32,7 @@ const FundButton: React.FC<{ packageMeta: any }> = ({ packageMeta }) => {
32
32
  }
33
33
 
34
34
  return (
35
- <StyledLink external={true} to={fundingUrl} variant="button">
35
+ <StyledLink to={fundingUrl} variant="button">
36
36
  <Button
37
37
  color="primary"
38
38
  fullWidth={true}
@@ -0,0 +1,51 @@
1
+ import React from 'react';
2
+
3
+ import { fireEvent, render, screen } from '../../test/test-react-testing-library';
4
+ import HeaderInfoDialog from './HeaderInfoDialog';
5
+
6
+ describe('HeaderInfoDialog', () => {
7
+ const onCloseDialog = jest.fn();
8
+
9
+ const tabs = [{ label: 'Tab 1' }, { label: 'Tab 2' }];
10
+
11
+ const tabPanels = [{ element: <div>{'Panel 1'}</div> }, { element: <div>{'Panel 2'}</div> }];
12
+
13
+ beforeEach(() => {
14
+ render(
15
+ <HeaderInfoDialog
16
+ dialogTitle="Dialog Title"
17
+ isOpen={true}
18
+ onCloseDialog={onCloseDialog}
19
+ tabPanels={tabPanels}
20
+ tabs={tabs}
21
+ />
22
+ );
23
+ });
24
+
25
+ test('renders without crashing', () => {
26
+ expect(screen.getByRole('dialog')).toBeInTheDocument();
27
+ });
28
+
29
+ test('displays the dialog title', () => {
30
+ expect(screen.getByText('Dialog Title')).toBeInTheDocument();
31
+ });
32
+
33
+ test('renders the tabs correctly', () => {
34
+ expect(screen.getByText('Tab 1')).toBeInTheDocument();
35
+ expect(screen.getByText('Tab 2')).toBeInTheDocument();
36
+ });
37
+
38
+ test('renders the tab panels correctly', async () => {
39
+ expect(screen.getByText('Panel 1')).toBeInTheDocument();
40
+ // Panel 2 should not be visible initially
41
+ expect(screen.queryByText('Panel 2')).not.toBeInTheDocument();
42
+ // Switch to Tab 2
43
+ fireEvent.click(screen.getByText('Tab 2'));
44
+ await expect(screen.queryByText('Panel 2')).toBeInTheDocument();
45
+ });
46
+
47
+ test('calls onCloseDialog when the dialog is closed', () => {
48
+ fireEvent.click(screen.getByRole('button'));
49
+ expect(onCloseDialog).toHaveBeenCalled();
50
+ });
51
+ });
@@ -54,7 +54,7 @@ const HeaderInfoDialog: React.FC<Props> = ({
54
54
  <RegistryInfoDialog onClose={onCloseDialog} open={isOpen} title={dialogTitle}>
55
55
  <Box sx={{ width: '100%' }}>
56
56
  <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
57
- <Tabs aria-label="infoTabs" onChange={handleChange} value={value}>
57
+ <Tabs aria-label="infoTabs" data-testid={'tabs'} onChange={handleChange} value={value}>
58
58
  {tabs
59
59
  ? tabs.map((item, index) => {
60
60
  return (
@@ -68,7 +68,7 @@ const HeaderInfoDialog: React.FC<Props> = ({
68
68
  {tabPanels
69
69
  ? tabPanels.map((item, index) => {
70
70
  return (
71
- <TabPanel index={index} key={item.key} value={value}>
71
+ <TabPanel index={index} key={index} value={value}>
72
72
  {item.element}
73
73
  </TabPanel>
74
74
  );
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+
3
+ import { render, screen } from '../../test/test-react-testing-library';
4
+ import Heading from './Heading';
5
+
6
+ describe('Heading component', () => {
7
+ test('should render correctly with default props', () => {
8
+ render(<Heading>{'Test'}</Heading>);
9
+ const headingElement = screen.getByText('Test');
10
+ expect(headingElement).toBeInTheDocument();
11
+ expect(headingElement.tagName).toBe('H6');
12
+ });
13
+
14
+ test('should render correctly with custom props', () => {
15
+ render(<Heading variant="h1">{'Test'}</Heading>);
16
+ const headingElement = screen.getByText('Test');
17
+ expect(headingElement).toBeInTheDocument();
18
+ expect(headingElement.tagName).toBe('H1');
19
+ });
20
+ });
@@ -1,13 +1,7 @@
1
- import styled from '@emotion/styled';
2
- import { Theme } from '@mui/material';
3
1
  import React from 'react';
4
2
 
5
3
  const icon = require('./commonjs.svg');
6
4
 
7
- const ImgIcon = styled.img<{ theme?: Theme }>(({ theme }) => ({
8
- marginLeft: theme?.spacing(1),
9
- }));
10
-
11
5
  export function CommonJS() {
12
- return <ImgIcon alt="commonjs" height="20" src={icon} width="20" />;
6
+ return <img alt="commonjs" height="20" src={icon} width="20" />;
13
7
  }
@@ -1,13 +1,7 @@
1
- import styled from '@emotion/styled';
2
- import { Theme } from '@mui/material';
3
1
  import React from 'react';
4
2
 
5
- const icon = require('./es6modules.svg');
6
-
7
- const ImgIcon = styled.img<{ theme?: Theme }>(({ theme }) => ({
8
- marginLeft: theme?.spacing(1),
9
- }));
3
+ const icon = require('./es6module.svg');
10
4
 
11
5
  export function ES6Modules() {
12
- return <ImgIcon alt="es6 modules" height="20" src={icon} width="20" />;
6
+ return <img alt="es6 modules" height="20" src={icon} width="20" />;
13
7
  }
@@ -1,13 +1,7 @@
1
- import styled from '@emotion/styled';
2
- import { Theme } from '@mui/material';
3
1
  import React from 'react';
4
2
 
5
3
  const icon = require('./git.svg');
6
4
 
7
- const ImgIcon = styled.img<{ theme?: Theme }>(({ theme }) => ({
8
- marginLeft: theme?.spacing(1),
9
- }));
10
-
11
5
  export function Git() {
12
- return <ImgIcon alt="git" height="20" src={icon} width="20" />;
6
+ return <img alt="git" height="20" src={icon} width="20" />;
13
7
  }
@@ -1,13 +1,7 @@
1
- import styled from '@emotion/styled';
2
- import { Theme } from '@mui/material';
3
1
  import React from 'react';
4
2
 
5
3
  const icon = require('./nodejs.svg');
6
4
 
7
- const ImgIcon = styled.img<{ theme?: Theme }>(({ theme }) => ({
8
- marginLeft: theme?.spacing(1),
9
- }));
10
-
11
5
  export function NodeJS() {
12
- return <ImgIcon alt="nodejs" height="20" src={icon} width="20" />;
6
+ return <img alt="nodejs" height="20" src={icon} width="20" />;
13
7
  }
@@ -1,13 +1,7 @@
1
- import styled from '@emotion/styled';
2
- import { Theme } from '@mui/material';
3
1
  import React from 'react';
4
2
 
5
3
  const icon = require('./typescript.svg');
6
4
 
7
- const ImgIcon = styled.img<{ theme?: Theme }>(({ theme }) => ({
8
- marginLeft: theme?.spacing(1),
9
- }));
10
-
11
5
  export function TypeScript() {
12
- return <ImgIcon alt="typescript" height="20" src={icon} width="20" />;
6
+ return <img alt="typescript" height="20" src={icon} width="20" />;
13
7
  }
@@ -9,7 +9,8 @@ const FileBinary = React.forwardRef(function FileBinary(
9
9
  ref: React.Ref<SVGSVGElement>
10
10
  ) {
11
11
  return (
12
- <SvgIcon {...props} ref={ref}>
12
+ // eslint-disable-next-line verdaccio/jsx-spread
13
+ <SvgIcon viewBox="0 0 14 16" {...props} ref={ref}>
13
14
  <path d="M8.5 1H1c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h10c.55 0 1-.45 1-1V4.5L8.5 1zM11 14H1V2h7l3 3v9zM5 6.98L3.5 8.5 5 10l-.5 1L2 8.5 4.5 6l.5.98zM7.5 6L10 8.5 7.5 11l-.5-.98L8.5 8.5 7 7l.5-1z" />
14
15
  </SvgIcon>
15
16
  );
@@ -6,13 +6,17 @@ import {
6
6
  CommonJS,
7
7
  ES6Modules,
8
8
  Earth,
9
+ FileBinary,
9
10
  Git,
10
11
  Law,
11
12
  License,
12
13
  NodeJS,
14
+ Npm,
15
+ Pnpm,
13
16
  Time,
14
17
  TypeScript,
15
18
  Version,
19
+ Yarn,
16
20
  } from '.';
17
21
 
18
22
  export default {
@@ -21,16 +25,28 @@ export default {
21
25
 
22
26
  export const Icons: any = () => (
23
27
  <Box sx={{ width: '100%' }}>
24
- <Stack spacing={2}>
28
+ <Stack direction="row" spacing={2}>
29
+ <Npm />
30
+ <Pnpm />
31
+ <Yarn />
32
+ </Stack>
33
+ <Stack direction="row" spacing={2}>
25
34
  <NodeJS />
26
35
  <Git />
27
- <Version />
36
+ </Stack>
37
+ <Stack direction="row" spacing={2}>
28
38
  <TypeScript />
29
- <Time />
30
- <License />
31
- <Law />
32
39
  <ES6Modules />
33
40
  <CommonJS />
41
+ </Stack>
42
+ <Stack direction="row" spacing={2}>
43
+ <Version />
44
+ <Time />
45
+ <FileBinary />
46
+ <Law />
47
+ </Stack>
48
+ <Stack direction="row" spacing={2}>
49
+ <License />
34
50
  <Earth />
35
51
  </Stack>
36
52
  </Box>
@@ -0,0 +1,70 @@
1
+ import React from 'react';
2
+
3
+ import { render } from '../../test/test-react-testing-library';
4
+ import {
5
+ CommonJS,
6
+ ES6Modules,
7
+ Earth,
8
+ FileBinary,
9
+ Git,
10
+ Law,
11
+ License,
12
+ NodeJS,
13
+ Npm,
14
+ Pnpm,
15
+ Time,
16
+ TypeScript,
17
+ Version,
18
+ Yarn,
19
+ } from './';
20
+ import { SvgIcon } from './SvgIcon';
21
+
22
+ describe('Icon components', () => {
23
+ test('should render an SVG graphic', () => {
24
+ const { container } = render(
25
+ <>
26
+ <Earth />
27
+ <FileBinary />
28
+ <Law />
29
+ <License />
30
+ <Time />
31
+ <Version />
32
+ </>
33
+ );
34
+ expect(container.querySelectorAll('svg')).toHaveLength(6);
35
+ });
36
+
37
+ test('should render an IMG graphic linking to and SVG', () => {
38
+ const { container } = render(
39
+ <>
40
+ <CommonJS />
41
+ <ES6Modules />
42
+ <Git />
43
+ <NodeJS />
44
+ <TypeScript />
45
+ <Npm />
46
+ <Pnpm />
47
+ <Yarn />
48
+ </>
49
+ );
50
+ expect(container.querySelectorAll('img')).toHaveLength(8);
51
+ });
52
+
53
+ test('should render small graphic', () => {
54
+ const { container } = render(
55
+ <SvgIcon size={'sm'}>
56
+ <circle cx="7" cy="7" r="7" />
57
+ </SvgIcon>
58
+ );
59
+ expect(container.querySelector('svg')).toHaveStyle('width: 14px');
60
+ });
61
+
62
+ test('should render medium graphic', () => {
63
+ const { container } = render(
64
+ <SvgIcon size={'md'}>
65
+ <circle cx="7" cy="7" r="7" />
66
+ </SvgIcon>
67
+ );
68
+ expect(container.querySelector('svg')).toHaveStyle('width: 18px');
69
+ });
70
+ });
@@ -6,7 +6,8 @@ type Props = React.ComponentProps<typeof SvgIcon>;
6
6
 
7
7
  const Law = React.forwardRef(function Law(props: Props, ref: React.Ref<SVGSVGElement>) {
8
8
  return (
9
- <SvgIcon {...props} ref={ref}>
9
+ // eslint-disable-next-line verdaccio/jsx-spread
10
+ <SvgIcon viewBox="0 0 14 16" {...props} ref={ref}>
10
11
  <path
11
12
  d="M7 4c-.83 0-1.5-.67-1.5-1.5S6.17 1 7 1s1.5.67 1.5 1.5S7.83 4 7 4zm7 6c0 1.11-.89 2-2 2h-1c-1.11 0-2-.89-2-2l2-4h-1c-.55 0-1-.45-1-1H8v8c.42 0 1 .45 1 1h1c.42 0 1 .45 1 1H3c0-.55.58-1 1-1h1c0-.55.58-1 1-1h.03L6 5H5c0 .55-.45 1-1 1H3l2 4c0 1.11-.89 2-2 2H2c-1.11 0-2-.89-2-2l2-4H1V5h3c0-.55.45-1 1-1h4c.55 0 1 .45 1 1h3v1h-1l2 4zM2.5 7L1 10h3L2.5 7zM13 10l-1.5-3-1.5 3h3z"
12
13
  fillRule="evenodd"
@@ -1,13 +1,7 @@
1
- import styled from '@emotion/styled';
2
- import { Theme } from '@mui/material';
3
1
  import React from 'react';
4
2
 
5
3
  const icon = require('./npm.svg');
6
4
 
7
- const ImgIcon = styled.img<{ theme?: Theme }>(({ theme }) => ({
8
- marginLeft: theme?.spacing(1),
9
- }));
10
-
11
5
  export function Npm() {
12
- return <ImgIcon alt="npm package manager" height="20" src={icon} width="20" />;
6
+ return <img alt="npm package manager" height="20" src={icon} width="20" />;
13
7
  }
@@ -1,13 +1,7 @@
1
- import styled from '@emotion/styled';
2
- import { Theme } from '@mui/material';
3
1
  import React from 'react';
4
2
 
5
3
  const icon = require('./pnpm.svg');
6
4
 
7
- const ImgIcon = styled.img<{ theme?: Theme }>(({ theme }) => ({
8
- marginLeft: theme?.spacing(1),
9
- }));
10
-
11
5
  export function Pnpm() {
12
- return <ImgIcon alt="pnpm package manager" height="20" src={icon} width="20" />;
6
+ return <img alt="pnpm package manager" height="20" src={icon} width="20" />;
13
7
  }
@@ -1,13 +1,7 @@
1
- import styled from '@emotion/styled';
2
- import { Theme } from '@mui/material';
3
1
  import React from 'react';
4
2
 
5
3
  const icon = require('./yarn.svg');
6
4
 
7
- const ImgIcon = styled.img<{ theme?: Theme }>(({ theme }) => ({
8
- marginLeft: theme?.spacing(1),
9
- }));
10
-
11
5
  export function Yarn() {
12
- return <ImgIcon alt="npm package manager" height="20" src={icon} width="20" />;
6
+ return <img alt="npm package manager" height="20" src={icon} width="20" />;
13
7
  }
@@ -5,12 +5,14 @@ import { PackageManagers } from '@verdaccio/types';
5
5
  import { useConfig } from '../../providers';
6
6
  import { render, screen } from '../../test/test-react-testing-library';
7
7
  import Install from './Install';
8
- import { getGlobalInstall } from './InstallListItem';
8
+ import InstallListItem, { DependencyManager, getGlobalInstall } from './InstallListItem';
9
9
  import data from './__partials__/data.json';
10
10
 
11
- const ComponentToBeRendered: React.FC<{ pkgManagers?: PackageManagers[] }> = () => {
11
+ const ComponentToBeRendered: React.FC<{ name?: string; pkgManagers?: PackageManagers[] }> = ({
12
+ name = 'foo',
13
+ }) => {
12
14
  const { configOptions } = useConfig();
13
- return <Install configOptions={configOptions} packageMeta={data} packageName="foo" />;
15
+ return <Install configOptions={configOptions} packageMeta={data} packageName={name} />;
14
16
  };
15
17
 
16
18
  /* eslint-disable react/jsx-no-bind*/
@@ -22,6 +24,11 @@ describe('<Install />', () => {
22
24
  expect(screen.getByText('npm install foo@8.0.0')).toBeInTheDocument();
23
25
  });
24
26
 
27
+ test('should not render if name is missing', () => {
28
+ render(<ComponentToBeRendered name="" />);
29
+ expect(screen.queryByTestId('installList')).toBeNull();
30
+ });
31
+
25
32
  test('should have 3 children', () => {
26
33
  window.__VERDACCIO_BASENAME_UI_OPTIONS.pkgManagers = ['yarn', 'pnpm', 'npm'];
27
34
  const { getByTestId } = render(<ComponentToBeRendered />);
@@ -32,9 +39,7 @@ describe('<Install />', () => {
32
39
 
33
40
  test('should have the element NPM', () => {
34
41
  window.__VERDACCIO_BASENAME_UI_OPTIONS.pkgManagers = ['npm'];
35
-
36
42
  render(<ComponentToBeRendered />);
37
-
38
43
  expect(screen.getByText('sidebar.installation.title')).toBeTruthy();
39
44
  expect(screen.queryByText('pnpm')).not.toBeInTheDocument();
40
45
  expect(screen.queryByText('yarn')).not.toBeInTheDocument();
@@ -59,18 +64,54 @@ describe('<Install />', () => {
59
64
  });
60
65
  });
61
66
 
67
+ describe('<InstallListItem />', () => {
68
+ test('renders correctly', () => {
69
+ render(
70
+ <InstallListItem
71
+ dependencyManager={DependencyManager.NPM}
72
+ packageName={'foo'}
73
+ packageVersion={'8.0.0'}
74
+ />
75
+ );
76
+ expect(screen.queryByTestId('installListItem-npm')).toBeInTheDocument();
77
+ });
78
+
79
+ test('should not render if name is missing', () => {
80
+ render(
81
+ // @ts-ignore - testing invalid value
82
+ <InstallListItem dependencyManager={'other'} packageName={'foo'} packageVersion={'8.0.0'} />
83
+ );
84
+ // expect nothing to be rendered
85
+ expect(screen.queryByTestId('installListItem-npm')).toBeNull();
86
+ });
87
+ });
88
+
62
89
  describe('getGlobalInstall', () => {
63
- test('no global', () => {
64
- expect(getGlobalInstall(false, 'foo', '1.0.0')).toEqual('1.0.0@foo');
90
+ test('version', () => {
91
+ expect(getGlobalInstall(false, false, '1.0.0', 'foo')).toEqual('foo@1.0.0');
92
+ });
93
+ test('latest', () => {
94
+ expect(getGlobalInstall(true, false, '1.0.0', 'foo')).toEqual('foo');
95
+ });
96
+
97
+ test('version global', () => {
98
+ expect(getGlobalInstall(false, true, '1.0.0', 'foo')).toEqual('-g foo@1.0.0');
99
+ });
100
+ test('latest global', () => {
101
+ expect(getGlobalInstall(true, true, '1.0.0', 'foo')).toEqual('-g foo');
102
+ });
103
+
104
+ test('yarn version', () => {
105
+ expect(getGlobalInstall(false, false, '1.0.0', 'foo', true)).toEqual('foo@1.0.0');
65
106
  });
66
- test('global', () => {
67
- expect(getGlobalInstall(true, 'foo', '1.0.0')).toEqual('-g 1.0.0@foo');
107
+ test('yarn latest', () => {
108
+ expect(getGlobalInstall(true, false, '1.0.0', 'foo', true)).toEqual('foo');
68
109
  });
69
110
 
70
- test('yarn no global', () => {
71
- expect(getGlobalInstall(false, 'foo', '1.0.0', true)).toEqual('1.0.0@foo');
111
+ test('yarn version global', () => {
112
+ expect(getGlobalInstall(false, true, '1.0.0', 'foo', true)).toEqual('foo@1.0.0');
72
113
  });
73
- test('yarn global', () => {
74
- expect(getGlobalInstall(true, 'foo', '1.0.0', true)).toEqual('1.0.0@foo');
114
+ test('yarn latest global', () => {
115
+ expect(getGlobalInstall(true, true, '1.0.0', 'foo', true)).toEqual('foo');
75
116
  });
76
117
  });