@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.
- package/.babelrc +33 -0
- package/.eslintrc +115 -0
- package/.stylelintrc +40 -0
- package/CHANGELOG.md +152 -554
- package/LICENSE +1 -1
- package/README.md +22 -95
- package/config/env.js +9 -0
- package/jest/api/packages.json +42 -0
- package/jest/identity.js +29 -0
- package/jest/jest.config.js +39 -0
- package/jest/jestEnvironment.js +1 -0
- package/jest/server-handlers.ts +9 -0
- package/jest/server.ts +6 -0
- package/jest/setup-env.ts +15 -0
- package/jest/setup.ts +31 -0
- package/jest/unit/components/__mocks__/api.ts +47 -0
- package/jest/unit/components/__mocks__/token.ts +31 -0
- package/jest/unit/components/store/login.ts +23 -0
- package/jest/unit/components/store/logo.ts +7 -0
- package/jest/unit/components/store/package.ts +174 -0
- package/jest/unit/components/store/packageMeta.ts +592 -0
- package/jest/unit/empty.ts +1 -0
- package/lib/constants.ts +9 -0
- package/package.json +153 -228
- package/src/App/App.test.tsx +123 -0
- package/src/App/App.tsx +54 -0
- package/src/App/AppError.tsx +38 -0
- package/src/App/AppRoute.tsx +63 -0
- package/src/App/Footer/Footer.test.tsx +20 -0
- package/src/App/Footer/Footer.tsx +111 -0
- package/src/App/Footer/__snapshots__/Footer.test.tsx.snap +456 -0
- package/src/App/Footer/index.ts +1 -0
- package/src/App/Footer/styles.ts +44 -0
- package/src/App/Header/Header.test.tsx +152 -0
- package/src/App/Header/Header.tsx +74 -0
- package/src/App/Header/HeaderGreetings.tsx +22 -0
- package/src/App/Header/HeaderInfoDialog.tsx +19 -0
- package/src/App/Header/HeaderLeft.tsx +31 -0
- package/src/App/Header/HeaderMenu.tsx +65 -0
- package/src/App/Header/HeaderRight.tsx +118 -0
- package/src/App/Header/HeaderToolTip.tsx +19 -0
- package/src/App/Header/HeaderToolTipIcon.tsx +75 -0
- package/src/App/Header/LanguageSwitch.tsx +125 -0
- package/src/App/Header/LoginDialog/LoginDialog.test.tsx +112 -0
- package/src/App/Header/LoginDialog/LoginDialog.tsx +81 -0
- package/src/App/Header/LoginDialog/LoginDialogCloseButton.tsx +32 -0
- package/src/App/Header/LoginDialog/LoginDialogForm.tsx +97 -0
- package/src/App/Header/LoginDialog/LoginDialogFormError.tsx +43 -0
- package/src/App/Header/LoginDialog/LoginDialogHeader.tsx +48 -0
- package/src/App/Header/LoginDialog/__snapshots__/LoginDialog.test.tsx.snap +3 -0
- package/src/App/Header/LoginDialog/index.ts +1 -0
- package/src/App/Header/RegistryInfoContent/RegistryInfoContent.test.tsx +27 -0
- package/src/App/Header/RegistryInfoContent/RegistryInfoContent.tsx +155 -0
- package/src/App/Header/RegistryInfoContent/index.ts +1 -0
- package/src/App/Header/RegistryInfoDialog/RegistryInfoDialog.tsx +30 -0
- package/src/App/Header/RegistryInfoDialog/index.ts +1 -0
- package/src/App/Header/RegistryInfoDialog/styles.ts +16 -0
- package/src/App/Header/RegistryInfoDialog/types.ts +7 -0
- package/src/App/Header/Search/Search.test.tsx +168 -0
- package/src/App/Header/Search/Search.tsx +127 -0
- package/src/App/Header/Search/SearchAdornment.tsx +18 -0
- package/src/App/Header/Search/__snapshots__/Search.test.tsx.snap +101 -0
- package/src/App/Header/Search/index.ts +1 -0
- package/src/App/Header/index.ts +1 -0
- package/src/App/Header/styles.ts +89 -0
- package/src/App/index.ts +1 -0
- package/src/App/utils/loadable.tsx +10 -0
- package/src/components/.eslintrc +7 -0
- package/src/components/ActionBar/ActionBar.test.tsx +91 -0
- package/src/components/ActionBar/ActionBar.tsx +45 -0
- package/src/components/ActionBar/ActionBarAction.tsx +75 -0
- package/src/components/ActionBar/__snapshots__/ActionBar.test.tsx.snap +122 -0
- package/src/components/ActionBar/index.ts +1 -0
- package/src/components/AppBar.tsx +10 -0
- package/src/components/Author/Author.test.tsx +75 -0
- package/src/components/Author/Author.tsx +47 -0
- package/src/components/Author/__snapshots__/Author.test.tsx.snap +353 -0
- package/src/components/Author/index.ts +1 -0
- package/src/components/Author/styles.ts +23 -0
- package/src/components/AutoComplete/AutoComplete.tsx +179 -0
- package/src/components/AutoComplete/AutoCompleteV2.tsx +296 -0
- package/src/components/AutoComplete/index.ts +1 -0
- package/src/components/AutoComplete/styles.tsx +58 -0
- package/src/components/AutoComplete/useAutoComplete.tsx +61 -0
- package/src/components/Avatar.tsx +3 -0
- package/src/components/Box.tsx +8 -0
- package/src/components/Button.tsx +10 -0
- package/src/components/Card.tsx +10 -0
- package/src/components/CardActions.tsx +13 -0
- package/src/components/CardContent.tsx +10 -0
- package/src/components/Chip.tsx +10 -0
- package/src/components/CircularProgress.tsx +15 -0
- package/src/components/CopyToClipBoard.tsx +45 -0
- package/src/components/Dialog.tsx +10 -0
- package/src/components/DialogActions.tsx +16 -0
- package/src/components/DialogContent.tsx +16 -0
- package/src/components/DialogTitle.tsx +10 -0
- package/src/components/Divider.tsx +10 -0
- package/src/components/FloatingActionButton.tsx +12 -0
- package/src/components/FormControl.tsx +10 -0
- package/src/components/FormHelperText.tsx +16 -0
- package/src/components/Grid.tsx +10 -0
- package/src/components/Heading.tsx +15 -0
- package/src/components/IconButton.tsx +10 -0
- package/src/components/Icons/.eslintrc +5 -0
- package/src/components/Icons/Earth.tsx +36 -0
- package/src/components/Icons/FileBinary.tsx +20 -0
- package/src/components/Icons/Law.tsx +20 -0
- package/src/components/Icons/License.tsx +18 -0
- package/src/components/Icons/Time.tsx +19 -0
- package/src/components/Icons/Version.tsx +20 -0
- package/src/components/Icons/index.ts +5 -0
- package/src/components/Input.tsx +10 -0
- package/src/components/InputAdornment/InputAdornment.tsx +16 -0
- package/src/components/InputAdornment/index.ts +1 -0
- package/src/components/InputLabel.tsx +10 -0
- package/src/components/Label/Label.test.tsx +15 -0
- package/src/components/Label/Label.tsx +35 -0
- package/src/components/Label/__snapshots__/Label.test.tsx.snap +14 -0
- package/src/components/Label/index.ts +1 -0
- package/src/components/Link.tsx +39 -0
- package/src/components/List.tsx +10 -0
- package/src/components/ListItem.tsx +23 -0
- package/src/components/ListItemText.tsx +16 -0
- package/src/components/Loading/Loading.test.tsx +12 -0
- package/src/components/Loading/Loading.tsx +17 -0
- package/src/components/Loading/Spinner/Spinner.test.tsx +14 -0
- package/src/components/Loading/Spinner/Spinner.tsx +35 -0
- package/src/components/Loading/Spinner/__snapshots__/Spinner.test.tsx.snap +148 -0
- package/src/components/Loading/Spinner/index.tsx +1 -0
- package/src/components/Loading/__snapshots__/Loading.test.tsx.snap +86 -0
- package/src/components/Loading/index.ts +1 -0
- package/src/components/Loading/styles.ts +17 -0
- package/src/components/Logo/Logo.test.tsx +12 -0
- package/src/components/Logo/Logo.tsx +55 -0
- package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +19 -0
- package/src/components/Logo/img/logo-black-and-white.svg +1 -0
- package/src/components/Logo/img/logo.svg +1 -0
- package/src/components/Logo/index.ts +1 -0
- package/src/components/Menu.tsx +10 -0
- package/src/components/MenuItem.tsx +25 -0
- package/src/components/NotFound/NotFound.tsx +52 -0
- package/src/components/NotFound/Notfound.test.tsx +37 -0
- package/src/components/NotFound/__snapshots__/Notfound.test.tsx.snap +44 -0
- package/src/components/NotFound/img/package.svg +1 -0
- package/src/components/NotFound/index.ts +1 -0
- package/src/components/NotFound/styles.ts +40 -0
- package/src/components/Paper.tsx +10 -0
- package/src/components/SnackbarContent.tsx +15 -0
- package/src/components/SvgIcon.tsx +38 -0
- package/src/components/Tab.tsx +10 -0
- package/src/components/Tabs.tsx +14 -0
- package/src/components/Text/Text.tsx +17 -0
- package/src/components/Text/TextConfig.ts +7 -0
- package/src/components/Text/index.ts +2 -0
- package/src/components/TextField/TextField.test.tsx +16 -0
- package/src/components/TextField/TextField.tsx +23 -0
- package/src/components/TextField/__snapshots__/TextField.test.tsx.snap +19 -0
- package/src/components/TextField/index.ts +1 -0
- package/src/components/Toolbar.tsx +10 -0
- package/src/components/Tooltip.tsx +25 -0
- package/src/design-tokens/ResetStyles.tsx +44 -0
- package/src/design-tokens/StyleBaseline.tsx +14 -0
- package/src/design-tokens/ThemeContext.ts +13 -0
- package/src/design-tokens/ThemeProvider.tsx +44 -0
- package/src/design-tokens/emotion.ts +5 -0
- package/src/design-tokens/load-dayjs-locale.ts +98 -0
- package/src/design-tokens/theme.ts +159 -0
- package/src/design-tokens/useLocalStorage.ts +40 -0
- package/src/design-tokens/useOnClickOutside.ts +28 -0
- package/src/design-tokens/useTheme.ts +7 -0
- package/src/i18n/ABOUT_TRANSLATIONS.md +13 -0
- package/src/i18n/config.ts +52 -0
- package/src/i18n/crowdin/ui.json +170 -0
- package/src/i18n/deprecated_translations_dont_use/cs-CZ.json +168 -0
- package/src/i18n/deprecated_translations_dont_use/de-DE.json +168 -0
- package/src/i18n/deprecated_translations_dont_use/en-US.json +170 -0
- package/src/i18n/deprecated_translations_dont_use/es-ES.json +168 -0
- package/src/i18n/deprecated_translations_dont_use/fr-FR.json +168 -0
- package/src/i18n/deprecated_translations_dont_use/ja-JP.json +168 -0
- package/src/i18n/deprecated_translations_dont_use/km-KH.json +168 -0
- package/src/i18n/deprecated_translations_dont_use/pt-BR.json +168 -0
- package/src/i18n/deprecated_translations_dont_use/ru-RU.json +168 -0
- package/src/i18n/deprecated_translations_dont_use/tr-TR.json +168 -0
- package/src/i18n/deprecated_translations_dont_use/uk-UA.json +168 -0
- package/src/i18n/deprecated_translations_dont_use/zh-CN.json +168 -0
- package/src/i18n/deprecated_translations_dont_use/zh-TW.json +165 -0
- package/src/i18n/enabledLanguages.ts +35 -0
- package/src/index.tsx +36 -0
- package/src/lib/constants.ts +9 -0
- package/src/pages/Version/DetailContainer/Dependencies/Dependencies.test.tsx +93 -0
- package/src/pages/Version/DetailContainer/Dependencies/Dependencies.tsx +100 -0
- package/src/pages/Version/DetailContainer/Dependencies/index.ts +1 -0
- package/src/pages/Version/DetailContainer/Dependencies/styles.ts +26 -0
- package/src/pages/Version/DetailContainer/Dependencies/types.ts +7 -0
- package/src/pages/Version/DetailContainer/Deprecated/Deprecated.test.tsx +34 -0
- package/src/pages/Version/DetailContainer/Deprecated/Deprecated.tsx +31 -0
- package/src/pages/Version/DetailContainer/Deprecated/index.ts +1 -0
- package/src/pages/Version/DetailContainer/DetailContainer.test.tsx +13 -0
- package/src/pages/Version/DetailContainer/DetailContainer.tsx +37 -0
- package/src/pages/Version/DetailContainer/DetailContainerContent.tsx +41 -0
- package/src/pages/Version/DetailContainer/DetailContainerContentReadme.tsx +19 -0
- package/src/pages/Version/DetailContainer/DetailContainerTabs.tsx +36 -0
- package/src/pages/Version/DetailContainer/NoItems/NoItems.tsx +16 -0
- package/src/pages/Version/DetailContainer/NoItems/Noitems.test.tsx +16 -0
- package/src/pages/Version/DetailContainer/NoItems/__snapshots__/Noitems.test.tsx.snap +9 -0
- package/src/pages/Version/DetailContainer/NoItems/index.ts +1 -0
- package/src/pages/Version/DetailContainer/Readme/Readme.spec.tsx +19 -0
- package/src/pages/Version/DetailContainer/Readme/Readme.tsx +22 -0
- package/src/pages/Version/DetailContainer/Readme/__snapshots__/Readme.spec.tsx.snap +94 -0
- package/src/pages/Version/DetailContainer/Readme/index.ts +1 -0
- package/src/pages/Version/DetailContainer/Readme/types.ts +3 -0
- package/src/pages/Version/DetailContainer/UpLinks/UpLinks.test.tsx +58 -0
- package/src/pages/Version/DetailContainer/UpLinks/UpLinks.tsx +45 -0
- package/src/pages/Version/DetailContainer/UpLinks/__snapshots__/UpLinks.test.tsx.snap +247 -0
- package/src/pages/Version/DetailContainer/UpLinks/index.ts +1 -0
- package/src/pages/Version/DetailContainer/UpLinks/styles.ts +24 -0
- package/src/pages/Version/DetailContainer/Versions/Versions.test.tsx +60 -0
- package/src/pages/Version/DetailContainer/Versions/Versions.tsx +41 -0
- package/src/pages/Version/DetailContainer/Versions/VersionsHistoryList.tsx +40 -0
- package/src/pages/Version/DetailContainer/Versions/VersionsTagList.tsx +28 -0
- package/src/pages/Version/DetailContainer/Versions/__partials__/data.json +5984 -0
- package/src/pages/Version/DetailContainer/Versions/__snapshots__/Versions.test.tsx.snap +3 -0
- package/src/pages/Version/DetailContainer/Versions/index.ts +1 -0
- package/src/pages/Version/DetailContainer/Versions/styles.ts +30 -0
- package/src/pages/Version/DetailContainer/__snapshots__/DetailContainer.test.tsx.snap +103 -0
- package/src/pages/Version/DetailContainer/index.ts +1 -0
- package/src/pages/Version/DetailSidebar/DetailSidebar.tsx +55 -0
- package/src/pages/Version/DetailSidebar/DetailSidebarFundButton.test.tsx +111 -0
- package/src/pages/Version/DetailSidebar/DetailSidebarFundButton.tsx +53 -0
- package/src/pages/Version/DetailSidebar/DetailSidebarTitle.tsx +40 -0
- package/src/pages/Version/DetailSidebar/Developers/Developers.test.tsx +117 -0
- package/src/pages/Version/DetailSidebar/Developers/Developers.tsx +90 -0
- package/src/pages/Version/DetailSidebar/Developers/DevelopersTitle.tsx +32 -0
- package/src/pages/Version/DetailSidebar/Developers/__snapshots__/Developers.test.tsx.snap +380 -0
- package/src/pages/Version/DetailSidebar/Developers/get-unique-developer-values.ts +16 -0
- package/src/pages/Version/DetailSidebar/Developers/index.ts +1 -0
- package/src/pages/Version/DetailSidebar/Developers/styles.ts +31 -0
- package/src/pages/Version/DetailSidebar/Dist/Dist.test.tsx +78 -0
- package/src/pages/Version/DetailSidebar/Dist/Dist.tsx +49 -0
- package/src/pages/Version/DetailSidebar/Dist/__snapshots__/Dist.test.tsx.snap +602 -0
- package/src/pages/Version/DetailSidebar/Dist/index.ts +1 -0
- package/src/pages/Version/DetailSidebar/Dist/styles.ts +27 -0
- package/src/pages/Version/DetailSidebar/Engines/Engines.test.tsx +71 -0
- package/src/pages/Version/DetailSidebar/Engines/Engines.tsx +58 -0
- package/src/pages/Version/DetailSidebar/Engines/img/node.png +0 -0
- package/src/pages/Version/DetailSidebar/Engines/index.ts +1 -0
- package/src/pages/Version/DetailSidebar/Engines/styles.ts +14 -0
- package/src/pages/Version/DetailSidebar/Install/Install.test.tsx +64 -0
- package/src/pages/Version/DetailSidebar/Install/Install.tsx +52 -0
- package/src/pages/Version/DetailSidebar/Install/InstallListItem.tsx +97 -0
- package/src/pages/Version/DetailSidebar/Install/__partials__/data.json +5984 -0
- package/src/pages/Version/DetailSidebar/Install/img/npm.svg +15 -0
- package/src/pages/Version/DetailSidebar/Install/img/pnpm.svg +1 -0
- package/src/pages/Version/DetailSidebar/Install/img/yarn.svg +1 -0
- package/src/pages/Version/DetailSidebar/Install/index.ts +1 -0
- package/src/pages/Version/DetailSidebar/Repository/Repository.test.tsx +78 -0
- package/src/pages/Version/DetailSidebar/Repository/Repository.tsx +93 -0
- package/src/pages/Version/DetailSidebar/Repository/__partials__/data.json +5984 -0
- package/src/pages/Version/DetailSidebar/Repository/__snapshots__/Repository.test.tsx.snap +3 -0
- package/src/pages/Version/DetailSidebar/Repository/img/git.png +0 -0
- package/src/pages/Version/DetailSidebar/Repository/index.ts +1 -0
- package/src/pages/Version/DetailSidebar/index.ts +1 -0
- package/src/pages/Version/Version.test.tsx +68 -0
- package/src/pages/Version/Version.tsx +41 -0
- package/src/pages/Version/VersionContextProvider.tsx +43 -0
- package/src/pages/Version/VersionLayout.tsx +20 -0
- package/src/pages/Version/__partials__/data.json +5984 -0
- package/src/pages/Version/context.ts +10 -0
- package/src/pages/Version/get-route-package-name.ts +9 -0
- package/src/pages/Version/index.ts +4 -0
- package/src/pages/Version/version-config.ts +19 -0
- package/src/pages/home/Home.tsx +25 -0
- package/src/pages/home/PackageList/Help/Help.test.tsx +12 -0
- package/src/pages/home/PackageList/Help/Help.tsx +56 -0
- package/src/pages/home/PackageList/Help/__snapshots__/Help.test.tsx.snap +159 -0
- package/src/pages/home/PackageList/Help/index.ts +1 -0
- package/src/pages/home/PackageList/Help/styles.ts +13 -0
- package/src/pages/home/PackageList/Package/Package.test.tsx +56 -0
- package/src/pages/home/PackageList/Package/Package.tsx +253 -0
- package/src/pages/home/PackageList/Package/Tag/Tag.test.tsx +16 -0
- package/src/pages/home/PackageList/Package/Tag/Tag.tsx +11 -0
- package/src/pages/home/PackageList/Package/Tag/__snapshots__/Tag.test.tsx.snap +21 -0
- package/src/pages/home/PackageList/Package/Tag/index.ts +1 -0
- package/src/pages/home/PackageList/Package/Tag/styles.ts +11 -0
- package/src/pages/home/PackageList/Package/index.ts +1 -0
- package/src/pages/home/PackageList/Package/styles.ts +112 -0
- package/src/pages/home/PackageList/PackageList.tsx +81 -0
- package/src/pages/home/PackageList/Packagelist.test.tsx +60 -0
- package/src/pages/home/PackageList/index.ts +1 -0
- package/src/pages/home/index.ts +1 -0
- package/src/providers/API/api.test.ts +136 -0
- package/src/providers/API/api.ts +73 -0
- package/src/providers/API/storage.ts +12 -0
- package/src/providers/config/AppConfigurationProvider.tsx +57 -0
- package/src/providers/config/index.ts +1 -0
- package/src/store/index.ts +1 -0
- package/src/store/models/configuration.ts +42 -0
- package/src/store/models/download.ts +31 -0
- package/src/store/models/index.ts +17 -0
- package/src/store/models/login.ts +90 -0
- package/src/store/models/manifest.ts +91 -0
- package/src/store/models/packages.ts +36 -0
- package/src/store/models/search.ts +81 -0
- package/src/store/store.ts +15 -0
- package/src/template/favicon.ico +0 -0
- package/src/template/index.html +21 -0
- package/src/utils/.eslintrc +5 -0
- package/src/utils/cli-utils.test.ts +66 -0
- package/src/utils/cli-utils.ts +38 -0
- package/src/utils/colors.ts +1 -0
- package/src/utils/constants.ts +5 -0
- package/src/utils/file-size.ts +13 -0
- package/src/utils/i18nForTests.ts +25 -0
- package/src/utils/login.test.ts +71 -0
- package/src/utils/login.ts +44 -0
- package/src/utils/package.test.ts +101 -0
- package/src/utils/package.ts +105 -0
- package/src/utils/sec-utils.ts +15 -0
- package/src/utils/storage.ts +12 -0
- package/src/utils/test-react-testing-library.tsx +38 -0
- package/src/utils/url.test.ts +28 -0
- package/src/utils/url.ts +58 -0
- package/src/utils/windows.ts +3 -0
- package/static/favicon.ico +0 -0
- package/static/index.html +21 -0
- package/static/main.c57129036f278d0c7acf.js +2 -0
- package/static/main.c57129036f278d0c7acf.js.LICENSE.txt +1456 -0
- package/static/manifest.json +5 -17
- package/static/runtime.c57129036f278d0c7acf.js +2 -0
- package/static/{runtime.f6e570dfe38870a45bf5.js.LICENSE.txt → runtime.c57129036f278d0c7acf.js.LICENSE.txt} +2 -2
- package/static/vendors.c57129036f278d0c7acf.js +2 -0
- package/static/vendors.c57129036f278d0c7acf.js.LICENSE.txt +2932 -0
- package/tools/.eslintrc +14 -0
- package/tools/_verdaccio.config.yaml +59 -0
- package/tools/dev.server.js +48 -0
- package/tools/getPackageJson.js +25 -0
- package/tools/verdaccio.js +31 -0
- package/tools/webpack.config.js +82 -0
- package/tools/webpack.dev.config.babel.js +60 -0
- package/tools/webpack.prod.config.babel.js +81 -0
- package/tsconfig.build.json +24 -0
- package/tsconfig.json +27 -0
- package/types/custom.d.ts +9 -0
- package/types/files.d.ts +9 -0
- package/types/index.ts +12 -0
- package/types/jest-dom.d.ts +1 -0
- package/types/packageMeta.ts +82 -0
- package/static/238.f6e570dfe38870a45bf5.js +0 -2
- package/static/238.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/718.f6e570dfe38870a45bf5.js +0 -2
- package/static/718.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/73.f6e570dfe38870a45bf5.js +0 -2
- package/static/73.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/Dependencies.f6e570dfe38870a45bf5.js +0 -2
- package/static/Dependencies.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/Dist.f6e570dfe38870a45bf5.js +0 -2
- package/static/Dist.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/Engines.f6e570dfe38870a45bf5.js +0 -2
- package/static/Engines.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/Home.f6e570dfe38870a45bf5.js +0 -2
- package/static/Home.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/Install.f6e570dfe38870a45bf5.js +0 -2
- package/static/Install.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/NotFound.f6e570dfe38870a45bf5.js +0 -2
- package/static/NotFound.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/Provider.f6e570dfe38870a45bf5.js +0 -2
- package/static/Provider.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/Repository.f6e570dfe38870a45bf5.js +0 -2
- package/static/Repository.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/UpLinks.f6e570dfe38870a45bf5.js +0 -2
- package/static/UpLinks.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/Version.f6e570dfe38870a45bf5.js +0 -2
- package/static/Version.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/Versions.f6e570dfe38870a45bf5.js +0 -2
- package/static/Versions.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/main.f6e570dfe38870a45bf5.js +0 -2
- package/static/main.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/runtime.f6e570dfe38870a45bf5.js +0 -2
- package/static/vendors.f6e570dfe38870a45bf5.js +0 -2
- package/static/vendors.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -98
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createContext, Consumer, Provider } from 'react';
|
|
2
|
+
|
|
3
|
+
import { DetailContextProps, VersionPageConsumerProps } from './version-config';
|
|
4
|
+
|
|
5
|
+
export const DetailContext = createContext<Partial<DetailContextProps>>({});
|
|
6
|
+
|
|
7
|
+
export const DetailContextProvider: Provider<Partial<VersionPageConsumerProps>> =
|
|
8
|
+
DetailContext.Provider;
|
|
9
|
+
export const DetailContextConsumer: Consumer<Partial<VersionPageConsumerProps>> =
|
|
10
|
+
DetailContext.Consumer;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PackageMetaInterface } from '../../../types/packageMeta';
|
|
2
|
+
|
|
3
|
+
export interface DetailContextProps {
|
|
4
|
+
enableLoading: () => void;
|
|
5
|
+
hasNotBeenFound: boolean;
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
packageMeta: PackageMetaInterface;
|
|
8
|
+
packageName: string;
|
|
9
|
+
packageVersion?: string;
|
|
10
|
+
readMe: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface VersionPageConsumerProps {
|
|
14
|
+
enableLoading: () => void;
|
|
15
|
+
packageMeta: PackageMetaInterface;
|
|
16
|
+
packageName: string;
|
|
17
|
+
packageVersion?: string;
|
|
18
|
+
readMe: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { useDispatch, useSelector } from 'react-redux';
|
|
3
|
+
|
|
4
|
+
import Loading from 'verdaccio-ui/components/Loading';
|
|
5
|
+
|
|
6
|
+
import { Dispatch, RootState } from '../../store/store';
|
|
7
|
+
|
|
8
|
+
import { PackageList } from './PackageList';
|
|
9
|
+
|
|
10
|
+
const Home: React.FC = () => {
|
|
11
|
+
const packages = useSelector((state: RootState) => state.packages.response);
|
|
12
|
+
const isLoading = useSelector((state: RootState) => state?.loading?.models.packages);
|
|
13
|
+
const dispatch = useDispatch<Dispatch>();
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
dispatch.packages.getPackages();
|
|
16
|
+
}, [dispatch]);
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div className="container content" data-testid="home-page-container">
|
|
20
|
+
{isLoading ? <Loading /> : <PackageList packages={packages} />}
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default Home;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { render } from 'verdaccio-ui/utils/test-react-testing-library';
|
|
4
|
+
|
|
5
|
+
import Help from './Help';
|
|
6
|
+
|
|
7
|
+
describe('<Help /> component', () => {
|
|
8
|
+
test('should load the component in default state', () => {
|
|
9
|
+
const { container } = render(<Help />);
|
|
10
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
|
|
4
|
+
import Button from 'verdaccio-ui/components/Button';
|
|
5
|
+
import CardActions from 'verdaccio-ui/components/CardActions';
|
|
6
|
+
import CardContent from 'verdaccio-ui/components/CardContent';
|
|
7
|
+
import CopyToClipBoard from 'verdaccio-ui/components/CopyToClipBoard';
|
|
8
|
+
import { default as Typography } from 'verdaccio-ui/components/Heading';
|
|
9
|
+
import Text from 'verdaccio-ui/components/Text';
|
|
10
|
+
import { useConfig } from 'verdaccio-ui/providers/config';
|
|
11
|
+
|
|
12
|
+
import { CardStyled as Card, HelpTitle } from './styles';
|
|
13
|
+
|
|
14
|
+
function renderHeadingClipboardSegments(title: string, text: string): React.ReactNode {
|
|
15
|
+
return (
|
|
16
|
+
<Fragment>
|
|
17
|
+
<Text variant={'body1'}>{title}</Text>
|
|
18
|
+
<CopyToClipBoard text={text} />
|
|
19
|
+
</Fragment>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const Help: React.FC = () => {
|
|
24
|
+
const { configOptions } = useConfig();
|
|
25
|
+
const registryUrl = configOptions.base;
|
|
26
|
+
const { t } = useTranslation();
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Card id="help-card">
|
|
30
|
+
<CardContent>
|
|
31
|
+
<Typography gutterBottom={true} id="help-card__title" variant="h5">
|
|
32
|
+
{t('help.title')}
|
|
33
|
+
</Typography>
|
|
34
|
+
<HelpTitle color="textSecondary" gutterBottom={true}>
|
|
35
|
+
{t('help.sub-title')}
|
|
36
|
+
</HelpTitle>
|
|
37
|
+
{renderHeadingClipboardSegments(
|
|
38
|
+
t('help.first-step'),
|
|
39
|
+
t('help.first-step-command-line', { registryUrl })
|
|
40
|
+
)}
|
|
41
|
+
{renderHeadingClipboardSegments(
|
|
42
|
+
t('help.second-step'),
|
|
43
|
+
t('help.second-step-command-line', { registryUrl })
|
|
44
|
+
)}
|
|
45
|
+
<Text variant="body2">{t('help.third-step')}</Text>
|
|
46
|
+
</CardContent>
|
|
47
|
+
<CardActions>
|
|
48
|
+
<Button color="primary" href="https://verdaccio.org/docs/en/installation" size="small">
|
|
49
|
+
{t('button.learn-more')}
|
|
50
|
+
</Button>
|
|
51
|
+
</CardActions>
|
|
52
|
+
</Card>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export default Help;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<Help /> component should load the component in default state 1`] = `
|
|
4
|
+
.emotion-0 {
|
|
5
|
+
width: 600px;
|
|
6
|
+
margin: auto;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.emotion-2 {
|
|
10
|
+
margin-bottom: 20px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.emotion-4 {
|
|
14
|
+
display: -webkit-box;
|
|
15
|
+
display: -webkit-flex;
|
|
16
|
+
display: -ms-flexbox;
|
|
17
|
+
display: flex;
|
|
18
|
+
-webkit-align-items: center;
|
|
19
|
+
-webkit-box-align: center;
|
|
20
|
+
-ms-flex-align: center;
|
|
21
|
+
align-items: center;
|
|
22
|
+
-webkit-box-pack: justify;
|
|
23
|
+
-webkit-justify-content: space-between;
|
|
24
|
+
-ms-flex-pack: justify;
|
|
25
|
+
justify-content: space-between;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.emotion-6 {
|
|
29
|
+
display: inline-block;
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
white-space: nowrap;
|
|
32
|
+
text-overflow: ellipsis;
|
|
33
|
+
height: 21px;
|
|
34
|
+
font-size: 1rem;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
<div
|
|
38
|
+
class="MuiPaper-root MuiCard-root emotion-0 emotion-1 MuiPaper-elevation1 MuiPaper-rounded"
|
|
39
|
+
id="help-card"
|
|
40
|
+
>
|
|
41
|
+
<div
|
|
42
|
+
class="MuiCardContent-root"
|
|
43
|
+
>
|
|
44
|
+
<h5
|
|
45
|
+
class="MuiTypography-root MuiTypography-h5 MuiTypography-gutterBottom"
|
|
46
|
+
id="help-card__title"
|
|
47
|
+
>
|
|
48
|
+
No Package Published Yet.
|
|
49
|
+
</h5>
|
|
50
|
+
<h6
|
|
51
|
+
class="MuiTypography-root emotion-2 emotion-3 MuiTypography-h6 MuiTypography-colorTextSecondary MuiTypography-gutterBottom"
|
|
52
|
+
>
|
|
53
|
+
To publish your first package just:
|
|
54
|
+
</h6>
|
|
55
|
+
<span
|
|
56
|
+
class="MuiTypography-root MuiTypography-body1"
|
|
57
|
+
>
|
|
58
|
+
1. Login
|
|
59
|
+
</span>
|
|
60
|
+
<div
|
|
61
|
+
class="emotion-4 emotion-5"
|
|
62
|
+
>
|
|
63
|
+
<span
|
|
64
|
+
class="emotion-6 emotion-7"
|
|
65
|
+
>
|
|
66
|
+
npm adduser --registry http://localhost:9000/
|
|
67
|
+
</span>
|
|
68
|
+
<button
|
|
69
|
+
class="MuiButtonBase-root MuiIconButton-root"
|
|
70
|
+
data-testid="copy-icon"
|
|
71
|
+
tabindex="0"
|
|
72
|
+
title="Copy to clipboard"
|
|
73
|
+
type="button"
|
|
74
|
+
>
|
|
75
|
+
<span
|
|
76
|
+
class="MuiIconButton-label"
|
|
77
|
+
>
|
|
78
|
+
<svg
|
|
79
|
+
aria-hidden="true"
|
|
80
|
+
class="MuiSvgIcon-root"
|
|
81
|
+
focusable="false"
|
|
82
|
+
viewBox="0 0 24 24"
|
|
83
|
+
>
|
|
84
|
+
<path
|
|
85
|
+
d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4l6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z"
|
|
86
|
+
/>
|
|
87
|
+
</svg>
|
|
88
|
+
</span>
|
|
89
|
+
<span
|
|
90
|
+
class="MuiTouchRipple-root"
|
|
91
|
+
/>
|
|
92
|
+
</button>
|
|
93
|
+
</div>
|
|
94
|
+
<span
|
|
95
|
+
class="MuiTypography-root MuiTypography-body1"
|
|
96
|
+
>
|
|
97
|
+
2. Publish
|
|
98
|
+
</span>
|
|
99
|
+
<div
|
|
100
|
+
class="emotion-4 emotion-5"
|
|
101
|
+
>
|
|
102
|
+
<span
|
|
103
|
+
class="emotion-6 emotion-7"
|
|
104
|
+
>
|
|
105
|
+
npm publish --registry http://localhost:9000/
|
|
106
|
+
</span>
|
|
107
|
+
<button
|
|
108
|
+
class="MuiButtonBase-root MuiIconButton-root"
|
|
109
|
+
data-testid="copy-icon"
|
|
110
|
+
tabindex="0"
|
|
111
|
+
title="Copy to clipboard"
|
|
112
|
+
type="button"
|
|
113
|
+
>
|
|
114
|
+
<span
|
|
115
|
+
class="MuiIconButton-label"
|
|
116
|
+
>
|
|
117
|
+
<svg
|
|
118
|
+
aria-hidden="true"
|
|
119
|
+
class="MuiSvgIcon-root"
|
|
120
|
+
focusable="false"
|
|
121
|
+
viewBox="0 0 24 24"
|
|
122
|
+
>
|
|
123
|
+
<path
|
|
124
|
+
d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4l6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z"
|
|
125
|
+
/>
|
|
126
|
+
</svg>
|
|
127
|
+
</span>
|
|
128
|
+
<span
|
|
129
|
+
class="MuiTouchRipple-root"
|
|
130
|
+
/>
|
|
131
|
+
</button>
|
|
132
|
+
</div>
|
|
133
|
+
<span
|
|
134
|
+
class="MuiTypography-root MuiTypography-body2"
|
|
135
|
+
>
|
|
136
|
+
3. Refresh this page
|
|
137
|
+
</span>
|
|
138
|
+
</div>
|
|
139
|
+
<div
|
|
140
|
+
class="MuiCardActions-root MuiCardActions-spacing"
|
|
141
|
+
>
|
|
142
|
+
<a
|
|
143
|
+
aria-disabled="false"
|
|
144
|
+
class="MuiButtonBase-root MuiButton-root MuiButton-text MuiButton-textPrimary MuiButton-textSizeSmall MuiButton-sizeSmall"
|
|
145
|
+
href="https://verdaccio.org/docs/en/installation"
|
|
146
|
+
tabindex="0"
|
|
147
|
+
>
|
|
148
|
+
<span
|
|
149
|
+
class="MuiButton-label"
|
|
150
|
+
>
|
|
151
|
+
Learn More
|
|
152
|
+
</span>
|
|
153
|
+
<span
|
|
154
|
+
class="MuiTouchRipple-root"
|
|
155
|
+
/>
|
|
156
|
+
</a>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Help';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
|
|
3
|
+
import Card from 'verdaccio-ui/components/Card';
|
|
4
|
+
import { default as Typography } from 'verdaccio-ui/components/Heading';
|
|
5
|
+
|
|
6
|
+
export const CardStyled = styled(Card)({
|
|
7
|
+
width: 600,
|
|
8
|
+
margin: 'auto',
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const HelpTitle = styled(Typography)({
|
|
12
|
+
marginBottom: 20,
|
|
13
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MemoryRouter } from 'react-router';
|
|
3
|
+
|
|
4
|
+
import { renderWithStore, cleanup } from 'verdaccio-ui/utils/test-react-testing-library';
|
|
5
|
+
|
|
6
|
+
import { store } from '../../../../store';
|
|
7
|
+
|
|
8
|
+
import Package from './Package';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Generates one month back date from current time
|
|
12
|
+
* @return {object} date object
|
|
13
|
+
*/
|
|
14
|
+
const dateOneMonthAgo = (): Date => new Date(1544377770747);
|
|
15
|
+
|
|
16
|
+
describe('<Package /> component', () => {
|
|
17
|
+
afterEach(() => {
|
|
18
|
+
cleanup();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test('should load the component', () => {
|
|
22
|
+
const props = {
|
|
23
|
+
name: 'verdaccio',
|
|
24
|
+
version: '1.0.0',
|
|
25
|
+
time: String(dateOneMonthAgo()),
|
|
26
|
+
license: 'MIT',
|
|
27
|
+
description: 'Private NPM repository',
|
|
28
|
+
author: {
|
|
29
|
+
name: 'Sam',
|
|
30
|
+
},
|
|
31
|
+
keywords: ['verdaccio'],
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const wrapper = renderWithStore(
|
|
35
|
+
<MemoryRouter>
|
|
36
|
+
<Package
|
|
37
|
+
author={props.author}
|
|
38
|
+
description={props.description}
|
|
39
|
+
license={props.license}
|
|
40
|
+
name={props.name}
|
|
41
|
+
time={props.time}
|
|
42
|
+
version={props.version}
|
|
43
|
+
/>
|
|
44
|
+
</MemoryRouter>,
|
|
45
|
+
store
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
// FUTURE: improve this expectectations
|
|
49
|
+
expect(wrapper.getByText('verdaccio')).toBeInTheDocument();
|
|
50
|
+
expect(wrapper.getByText('Private NPM repository')).toBeInTheDocument();
|
|
51
|
+
expect(wrapper.getByText('v1.0.0')).toBeInTheDocument();
|
|
52
|
+
expect(wrapper.getByText('MIT')).toBeInTheDocument();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test.todo('should load the component without author');
|
|
56
|
+
});
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { css } from '@emotion/core';
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
import BugReport from '@material-ui/icons/BugReport';
|
|
4
|
+
import DownloadIcon from '@material-ui/icons/CloudDownload';
|
|
5
|
+
import HomeIcon from '@material-ui/icons/Home';
|
|
6
|
+
import React, { useCallback } from 'react';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
import { useDispatch, useSelector } from 'react-redux';
|
|
9
|
+
|
|
10
|
+
import Grid from 'verdaccio-ui/components/Grid';
|
|
11
|
+
import { Version, FileBinary, Time, Law } from 'verdaccio-ui/components/Icons';
|
|
12
|
+
import Link from 'verdaccio-ui/components/Link';
|
|
13
|
+
import ListItem from 'verdaccio-ui/components/ListItem';
|
|
14
|
+
import Tooltip from 'verdaccio-ui/components/Tooltip';
|
|
15
|
+
import { Theme } from 'verdaccio-ui/design-tokens/theme';
|
|
16
|
+
import fileSizeSI from 'verdaccio-ui/utils/file-size';
|
|
17
|
+
import { formatDate, formatDateDistance, getAuthorName } from 'verdaccio-ui/utils/package';
|
|
18
|
+
import { isURL } from 'verdaccio-ui/utils/url';
|
|
19
|
+
|
|
20
|
+
import { PackageMetaInterface, Author as PackageAuthor } from '../../../../../types/packageMeta';
|
|
21
|
+
import { Dispatch, RootState } from '../../../../store/store';
|
|
22
|
+
|
|
23
|
+
import {
|
|
24
|
+
Author,
|
|
25
|
+
Avatar,
|
|
26
|
+
Description,
|
|
27
|
+
Details,
|
|
28
|
+
GridRightAligned,
|
|
29
|
+
IconButton,
|
|
30
|
+
OverviewItem,
|
|
31
|
+
Wrapper,
|
|
32
|
+
PackageListItemText,
|
|
33
|
+
PackageTitle,
|
|
34
|
+
Published,
|
|
35
|
+
TagContainer,
|
|
36
|
+
Text,
|
|
37
|
+
WrapperLink,
|
|
38
|
+
} from './styles';
|
|
39
|
+
import Tag from './Tag';
|
|
40
|
+
|
|
41
|
+
interface Bugs {
|
|
42
|
+
url: string;
|
|
43
|
+
}
|
|
44
|
+
interface Dist {
|
|
45
|
+
unpackedSize: number;
|
|
46
|
+
tarball: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface PackageInterface {
|
|
50
|
+
name: string;
|
|
51
|
+
version: string;
|
|
52
|
+
time?: number | string;
|
|
53
|
+
author: PackageAuthor;
|
|
54
|
+
description?: string;
|
|
55
|
+
keywords?: string[];
|
|
56
|
+
license?: PackageMetaInterface['latest']['license'];
|
|
57
|
+
homepage?: string;
|
|
58
|
+
bugs?: Bugs;
|
|
59
|
+
dist?: Dist;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const Package: React.FC<PackageInterface> = ({
|
|
63
|
+
author: { name: authorName, avatar: authorAvatar },
|
|
64
|
+
bugs,
|
|
65
|
+
description,
|
|
66
|
+
dist,
|
|
67
|
+
homepage,
|
|
68
|
+
keywords = [],
|
|
69
|
+
license,
|
|
70
|
+
name: packageName,
|
|
71
|
+
time,
|
|
72
|
+
version,
|
|
73
|
+
}) => {
|
|
74
|
+
const config = useSelector((state: RootState) => state.configuration);
|
|
75
|
+
const dispatch = useDispatch<Dispatch>();
|
|
76
|
+
const { t } = useTranslation();
|
|
77
|
+
|
|
78
|
+
const handleDownload = useCallback(
|
|
79
|
+
async (tarballDist: string) => {
|
|
80
|
+
// FIXME: check, the dist might be different thant npmjs
|
|
81
|
+
const link = tarballDist.replace(`https://registry.npmjs.org/`, config.base);
|
|
82
|
+
dispatch.download.getTarball({ link });
|
|
83
|
+
},
|
|
84
|
+
[dispatch, config]
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
const renderVersionInfo = (): React.ReactNode =>
|
|
88
|
+
version && (
|
|
89
|
+
<OverviewItem>
|
|
90
|
+
<StyledVersion />
|
|
91
|
+
{t('package.version', { version })}
|
|
92
|
+
</OverviewItem>
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
const renderAuthorInfo = (): React.ReactNode => {
|
|
96
|
+
const name = getAuthorName(authorName);
|
|
97
|
+
return (
|
|
98
|
+
<Author>
|
|
99
|
+
<Avatar alt={name} src={authorAvatar} />
|
|
100
|
+
<Details>
|
|
101
|
+
<Text text={name} />
|
|
102
|
+
</Details>
|
|
103
|
+
</Author>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const renderFileSize = (): React.ReactNode =>
|
|
108
|
+
dist?.unpackedSize && (
|
|
109
|
+
<OverviewItem>
|
|
110
|
+
<StyledFileBinary />
|
|
111
|
+
{fileSizeSI(dist.unpackedSize)}
|
|
112
|
+
</OverviewItem>
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
const renderLicenseInfo = (): React.ReactNode =>
|
|
116
|
+
license && (
|
|
117
|
+
<OverviewItem>
|
|
118
|
+
<StyledLaw />
|
|
119
|
+
{license}
|
|
120
|
+
</OverviewItem>
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
const renderPublishedInfo = (): React.ReactNode =>
|
|
124
|
+
time && (
|
|
125
|
+
<OverviewItem>
|
|
126
|
+
<StyledTime />
|
|
127
|
+
<Published>{t('package.published-on', { time: formatDate(time) })}</Published>
|
|
128
|
+
{formatDateDistance(time)}
|
|
129
|
+
</OverviewItem>
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
const renderHomePageLink = (): React.ReactNode =>
|
|
133
|
+
homepage &&
|
|
134
|
+
isURL(homepage) && (
|
|
135
|
+
<Link external={true} to={homepage}>
|
|
136
|
+
<Tooltip aria-label={t('package.homepage')} title={t('package.visit-home-page')}>
|
|
137
|
+
<IconButton aria-label={t('package.homepage')}>
|
|
138
|
+
<HomeIcon />
|
|
139
|
+
</IconButton>
|
|
140
|
+
</Tooltip>
|
|
141
|
+
</Link>
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
const renderBugsLink = (): React.ReactNode =>
|
|
145
|
+
bugs?.url &&
|
|
146
|
+
isURL(bugs.url) && (
|
|
147
|
+
<Link external={true} to={bugs.url}>
|
|
148
|
+
<Tooltip aria-label={t('package.bugs')} title={t('package.open-an-issue')}>
|
|
149
|
+
<IconButton aria-label={t('package.bugs')}>
|
|
150
|
+
<BugReport />
|
|
151
|
+
</IconButton>
|
|
152
|
+
</Tooltip>
|
|
153
|
+
</Link>
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
const renderDownloadLink = (): React.ReactNode =>
|
|
157
|
+
dist?.tarball &&
|
|
158
|
+
isURL(dist.tarball) && (
|
|
159
|
+
// eslint-disable-next-line
|
|
160
|
+
<Link
|
|
161
|
+
external={true}
|
|
162
|
+
onClick={() => {
|
|
163
|
+
handleDownload(dist.tarball);
|
|
164
|
+
}}
|
|
165
|
+
to="#">
|
|
166
|
+
<Tooltip
|
|
167
|
+
aria-label={t('package.download', { what: t('package.the-tar-file') })}
|
|
168
|
+
title={t('package.tarball')}>
|
|
169
|
+
<IconButton aria-label={t('package.download')}>
|
|
170
|
+
<DownloadIcon />
|
|
171
|
+
</IconButton>
|
|
172
|
+
</Tooltip>
|
|
173
|
+
</Link>
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
const renderPrimaryComponent = (): React.ReactNode => {
|
|
177
|
+
return (
|
|
178
|
+
<Grid container={true} item={true} xs={12}>
|
|
179
|
+
<Grid item={true} xs={true}>
|
|
180
|
+
<WrapperLink to={`/-/web/detail/${packageName}`}>
|
|
181
|
+
<PackageTitle className="package-title">{packageName}</PackageTitle>
|
|
182
|
+
</WrapperLink>
|
|
183
|
+
</Grid>
|
|
184
|
+
<GridRightAligned
|
|
185
|
+
alignItems="center"
|
|
186
|
+
container={true}
|
|
187
|
+
item={true}
|
|
188
|
+
justify="flex-end"
|
|
189
|
+
xs={true}>
|
|
190
|
+
{renderHomePageLink()}
|
|
191
|
+
{renderBugsLink()}
|
|
192
|
+
{renderDownloadLink()}
|
|
193
|
+
</GridRightAligned>
|
|
194
|
+
</Grid>
|
|
195
|
+
);
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
const renderSecondaryComponent = (): React.ReactNode => {
|
|
199
|
+
const tags = keywords.sort().map((keyword, index) => <Tag key={index}>{keyword}</Tag>);
|
|
200
|
+
return (
|
|
201
|
+
<>
|
|
202
|
+
<Description>{description}</Description>
|
|
203
|
+
{tags.length > 0 && <TagContainer>{tags}</TagContainer>}
|
|
204
|
+
</>
|
|
205
|
+
);
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
const renderPackageListItemText = (): React.ReactNode => (
|
|
209
|
+
<PackageListItemText
|
|
210
|
+
className="package-link"
|
|
211
|
+
// @ts-ignore
|
|
212
|
+
component="div"
|
|
213
|
+
primary={renderPrimaryComponent()}
|
|
214
|
+
secondary={renderSecondaryComponent()}
|
|
215
|
+
/>
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
return (
|
|
219
|
+
<Wrapper className={'package'} data-testid="package-item-list">
|
|
220
|
+
<ListItem alignItems={'flex-start'}>{renderPackageListItemText()}</ListItem>
|
|
221
|
+
<ListItem alignItems={'flex-start'}>
|
|
222
|
+
{renderAuthorInfo()}
|
|
223
|
+
{renderVersionInfo()}
|
|
224
|
+
{renderPublishedInfo()}
|
|
225
|
+
{renderFileSize()}
|
|
226
|
+
{renderLicenseInfo()}
|
|
227
|
+
</ListItem>
|
|
228
|
+
</Wrapper>
|
|
229
|
+
);
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
export default Package;
|
|
233
|
+
|
|
234
|
+
const iconStyle = ({ theme }: { theme: Theme }) => css`
|
|
235
|
+
margin: 2px 10px 0 0;
|
|
236
|
+
fill: ${theme?.palette.type === 'light' ? theme?.palette.greyLight2 : theme?.palette.white};
|
|
237
|
+
`;
|
|
238
|
+
|
|
239
|
+
const StyledVersion = styled(Version)`
|
|
240
|
+
${iconStyle};
|
|
241
|
+
`;
|
|
242
|
+
|
|
243
|
+
const StyledFileBinary = styled(FileBinary)`
|
|
244
|
+
${iconStyle};
|
|
245
|
+
`;
|
|
246
|
+
|
|
247
|
+
const StyledLaw = styled(Law)`
|
|
248
|
+
${iconStyle};
|
|
249
|
+
`;
|
|
250
|
+
|
|
251
|
+
const StyledTime = styled(Time)`
|
|
252
|
+
${iconStyle};
|
|
253
|
+
`;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { render } from 'verdaccio-ui/utils/test-react-testing-library';
|
|
4
|
+
|
|
5
|
+
import Tag from './Tag';
|
|
6
|
+
|
|
7
|
+
describe('<Tag /> component', () => {
|
|
8
|
+
test('should load the component in default state', () => {
|
|
9
|
+
const { container } = render(
|
|
10
|
+
<Tag>
|
|
11
|
+
<span>{'I am a child'}</span>
|
|
12
|
+
</Tag>
|
|
13
|
+
);
|
|
14
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<Tag /> component should load the component in default state 1`] = `
|
|
4
|
+
.emotion-0 {
|
|
5
|
+
vertical-align: middle;
|
|
6
|
+
line-height: 22px;
|
|
7
|
+
border-radius: 2px;
|
|
8
|
+
color: #485a3e;
|
|
9
|
+
background-color: #f3f4f2;
|
|
10
|
+
padding: 0.22rem 0.4rem;
|
|
11
|
+
margin: 8px 8px 0 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
<span
|
|
15
|
+
class="emotion-0 emotion-1"
|
|
16
|
+
>
|
|
17
|
+
<span>
|
|
18
|
+
I am a child
|
|
19
|
+
</span>
|
|
20
|
+
</span>
|
|
21
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Tag';
|