@verdaccio/ui-theme 3.1.0 → 6.0.0-6-next.11

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 (381) hide show
  1. package/.babelrc +33 -0
  2. package/.eslintrc +115 -0
  3. package/.stylelintrc +40 -0
  4. package/CHANGELOG.md +152 -554
  5. package/LICENSE +1 -1
  6. package/README.md +22 -95
  7. package/config/env.js +9 -0
  8. package/jest/api/packages.json +42 -0
  9. package/jest/identity.js +29 -0
  10. package/jest/jest.config.js +39 -0
  11. package/jest/jestEnvironment.js +1 -0
  12. package/jest/server-handlers.ts +9 -0
  13. package/jest/server.ts +6 -0
  14. package/jest/setup-env.ts +15 -0
  15. package/jest/setup.ts +31 -0
  16. package/jest/unit/components/__mocks__/api.ts +47 -0
  17. package/jest/unit/components/__mocks__/token.ts +31 -0
  18. package/jest/unit/components/store/login.ts +23 -0
  19. package/jest/unit/components/store/logo.ts +7 -0
  20. package/jest/unit/components/store/package.ts +174 -0
  21. package/jest/unit/components/store/packageMeta.ts +592 -0
  22. package/jest/unit/empty.ts +1 -0
  23. package/lib/constants.ts +9 -0
  24. package/package.json +153 -228
  25. package/src/App/App.test.tsx +123 -0
  26. package/src/App/App.tsx +54 -0
  27. package/src/App/AppError.tsx +38 -0
  28. package/src/App/AppRoute.tsx +63 -0
  29. package/src/App/Footer/Footer.test.tsx +20 -0
  30. package/src/App/Footer/Footer.tsx +111 -0
  31. package/src/App/Footer/__snapshots__/Footer.test.tsx.snap +456 -0
  32. package/src/App/Footer/index.ts +1 -0
  33. package/src/App/Footer/styles.ts +44 -0
  34. package/src/App/Header/Header.test.tsx +152 -0
  35. package/src/App/Header/Header.tsx +74 -0
  36. package/src/App/Header/HeaderGreetings.tsx +22 -0
  37. package/src/App/Header/HeaderInfoDialog.tsx +19 -0
  38. package/src/App/Header/HeaderLeft.tsx +31 -0
  39. package/src/App/Header/HeaderMenu.tsx +65 -0
  40. package/src/App/Header/HeaderRight.tsx +118 -0
  41. package/src/App/Header/HeaderToolTip.tsx +19 -0
  42. package/src/App/Header/HeaderToolTipIcon.tsx +75 -0
  43. package/src/App/Header/LanguageSwitch.tsx +125 -0
  44. package/src/App/Header/LoginDialog/LoginDialog.test.tsx +112 -0
  45. package/src/App/Header/LoginDialog/LoginDialog.tsx +81 -0
  46. package/src/App/Header/LoginDialog/LoginDialogCloseButton.tsx +32 -0
  47. package/src/App/Header/LoginDialog/LoginDialogForm.tsx +97 -0
  48. package/src/App/Header/LoginDialog/LoginDialogFormError.tsx +43 -0
  49. package/src/App/Header/LoginDialog/LoginDialogHeader.tsx +48 -0
  50. package/src/App/Header/LoginDialog/__snapshots__/LoginDialog.test.tsx.snap +3 -0
  51. package/src/App/Header/LoginDialog/index.ts +1 -0
  52. package/src/App/Header/RegistryInfoContent/RegistryInfoContent.test.tsx +27 -0
  53. package/src/App/Header/RegistryInfoContent/RegistryInfoContent.tsx +155 -0
  54. package/src/App/Header/RegistryInfoContent/index.ts +1 -0
  55. package/src/App/Header/RegistryInfoDialog/RegistryInfoDialog.tsx +30 -0
  56. package/src/App/Header/RegistryInfoDialog/index.ts +1 -0
  57. package/src/App/Header/RegistryInfoDialog/styles.ts +16 -0
  58. package/src/App/Header/RegistryInfoDialog/types.ts +7 -0
  59. package/src/App/Header/Search/Search.test.tsx +168 -0
  60. package/src/App/Header/Search/Search.tsx +127 -0
  61. package/src/App/Header/Search/SearchAdornment.tsx +18 -0
  62. package/src/App/Header/Search/__snapshots__/Search.test.tsx.snap +101 -0
  63. package/src/App/Header/Search/index.ts +1 -0
  64. package/src/App/Header/index.ts +1 -0
  65. package/src/App/Header/styles.ts +89 -0
  66. package/src/App/index.ts +1 -0
  67. package/src/App/utils/loadable.tsx +10 -0
  68. package/src/components/.eslintrc +7 -0
  69. package/src/components/ActionBar/ActionBar.test.tsx +91 -0
  70. package/src/components/ActionBar/ActionBar.tsx +45 -0
  71. package/src/components/ActionBar/ActionBarAction.tsx +75 -0
  72. package/src/components/ActionBar/__snapshots__/ActionBar.test.tsx.snap +122 -0
  73. package/src/components/ActionBar/index.ts +1 -0
  74. package/src/components/AppBar.tsx +10 -0
  75. package/src/components/Author/Author.test.tsx +75 -0
  76. package/src/components/Author/Author.tsx +47 -0
  77. package/src/components/Author/__snapshots__/Author.test.tsx.snap +353 -0
  78. package/src/components/Author/index.ts +1 -0
  79. package/src/components/Author/styles.ts +23 -0
  80. package/src/components/AutoComplete/AutoComplete.tsx +179 -0
  81. package/src/components/AutoComplete/AutoCompleteV2.tsx +296 -0
  82. package/src/components/AutoComplete/index.ts +1 -0
  83. package/src/components/AutoComplete/styles.tsx +58 -0
  84. package/src/components/AutoComplete/useAutoComplete.tsx +61 -0
  85. package/src/components/Avatar.tsx +3 -0
  86. package/src/components/Box.tsx +8 -0
  87. package/src/components/Button.tsx +10 -0
  88. package/src/components/Card.tsx +10 -0
  89. package/src/components/CardActions.tsx +13 -0
  90. package/src/components/CardContent.tsx +10 -0
  91. package/src/components/Chip.tsx +10 -0
  92. package/src/components/CircularProgress.tsx +15 -0
  93. package/src/components/CopyToClipBoard.tsx +45 -0
  94. package/src/components/Dialog.tsx +10 -0
  95. package/src/components/DialogActions.tsx +16 -0
  96. package/src/components/DialogContent.tsx +16 -0
  97. package/src/components/DialogTitle.tsx +10 -0
  98. package/src/components/Divider.tsx +10 -0
  99. package/src/components/FloatingActionButton.tsx +12 -0
  100. package/src/components/FormControl.tsx +10 -0
  101. package/src/components/FormHelperText.tsx +16 -0
  102. package/src/components/Grid.tsx +10 -0
  103. package/src/components/Heading.tsx +15 -0
  104. package/src/components/IconButton.tsx +10 -0
  105. package/src/components/Icons/.eslintrc +5 -0
  106. package/src/components/Icons/Earth.tsx +36 -0
  107. package/src/components/Icons/FileBinary.tsx +20 -0
  108. package/src/components/Icons/Law.tsx +20 -0
  109. package/src/components/Icons/License.tsx +18 -0
  110. package/src/components/Icons/Time.tsx +19 -0
  111. package/src/components/Icons/Version.tsx +20 -0
  112. package/src/components/Icons/index.ts +5 -0
  113. package/src/components/Input.tsx +10 -0
  114. package/src/components/InputAdornment/InputAdornment.tsx +16 -0
  115. package/src/components/InputAdornment/index.ts +1 -0
  116. package/src/components/InputLabel.tsx +10 -0
  117. package/src/components/Label/Label.test.tsx +15 -0
  118. package/src/components/Label/Label.tsx +35 -0
  119. package/src/components/Label/__snapshots__/Label.test.tsx.snap +14 -0
  120. package/src/components/Label/index.ts +1 -0
  121. package/src/components/Link.tsx +39 -0
  122. package/src/components/List.tsx +10 -0
  123. package/src/components/ListItem.tsx +23 -0
  124. package/src/components/ListItemText.tsx +16 -0
  125. package/src/components/Loading/Loading.test.tsx +12 -0
  126. package/src/components/Loading/Loading.tsx +17 -0
  127. package/src/components/Loading/Spinner/Spinner.test.tsx +14 -0
  128. package/src/components/Loading/Spinner/Spinner.tsx +35 -0
  129. package/src/components/Loading/Spinner/__snapshots__/Spinner.test.tsx.snap +148 -0
  130. package/src/components/Loading/Spinner/index.tsx +1 -0
  131. package/src/components/Loading/__snapshots__/Loading.test.tsx.snap +86 -0
  132. package/src/components/Loading/index.ts +1 -0
  133. package/src/components/Loading/styles.ts +17 -0
  134. package/src/components/Logo/Logo.test.tsx +12 -0
  135. package/src/components/Logo/Logo.tsx +55 -0
  136. package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +19 -0
  137. package/src/components/Logo/img/logo-black-and-white.svg +1 -0
  138. package/src/components/Logo/img/logo.svg +1 -0
  139. package/src/components/Logo/index.ts +1 -0
  140. package/src/components/Menu.tsx +10 -0
  141. package/src/components/MenuItem.tsx +25 -0
  142. package/src/components/NotFound/NotFound.tsx +52 -0
  143. package/src/components/NotFound/Notfound.test.tsx +37 -0
  144. package/src/components/NotFound/__snapshots__/Notfound.test.tsx.snap +44 -0
  145. package/src/components/NotFound/img/package.svg +1 -0
  146. package/src/components/NotFound/index.ts +1 -0
  147. package/src/components/NotFound/styles.ts +40 -0
  148. package/src/components/Paper.tsx +10 -0
  149. package/src/components/SnackbarContent.tsx +15 -0
  150. package/src/components/SvgIcon.tsx +38 -0
  151. package/src/components/Tab.tsx +10 -0
  152. package/src/components/Tabs.tsx +14 -0
  153. package/src/components/Text/Text.tsx +17 -0
  154. package/src/components/Text/TextConfig.ts +7 -0
  155. package/src/components/Text/index.ts +2 -0
  156. package/src/components/TextField/TextField.test.tsx +16 -0
  157. package/src/components/TextField/TextField.tsx +23 -0
  158. package/src/components/TextField/__snapshots__/TextField.test.tsx.snap +19 -0
  159. package/src/components/TextField/index.ts +1 -0
  160. package/src/components/Toolbar.tsx +10 -0
  161. package/src/components/Tooltip.tsx +25 -0
  162. package/src/design-tokens/ResetStyles.tsx +44 -0
  163. package/src/design-tokens/StyleBaseline.tsx +14 -0
  164. package/src/design-tokens/ThemeContext.ts +13 -0
  165. package/src/design-tokens/ThemeProvider.tsx +44 -0
  166. package/src/design-tokens/emotion.ts +5 -0
  167. package/src/design-tokens/load-dayjs-locale.ts +98 -0
  168. package/src/design-tokens/theme.ts +159 -0
  169. package/src/design-tokens/useLocalStorage.ts +40 -0
  170. package/src/design-tokens/useOnClickOutside.ts +28 -0
  171. package/src/design-tokens/useTheme.ts +7 -0
  172. package/src/i18n/ABOUT_TRANSLATIONS.md +13 -0
  173. package/src/i18n/config.ts +52 -0
  174. package/src/i18n/crowdin/ui.json +170 -0
  175. package/src/i18n/deprecated_translations_dont_use/cs-CZ.json +168 -0
  176. package/src/i18n/deprecated_translations_dont_use/de-DE.json +168 -0
  177. package/src/i18n/deprecated_translations_dont_use/en-US.json +170 -0
  178. package/src/i18n/deprecated_translations_dont_use/es-ES.json +168 -0
  179. package/src/i18n/deprecated_translations_dont_use/fr-FR.json +168 -0
  180. package/src/i18n/deprecated_translations_dont_use/ja-JP.json +168 -0
  181. package/src/i18n/deprecated_translations_dont_use/km-KH.json +168 -0
  182. package/src/i18n/deprecated_translations_dont_use/pt-BR.json +168 -0
  183. package/src/i18n/deprecated_translations_dont_use/ru-RU.json +168 -0
  184. package/src/i18n/deprecated_translations_dont_use/tr-TR.json +168 -0
  185. package/src/i18n/deprecated_translations_dont_use/uk-UA.json +168 -0
  186. package/src/i18n/deprecated_translations_dont_use/zh-CN.json +168 -0
  187. package/src/i18n/deprecated_translations_dont_use/zh-TW.json +165 -0
  188. package/src/i18n/enabledLanguages.ts +35 -0
  189. package/src/index.tsx +36 -0
  190. package/src/lib/constants.ts +9 -0
  191. package/src/pages/Version/DetailContainer/Dependencies/Dependencies.test.tsx +93 -0
  192. package/src/pages/Version/DetailContainer/Dependencies/Dependencies.tsx +100 -0
  193. package/src/pages/Version/DetailContainer/Dependencies/index.ts +1 -0
  194. package/src/pages/Version/DetailContainer/Dependencies/styles.ts +26 -0
  195. package/src/pages/Version/DetailContainer/Dependencies/types.ts +7 -0
  196. package/src/pages/Version/DetailContainer/Deprecated/Deprecated.test.tsx +34 -0
  197. package/src/pages/Version/DetailContainer/Deprecated/Deprecated.tsx +31 -0
  198. package/src/pages/Version/DetailContainer/Deprecated/index.ts +1 -0
  199. package/src/pages/Version/DetailContainer/DetailContainer.test.tsx +13 -0
  200. package/src/pages/Version/DetailContainer/DetailContainer.tsx +37 -0
  201. package/src/pages/Version/DetailContainer/DetailContainerContent.tsx +41 -0
  202. package/src/pages/Version/DetailContainer/DetailContainerContentReadme.tsx +19 -0
  203. package/src/pages/Version/DetailContainer/DetailContainerTabs.tsx +36 -0
  204. package/src/pages/Version/DetailContainer/NoItems/NoItems.tsx +16 -0
  205. package/src/pages/Version/DetailContainer/NoItems/Noitems.test.tsx +16 -0
  206. package/src/pages/Version/DetailContainer/NoItems/__snapshots__/Noitems.test.tsx.snap +9 -0
  207. package/src/pages/Version/DetailContainer/NoItems/index.ts +1 -0
  208. package/src/pages/Version/DetailContainer/Readme/Readme.spec.tsx +19 -0
  209. package/src/pages/Version/DetailContainer/Readme/Readme.tsx +22 -0
  210. package/src/pages/Version/DetailContainer/Readme/__snapshots__/Readme.spec.tsx.snap +94 -0
  211. package/src/pages/Version/DetailContainer/Readme/index.ts +1 -0
  212. package/src/pages/Version/DetailContainer/Readme/types.ts +3 -0
  213. package/src/pages/Version/DetailContainer/UpLinks/UpLinks.test.tsx +58 -0
  214. package/src/pages/Version/DetailContainer/UpLinks/UpLinks.tsx +45 -0
  215. package/src/pages/Version/DetailContainer/UpLinks/__snapshots__/UpLinks.test.tsx.snap +247 -0
  216. package/src/pages/Version/DetailContainer/UpLinks/index.ts +1 -0
  217. package/src/pages/Version/DetailContainer/UpLinks/styles.ts +24 -0
  218. package/src/pages/Version/DetailContainer/Versions/Versions.test.tsx +60 -0
  219. package/src/pages/Version/DetailContainer/Versions/Versions.tsx +41 -0
  220. package/src/pages/Version/DetailContainer/Versions/VersionsHistoryList.tsx +40 -0
  221. package/src/pages/Version/DetailContainer/Versions/VersionsTagList.tsx +28 -0
  222. package/src/pages/Version/DetailContainer/Versions/__partials__/data.json +5984 -0
  223. package/src/pages/Version/DetailContainer/Versions/__snapshots__/Versions.test.tsx.snap +3 -0
  224. package/src/pages/Version/DetailContainer/Versions/index.ts +1 -0
  225. package/src/pages/Version/DetailContainer/Versions/styles.ts +30 -0
  226. package/src/pages/Version/DetailContainer/__snapshots__/DetailContainer.test.tsx.snap +103 -0
  227. package/src/pages/Version/DetailContainer/index.ts +1 -0
  228. package/src/pages/Version/DetailSidebar/DetailSidebar.tsx +55 -0
  229. package/src/pages/Version/DetailSidebar/DetailSidebarFundButton.test.tsx +111 -0
  230. package/src/pages/Version/DetailSidebar/DetailSidebarFundButton.tsx +53 -0
  231. package/src/pages/Version/DetailSidebar/DetailSidebarTitle.tsx +40 -0
  232. package/src/pages/Version/DetailSidebar/Developers/Developers.test.tsx +117 -0
  233. package/src/pages/Version/DetailSidebar/Developers/Developers.tsx +90 -0
  234. package/src/pages/Version/DetailSidebar/Developers/DevelopersTitle.tsx +32 -0
  235. package/src/pages/Version/DetailSidebar/Developers/__snapshots__/Developers.test.tsx.snap +380 -0
  236. package/src/pages/Version/DetailSidebar/Developers/get-unique-developer-values.ts +16 -0
  237. package/src/pages/Version/DetailSidebar/Developers/index.ts +1 -0
  238. package/src/pages/Version/DetailSidebar/Developers/styles.ts +31 -0
  239. package/src/pages/Version/DetailSidebar/Dist/Dist.test.tsx +78 -0
  240. package/src/pages/Version/DetailSidebar/Dist/Dist.tsx +49 -0
  241. package/src/pages/Version/DetailSidebar/Dist/__snapshots__/Dist.test.tsx.snap +602 -0
  242. package/src/pages/Version/DetailSidebar/Dist/index.ts +1 -0
  243. package/src/pages/Version/DetailSidebar/Dist/styles.ts +27 -0
  244. package/src/pages/Version/DetailSidebar/Engines/Engines.test.tsx +71 -0
  245. package/src/pages/Version/DetailSidebar/Engines/Engines.tsx +58 -0
  246. package/src/pages/Version/DetailSidebar/Engines/img/node.png +0 -0
  247. package/src/pages/Version/DetailSidebar/Engines/index.ts +1 -0
  248. package/src/pages/Version/DetailSidebar/Engines/styles.ts +14 -0
  249. package/src/pages/Version/DetailSidebar/Install/Install.test.tsx +64 -0
  250. package/src/pages/Version/DetailSidebar/Install/Install.tsx +52 -0
  251. package/src/pages/Version/DetailSidebar/Install/InstallListItem.tsx +97 -0
  252. package/src/pages/Version/DetailSidebar/Install/__partials__/data.json +5984 -0
  253. package/src/pages/Version/DetailSidebar/Install/img/npm.svg +15 -0
  254. package/src/pages/Version/DetailSidebar/Install/img/pnpm.svg +1 -0
  255. package/src/pages/Version/DetailSidebar/Install/img/yarn.svg +1 -0
  256. package/src/pages/Version/DetailSidebar/Install/index.ts +1 -0
  257. package/src/pages/Version/DetailSidebar/Repository/Repository.test.tsx +78 -0
  258. package/src/pages/Version/DetailSidebar/Repository/Repository.tsx +93 -0
  259. package/src/pages/Version/DetailSidebar/Repository/__partials__/data.json +5984 -0
  260. package/src/pages/Version/DetailSidebar/Repository/__snapshots__/Repository.test.tsx.snap +3 -0
  261. package/src/pages/Version/DetailSidebar/Repository/img/git.png +0 -0
  262. package/src/pages/Version/DetailSidebar/Repository/index.ts +1 -0
  263. package/src/pages/Version/DetailSidebar/index.ts +1 -0
  264. package/src/pages/Version/Version.test.tsx +68 -0
  265. package/src/pages/Version/Version.tsx +41 -0
  266. package/src/pages/Version/VersionContextProvider.tsx +43 -0
  267. package/src/pages/Version/VersionLayout.tsx +20 -0
  268. package/src/pages/Version/__partials__/data.json +5984 -0
  269. package/src/pages/Version/context.ts +10 -0
  270. package/src/pages/Version/get-route-package-name.ts +9 -0
  271. package/src/pages/Version/index.ts +4 -0
  272. package/src/pages/Version/version-config.ts +19 -0
  273. package/src/pages/home/Home.tsx +25 -0
  274. package/src/pages/home/PackageList/Help/Help.test.tsx +12 -0
  275. package/src/pages/home/PackageList/Help/Help.tsx +56 -0
  276. package/src/pages/home/PackageList/Help/__snapshots__/Help.test.tsx.snap +159 -0
  277. package/src/pages/home/PackageList/Help/index.ts +1 -0
  278. package/src/pages/home/PackageList/Help/styles.ts +13 -0
  279. package/src/pages/home/PackageList/Package/Package.test.tsx +56 -0
  280. package/src/pages/home/PackageList/Package/Package.tsx +253 -0
  281. package/src/pages/home/PackageList/Package/Tag/Tag.test.tsx +16 -0
  282. package/src/pages/home/PackageList/Package/Tag/Tag.tsx +11 -0
  283. package/src/pages/home/PackageList/Package/Tag/__snapshots__/Tag.test.tsx.snap +21 -0
  284. package/src/pages/home/PackageList/Package/Tag/index.ts +1 -0
  285. package/src/pages/home/PackageList/Package/Tag/styles.ts +11 -0
  286. package/src/pages/home/PackageList/Package/index.ts +1 -0
  287. package/src/pages/home/PackageList/Package/styles.ts +112 -0
  288. package/src/pages/home/PackageList/PackageList.tsx +81 -0
  289. package/src/pages/home/PackageList/Packagelist.test.tsx +60 -0
  290. package/src/pages/home/PackageList/index.ts +1 -0
  291. package/src/pages/home/index.ts +1 -0
  292. package/src/providers/API/api.test.ts +136 -0
  293. package/src/providers/API/api.ts +73 -0
  294. package/src/providers/API/storage.ts +12 -0
  295. package/src/providers/config/AppConfigurationProvider.tsx +57 -0
  296. package/src/providers/config/index.ts +1 -0
  297. package/src/store/index.ts +1 -0
  298. package/src/store/models/configuration.ts +42 -0
  299. package/src/store/models/download.ts +31 -0
  300. package/src/store/models/index.ts +17 -0
  301. package/src/store/models/login.ts +90 -0
  302. package/src/store/models/manifest.ts +91 -0
  303. package/src/store/models/packages.ts +36 -0
  304. package/src/store/models/search.ts +81 -0
  305. package/src/store/store.ts +15 -0
  306. package/src/template/favicon.ico +0 -0
  307. package/src/template/index.html +21 -0
  308. package/src/utils/.eslintrc +5 -0
  309. package/src/utils/cli-utils.test.ts +66 -0
  310. package/src/utils/cli-utils.ts +38 -0
  311. package/src/utils/colors.ts +1 -0
  312. package/src/utils/constants.ts +5 -0
  313. package/src/utils/file-size.ts +13 -0
  314. package/src/utils/i18nForTests.ts +25 -0
  315. package/src/utils/login.test.ts +71 -0
  316. package/src/utils/login.ts +44 -0
  317. package/src/utils/package.test.ts +101 -0
  318. package/src/utils/package.ts +105 -0
  319. package/src/utils/sec-utils.ts +15 -0
  320. package/src/utils/storage.ts +12 -0
  321. package/src/utils/test-react-testing-library.tsx +38 -0
  322. package/src/utils/url.test.ts +28 -0
  323. package/src/utils/url.ts +58 -0
  324. package/src/utils/windows.ts +3 -0
  325. package/static/favicon.ico +0 -0
  326. package/static/index.html +21 -0
  327. package/static/main.c57129036f278d0c7acf.js +2 -0
  328. package/static/main.c57129036f278d0c7acf.js.LICENSE.txt +1456 -0
  329. package/static/manifest.json +5 -17
  330. package/static/runtime.c57129036f278d0c7acf.js +2 -0
  331. package/static/{runtime.f6e570dfe38870a45bf5.js.LICENSE.txt → runtime.c57129036f278d0c7acf.js.LICENSE.txt} +2 -2
  332. package/static/vendors.c57129036f278d0c7acf.js +2 -0
  333. package/static/vendors.c57129036f278d0c7acf.js.LICENSE.txt +2932 -0
  334. package/tools/.eslintrc +14 -0
  335. package/tools/_verdaccio.config.yaml +59 -0
  336. package/tools/dev.server.js +48 -0
  337. package/tools/getPackageJson.js +25 -0
  338. package/tools/verdaccio.js +31 -0
  339. package/tools/webpack.config.js +82 -0
  340. package/tools/webpack.dev.config.babel.js +60 -0
  341. package/tools/webpack.prod.config.babel.js +81 -0
  342. package/tsconfig.build.json +24 -0
  343. package/tsconfig.json +27 -0
  344. package/types/custom.d.ts +9 -0
  345. package/types/files.d.ts +9 -0
  346. package/types/index.ts +12 -0
  347. package/types/jest-dom.d.ts +1 -0
  348. package/types/packageMeta.ts +82 -0
  349. package/static/238.f6e570dfe38870a45bf5.js +0 -2
  350. package/static/238.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  351. package/static/718.f6e570dfe38870a45bf5.js +0 -2
  352. package/static/718.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  353. package/static/73.f6e570dfe38870a45bf5.js +0 -2
  354. package/static/73.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  355. package/static/Dependencies.f6e570dfe38870a45bf5.js +0 -2
  356. package/static/Dependencies.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  357. package/static/Dist.f6e570dfe38870a45bf5.js +0 -2
  358. package/static/Dist.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  359. package/static/Engines.f6e570dfe38870a45bf5.js +0 -2
  360. package/static/Engines.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  361. package/static/Home.f6e570dfe38870a45bf5.js +0 -2
  362. package/static/Home.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  363. package/static/Install.f6e570dfe38870a45bf5.js +0 -2
  364. package/static/Install.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  365. package/static/NotFound.f6e570dfe38870a45bf5.js +0 -2
  366. package/static/NotFound.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  367. package/static/Provider.f6e570dfe38870a45bf5.js +0 -2
  368. package/static/Provider.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  369. package/static/Repository.f6e570dfe38870a45bf5.js +0 -2
  370. package/static/Repository.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  371. package/static/UpLinks.f6e570dfe38870a45bf5.js +0 -2
  372. package/static/UpLinks.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  373. package/static/Version.f6e570dfe38870a45bf5.js +0 -2
  374. package/static/Version.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  375. package/static/Versions.f6e570dfe38870a45bf5.js +0 -2
  376. package/static/Versions.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  377. package/static/main.f6e570dfe38870a45bf5.js +0 -2
  378. package/static/main.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
  379. package/static/runtime.f6e570dfe38870a45bf5.js +0 -2
  380. package/static/vendors.f6e570dfe38870a45bf5.js +0 -2
  381. package/static/vendors.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -98
@@ -0,0 +1,168 @@
1
+ {
2
+ "copy-to-clipboard": "复制到粘贴板",
3
+ "author-anonymous": "匿名",
4
+ "author-unknown": "未知",
5
+ "action-bar-action": {
6
+ "visit-home-page": "访问主页",
7
+ "open-an-issue": "提交问题",
8
+ "download-tarball": "下载压缩包"
9
+ },
10
+ "dialog": {
11
+ "registry-info": {
12
+ "title": "注册信息"
13
+ }
14
+ },
15
+ "header": {
16
+ "documentation": "文档",
17
+ "registry-info": "登记信息",
18
+ "greetings": "您好 "
19
+ },
20
+ "search": {
21
+ "packages": "查找Packages"
22
+ },
23
+ "autoComplete": {
24
+ "loading": "加载中...",
25
+ "no-results-found": "没有找到结果",
26
+ "clear": "清除",
27
+ "expand": "展开",
28
+ "collapse": "收回"
29
+ },
30
+ "tab": {
31
+ "uplinks": "Uplinks",
32
+ "versions": "版本",
33
+ "dependencies": "依赖",
34
+ "readme": "Readme"
35
+ },
36
+ "uplinks": {
37
+ "title": "Uplinks",
38
+ "no-items": "{{name}} 没有 uplinks."
39
+ },
40
+ "versions": {
41
+ "current-tags": "当前标签",
42
+ "version-history": "历史版本",
43
+ "not-available": "不可用"
44
+ },
45
+ "package": {
46
+ "published-on": "发布于 {{time}} •",
47
+ "version": "v{{version}}",
48
+ "visit-home-page": "访问主页",
49
+ "homepage": "主页",
50
+ "open-an-issue": "提交问题",
51
+ "bugs": "Bugs",
52
+ "download": "下载 {{what}}",
53
+ "the-tar-file": "tar 文件",
54
+ "tarball": "压缩包"
55
+ },
56
+ "dependencies": {
57
+ "has-no-dependencies": "{{package}} 没有依赖包.",
58
+ "dependency-block": "{{package}}@{{version}}"
59
+ },
60
+ "form": {
61
+ "username": "用户名",
62
+ "password": "密码"
63
+ },
64
+ "form-placeholder": {
65
+ "username": "您的用户名",
66
+ "password": "您的密码"
67
+ },
68
+ "form-validation": {
69
+ "required-field": "必填项",
70
+ "required-min-length": "长度不能小于 {{length}}",
71
+ "unable-to-sign-in": "登录失败",
72
+ "username-or-password-cant-be-empty": "用户名或密码不能为空!"
73
+ },
74
+ "help": {
75
+ "title": "还没有发布任何 NPM 包.",
76
+ "sub-title": "发布第一个 NPM 包:",
77
+ "first-step": "1. 登录",
78
+ "first-step-command-line": "npm adduser --registry {{registryUrl}}",
79
+ "second-step": "2. 发布",
80
+ "second-step-command-line": "npm publish --registry {{registryUrl}}",
81
+ "third-step": "3. 刷新当前页面."
82
+ },
83
+ "sidebar": {
84
+ "detail": {
85
+ "latest-version": "最新版本 v{{version}}",
86
+ "version": "v{{version}}"
87
+ },
88
+ "installation": {
89
+ "title": "安装",
90
+ "install-using-yarn": "使用 yarn 安装",
91
+ "install-using-yarn-command": "yarn add {{packageName}}",
92
+ "install-using-npm": "使用 npm 安装",
93
+ "install-using-npm-command": "npm install {{packageName}}",
94
+ "install-using-pnpm": "使用 pnpm 安装",
95
+ "install-using-pnpm-command": "pnpm install {{packageName}}"
96
+ },
97
+ "repository": {
98
+ "title": "仓库"
99
+ },
100
+ "author": {
101
+ "title": "作者"
102
+ },
103
+ "distribution": {
104
+ "title": "发布信息",
105
+ "license": "许可",
106
+ "size": "大小",
107
+ "file-count": "文件数量"
108
+ },
109
+ "maintainers": {
110
+ "title": "维护人"
111
+ },
112
+ "contributors": {
113
+ "title": "贡献者"
114
+ },
115
+ "engines": {
116
+ "npm-version": "NPM 版本",
117
+ "node-js": "NODE JS"
118
+ }
119
+ },
120
+ "footer": {
121
+ "powered-by": "Powered by",
122
+ "made-with-love-on": "Made with <0>♥</0> on"
123
+ },
124
+ "button": {
125
+ "close": "关闭",
126
+ "cancel": "取消",
127
+ "login": "登录",
128
+ "logout": "注销",
129
+ "go-to-the-home-page": "跳转到主页",
130
+ "learn-more": "了解更多",
131
+ "fund-this-package": "<0>捐助</0>这个 package"
132
+ },
133
+ "error": {
134
+ "unspecific": "发生了一些错误",
135
+ "404": {
136
+ "page-not-found": "404 - 页面不存在",
137
+ "sorry-we-could-not-find-it": "对不起, 我们没有找到..."
138
+ },
139
+ "app-context-not-correct-used": "app context 没有被正确使用",
140
+ "theme-context-not-correct-used": "theme context 没有被正确使用",
141
+ "package-meta-is-required-at-detail-context": "packageMeta 在 DetailContext 上是必需的"
142
+ },
143
+ "lng": {
144
+ "english": "英语",
145
+ "czech": "捷克語",
146
+ "japanese": "日语",
147
+ "portuguese": "葡萄牙语",
148
+ "spanish": "西班牙语",
149
+ "german": "德语",
150
+ "chinese": "中文",
151
+ "chineseTraditional": "正体中文",
152
+ "french": "法语",
153
+ "russian": "俄语",
154
+ "turkish": "土耳其",
155
+ "ukraine": "乌克兰",
156
+ "khmer": "高棉语"
157
+ },
158
+ "flag": {
159
+ "austria": "奥地利",
160
+ "brazil": "巴西",
161
+ "spain": "西班牙",
162
+ "nicaragua": "尼加拉瓜",
163
+ "india": "印度",
164
+ "china": "中国",
165
+ "germany": "德国",
166
+ "taiwan": "台湾"
167
+ }
168
+ }
@@ -0,0 +1,165 @@
1
+ {
2
+ "copy-to-clipboard": "複製到剪貼簿",
3
+ "author-anonymous": "匿名",
4
+ "author-unknown": "未知",
5
+ "action-bar-action": {
6
+ "visit-home-page": "瀏覽首頁",
7
+ "open-an-issue": "提交問題",
8
+ "download-tarball": "下載 tarball"
9
+ },
10
+ "dialog": {
11
+ "registry-info": {
12
+ "title": "註冊資訊"
13
+ }
14
+ },
15
+ "header": {
16
+ "documentation": "文件",
17
+ "registry-info": "註冊資訊",
18
+ "greetings": "你好 "
19
+ },
20
+ "search": {
21
+ "packages": "搜尋套件"
22
+ },
23
+ "auto-complete": {
24
+ "loading": "載入中...",
25
+ "no-results-found": "無結果"
26
+ },
27
+ "tab": {
28
+ "uplinks": "Uplinks",
29
+ "versions": "版本",
30
+ "dependencies": "相依",
31
+ "readme": "Readme"
32
+ },
33
+ "uplinks": {
34
+ "title": "Uplinks",
35
+ "no-items": "{{name}} has no uplinks."
36
+ },
37
+ "versions": {
38
+ "current-tags": "當前標籤",
39
+ "version-history": "歷史版本",
40
+ "not-available": "無法取得"
41
+ },
42
+ "package": {
43
+ "published-on": "發布於 {{time}} •",
44
+ "version": "v{{version}}",
45
+ "visit-home-page": "瀏覽首頁",
46
+ "homepage": "首頁",
47
+ "open-an-issue": "提交問題",
48
+ "bugs": "Bugs",
49
+ "download": "下载 {{what}}",
50
+ "the-tar-file": "tar 檔案",
51
+ "tarball": "Tarball"
52
+ },
53
+ "dependencies": {
54
+ "has-no-dependencies": "{{package}} 沒有相依套件.",
55
+ "dependency-block": "{{package}}@{{version}}"
56
+ },
57
+ "form": {
58
+ "username": "使用者名稱",
59
+ "password": "密碼"
60
+ },
61
+ "form-placeholder": {
62
+ "username": "你的使用者名稱",
63
+ "password": "你的密碼"
64
+ },
65
+ "form-validation": {
66
+ "required-field": "必填欄位",
67
+ "required-min-length": "長度不可短於 {{length}}",
68
+ "unable-to-sign-in": "無法登入",
69
+ "username-or-password-cant-be-empty": "使用者名稱或密碼不可空白!"
70
+ },
71
+ "help": {
72
+ "title": "尚未發布任何 NPM 套件.",
73
+ "sub-title": "發布第一個 NPM 套件:",
74
+ "first-step": "1. 登入",
75
+ "first-step-command-line": "npm adduser --registry {{registryUrl}}",
76
+ "second-step": "2. 發布",
77
+ "second-step-command-line": "npm publish --registry {{registryUrl}}",
78
+ "third-step": "3. 重新整理頁面。"
79
+ },
80
+ "sidebar": {
81
+ "detail": {
82
+ "latest-version": "最新版本 v{{version}}",
83
+ "version": "v{{version}}"
84
+ },
85
+ "installation": {
86
+ "title": "安装",
87
+ "install-using-yarn": "使用 yarn 安装",
88
+ "install-using-yarn-command": "yarn add {{packageName}}",
89
+ "install-using-npm": "使用 npm 安装",
90
+ "install-using-npm-command": "npm install {{packageName}}",
91
+ "install-using-pnpm": "使用 pnpm 安装",
92
+ "install-using-pnpm-command": "pnpm install {{packageName}}"
93
+ },
94
+ "repository": {
95
+ "title": "儲存庫"
96
+ },
97
+ "author": {
98
+ "title": "作者"
99
+ },
100
+ "distribution": {
101
+ "title": "發布資訊",
102
+ "license": "許可",
103
+ "size": "大小",
104
+ "file-count": "檔案數量"
105
+ },
106
+ "maintainers": {
107
+ "title": "維護人員"
108
+ },
109
+ "contributors": {
110
+ "title": "貢獻人員"
111
+ },
112
+ "engines": {
113
+ "npm-version": "NPM 版本",
114
+ "node-js": "NODE JS"
115
+ }
116
+ },
117
+ "footer": {
118
+ "powered-by": "Powered by",
119
+ "made-with-love-on": "Made with <0>♥</0> on"
120
+ },
121
+ "button": {
122
+ "close": "關閉",
123
+ "cancel": "取消",
124
+ "login": "登入",
125
+ "logout": "登出",
126
+ "go-to-the-home-page": "前往首頁",
127
+ "learn-more": "了解更多",
128
+ "fund-this-package": "<0>Fund</0> this package"
129
+ },
130
+ "error": {
131
+ "unspecific": "發生錯誤。",
132
+ "404": {
133
+ "page-not-found": "404 - 頁面不存在",
134
+ "sorry-we-could-not-find-it": "不好意思, 找不到..."
135
+ },
136
+ "app-context-not-correct-used": "app context 没有被正確使用",
137
+ "theme-context-not-correct-used": "theme context 没有被正確使用",
138
+ "package-meta-is-required-at-detail-context": "packageMeta is required at DetailContext"
139
+ },
140
+ "lng": {
141
+ "english": "英文",
142
+ "czech": "捷克文",
143
+ "japanese": "日文",
144
+ "portuguese": "葡萄牙文",
145
+ "spanish": "西班牙文",
146
+ "german": "德文",
147
+ "chinese": "簡體中文",
148
+ "chineseTraditional": "正體中文",
149
+ "french": "法文",
150
+ "russian": "俄文",
151
+ "turkish": "土耳其",
152
+ "ukraine": "烏克蘭文",
153
+ "khmer": "高棉文"
154
+ },
155
+ "flag": {
156
+ "austria": "奧地利",
157
+ "brazil": "巴西",
158
+ "spain": "西班牙",
159
+ "nicaragua": "尼加拉瓜",
160
+ "india": "印度",
161
+ "china": "中國 ",
162
+ "germany": "德國",
163
+ "taiwan": "台灣"
164
+ }
165
+ }
@@ -0,0 +1,35 @@
1
+ import Flags from 'country-flag-icons/react/3x2';
2
+ import React from 'react';
3
+
4
+ export const DEFAULT_LANGUAGE = 'en-US';
5
+
6
+ export type LanguageConfiguration = {
7
+ lng: string;
8
+ menuKey: string;
9
+ icon: React.ReactElement;
10
+ };
11
+
12
+ export const listLanguages: LanguageConfiguration[] = [
13
+ { lng: DEFAULT_LANGUAGE, icon: Flags.US, menuKey: 'lng.english' },
14
+ { lng: 'cs-CZ', icon: Flags.CZ, menuKey: 'lng.czech' },
15
+ { lng: 'pt-BR', icon: Flags.BR, menuKey: 'lng.portuguese' },
16
+ { lng: 'es-ES', icon: Flags.ES, menuKey: 'lng.spanish' },
17
+ { lng: 'de-DE', icon: Flags.DE, menuKey: 'lng.german' },
18
+ { lng: 'fr-FR', icon: Flags.FR, menuKey: 'lng.french' },
19
+ { lng: 'zh-CN', icon: Flags.CN, menuKey: 'lng.chinese' },
20
+ { lng: 'ja-JP', icon: Flags.JP, menuKey: 'lng.japanese' },
21
+ { lng: 'ru-RU', icon: Flags.RU, menuKey: 'lng.russian' },
22
+ { lng: 'tr-TR', icon: Flags.TR, menuKey: 'lng.turkish' },
23
+ { lng: 'uk-UA', icon: Flags.UA, menuKey: 'lng.ukraine' },
24
+ { lng: 'km-KH', icon: Flags.KH, menuKey: 'lng.khme' },
25
+ { lng: 'zh-TW', icon: Flags.TW, menuKey: 'lng.chineseTraditional' },
26
+ ];
27
+
28
+ const languages = listLanguages.reduce((acc, item: LanguageConfiguration) => {
29
+ acc.push(item.lng);
30
+ return acc;
31
+ }, [] as string[]);
32
+
33
+ export const listLanguagesAsString = languages;
34
+
35
+ export type Language = keyof typeof listLanguagesAsString;
package/src/index.tsx ADDED
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom';
3
+ import { AppContainer } from 'react-hot-loader';
4
+ import { Provider } from 'react-redux';
5
+
6
+ import AppConfigurationContext from 'verdaccio-ui/providers/config';
7
+
8
+ import App from './App';
9
+ import StyleBaseline from './design-tokens/StyleBaseline';
10
+ import ThemeProvider from './design-tokens/ThemeProvider';
11
+ import { store } from './store';
12
+
13
+ const rootNode = document.getElementById('root');
14
+ const renderApp = (Component: React.ElementType): void => {
15
+ ReactDOM.render(
16
+ <Provider store={store}>
17
+ <AppContainer>
18
+ <AppConfigurationContext>
19
+ <ThemeProvider>
20
+ <StyleBaseline />
21
+ <Component />
22
+ </ThemeProvider>
23
+ </AppConfigurationContext>
24
+ </AppContainer>
25
+ </Provider>,
26
+ rootNode
27
+ );
28
+ };
29
+
30
+ renderApp(App);
31
+
32
+ if (module.hot) {
33
+ module.hot.accept('./App', () => {
34
+ renderApp(App);
35
+ });
36
+ }
@@ -0,0 +1,9 @@
1
+ export const DIST_TAGS = 'dist-tags';
2
+
3
+ export const HEADERS = {
4
+ JSON: 'application/json',
5
+ };
6
+
7
+ export const API_ERROR = {
8
+ BAD_USERNAME_PASSWORD: 'bad username/password, access denied',
9
+ };
@@ -0,0 +1,93 @@
1
+ import React from 'react';
2
+ import { HashRouter } from 'react-router-dom';
3
+
4
+ import { render } from 'verdaccio-ui/utils/test-react-testing-library';
5
+
6
+ import { DetailContextProvider } from '../../context';
7
+
8
+ import Dependencies from './Dependencies';
9
+
10
+ describe('<Dependencies /> component', () => {
11
+ test('Renders a message when there are no dependencies', () => {
12
+ // Given
13
+ const packageMeta = {
14
+ latest: {
15
+ name: 'verdaccio',
16
+ version: '4.0.0',
17
+ author: {
18
+ name: 'verdaccio user',
19
+ email: 'verdaccio.user@verdaccio.org',
20
+ url: '',
21
+ avatar: 'https://www.gravatar.com/avatar/000000',
22
+ },
23
+ dist: { fileCount: 0, unpackedSize: 0 },
24
+ dependencies: {},
25
+ devDependencies: {},
26
+ peerDependencies: {},
27
+ },
28
+ _uplinks: {},
29
+ };
30
+
31
+ // When
32
+ const { getByText } = render(
33
+ <DetailContextProvider value={{ packageMeta }}>
34
+ <Dependencies />
35
+ </DetailContextProvider>
36
+ );
37
+
38
+ // Then
39
+ expect(getByText('verdaccio has no dependencies.')).toBeDefined();
40
+ });
41
+
42
+ test('Renders a link to each dependency', () => {
43
+ // Given
44
+ const packageMeta = {
45
+ latest: {
46
+ name: 'verdaccio',
47
+ version: '4.0.0',
48
+ author: {
49
+ name: 'verdaccio user',
50
+ email: 'verdaccio.user@verdaccio.org',
51
+ url: '',
52
+ avatar: 'https://www.gravatar.com/avatar/000000',
53
+ },
54
+ dist: { fileCount: 0, unpackedSize: 0 },
55
+ dependencies: {
56
+ react: '16.9.0',
57
+ 'react-dom': '16.9.0',
58
+ },
59
+ devDependencies: {
60
+ 'babel-core': '7.0.0-beta6',
61
+ },
62
+ peerDependencies: {
63
+ 'styled-components': '5.0.0',
64
+ },
65
+ },
66
+ _uplinks: {},
67
+ };
68
+
69
+ // When
70
+ const { getByText } = render(
71
+ <HashRouter>
72
+ <DetailContextProvider value={{ packageMeta }}>
73
+ <Dependencies />
74
+ </DetailContextProvider>
75
+ </HashRouter>
76
+ );
77
+
78
+ // Then
79
+ // FIXME: currently MaterialUI chips do not support the children
80
+ // prop, therefore it is impossible to use proper links for
81
+ // dependencies. Those are for now clickable spans
82
+
83
+ expect(getByText('dependencies (2)')).toBeDefined();
84
+ expect(getByText('react@16.9.0').tagName).toBe('SPAN');
85
+ expect(getByText('react-dom@16.9.0').tagName).toBe('SPAN');
86
+
87
+ expect(getByText('devDependencies (1)')).toBeDefined();
88
+ expect(getByText('babel-core@7.0.0-beta6').tagName).toBe('SPAN');
89
+
90
+ expect(getByText('peerDependencies (1)')).toBeDefined();
91
+ expect(getByText('styled-components@5.0.0').tagName).toBe('SPAN');
92
+ });
93
+ });
@@ -0,0 +1,100 @@
1
+ import React, { useContext } from 'react';
2
+ import { useTranslation } from 'react-i18next';
3
+ import { useHistory } from 'react-router-dom';
4
+
5
+ import CardContent from 'verdaccio-ui/components/CardContent';
6
+
7
+ import { PackageDependencies } from '../../../../../types/packageMeta';
8
+ import { DetailContext } from '../../context';
9
+ import NoItems from '../NoItems';
10
+
11
+ import { CardWrap, StyledText, Tags, Tag } from './styles';
12
+
13
+ interface DependencyBlockProps {
14
+ title: string;
15
+ dependencies: PackageDependencies;
16
+ }
17
+
18
+ const DependencyBlock: React.FC<DependencyBlockProps> = ({ title, dependencies }) => {
19
+ const { enableLoading } = useContext(DetailContext);
20
+ const history = useHistory();
21
+ const { t } = useTranslation();
22
+
23
+ const deps = Object.entries(dependencies);
24
+
25
+ function handleClick(name: string): void {
26
+ enableLoading?.();
27
+
28
+ history.push(`/-/web/detail/${name}`);
29
+ }
30
+
31
+ return (
32
+ <CardWrap>
33
+ <CardContent>
34
+ <StyledText variant="subtitle1">{`${title} (${deps.length})`}</StyledText>
35
+ <Tags>
36
+ {deps.map(([name, version]) => (
37
+ <Tag
38
+ className={'dep-tag'}
39
+ clickable={true}
40
+ key={name}
41
+ label={t('dependencies.dependency-block', { package: name, version })}
42
+ // eslint-disable-next-line
43
+ onClick={() => handleClick(name)}
44
+ />
45
+ ))}
46
+ </Tags>
47
+ </CardContent>
48
+ </CardWrap>
49
+ );
50
+ };
51
+
52
+ function hasKeys(object?: { [key: string]: any }): boolean {
53
+ return !!object && Object.keys(object).length > 0;
54
+ }
55
+
56
+ const Dependencies: React.FC<{}> = () => {
57
+ const { packageMeta } = useContext(DetailContext);
58
+ const { t } = useTranslation();
59
+
60
+ if (!packageMeta) {
61
+ throw new Error(t('error.package-meta-is-required-at-detail-context'));
62
+ }
63
+
64
+ const { latest } = packageMeta;
65
+ // FIXME: add dependencies to package meta type
66
+ // @ts-ignore
67
+ const { dependencies, devDependencies, peerDependencies, name } = latest;
68
+ const dependencyMap = { dependencies, devDependencies, peerDependencies };
69
+ const hasDependencies =
70
+ hasKeys(dependencies) || hasKeys(devDependencies) || hasKeys(peerDependencies);
71
+
72
+ if (hasDependencies) {
73
+ return (
74
+ <>
75
+ {Object.entries(dependencyMap).map(([dependencyType, dependencies]) => {
76
+ if (!dependencies || Object.keys(dependencies).length === 0) {
77
+ return null;
78
+ }
79
+
80
+ return (
81
+ <DependencyBlock
82
+ dependencies={dependencies}
83
+ key={dependencyType}
84
+ title={dependencyType}
85
+ />
86
+ );
87
+ })}
88
+ </>
89
+ );
90
+ }
91
+
92
+ return (
93
+ <NoItems
94
+ className="no-dependencies"
95
+ text={t('dependencies.has-no-dependencies', { package: name })}
96
+ />
97
+ );
98
+ };
99
+
100
+ export default Dependencies;
@@ -0,0 +1 @@
1
+ export { default } from './Dependencies';
@@ -0,0 +1,26 @@
1
+ import styled from '@emotion/styled';
2
+
3
+ import Card from 'verdaccio-ui/components/Card';
4
+ import Chip from 'verdaccio-ui/components/Chip';
5
+ import Text from 'verdaccio-ui/components/Text';
6
+ import { Theme } from 'verdaccio-ui/design-tokens/theme';
7
+
8
+ export const CardWrap = styled(Card)({
9
+ margin: '0 0 16px',
10
+ });
11
+
12
+ export const StyledText = styled(Text)<{ theme?: Theme }>((props) => ({
13
+ fontWeight: props.theme && props.theme.fontWeight.bold,
14
+ textTransform: 'capitalize',
15
+ }));
16
+
17
+ export const Tags = styled('div')({
18
+ display: 'flex',
19
+ justifyContent: 'start',
20
+ flexWrap: 'wrap',
21
+ margin: '0 -5px',
22
+ });
23
+
24
+ export const Tag = styled(Chip)({
25
+ margin: '5px',
26
+ });
@@ -0,0 +1,7 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ export interface Props {
4
+ children: ReactNode;
5
+ open: boolean;
6
+ onClose: () => void;
7
+ }
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+
3
+ import { render, cleanup, screen } from 'verdaccio-ui/utils/test-react-testing-library';
4
+
5
+ import { DetailContextProvider } from '../../context';
6
+
7
+ import Deprecated from './Deprecated';
8
+
9
+ describe('test Deprecated', () => {
10
+ afterEach(() => {
11
+ cleanup();
12
+ });
13
+
14
+ const packageMeta = {
15
+ latest: {
16
+ packageName: 'foo',
17
+ version: '1.0.0',
18
+ deprecated: 'duuuude, this is deprecated',
19
+ maintainers: [],
20
+ contributors: [],
21
+ },
22
+ };
23
+
24
+ test('should render the deprecated message', () => {
25
+ render(
26
+ // @ts-ignore
27
+ <DetailContextProvider value={{ packageMeta }}>
28
+ <Deprecated message={packageMeta.latest.deprecated} />
29
+ </DetailContextProvider>
30
+ );
31
+
32
+ expect(screen.getByText('duuuude, this is deprecated')).toBeInTheDocument();
33
+ });
34
+ });