@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,152 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BrowserRouter as Router } from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
renderWithStore,
|
|
6
|
+
fireEvent,
|
|
7
|
+
waitFor,
|
|
8
|
+
cleanup,
|
|
9
|
+
screen,
|
|
10
|
+
waitForElementToBeRemoved,
|
|
11
|
+
} from 'verdaccio-ui/utils/test-react-testing-library';
|
|
12
|
+
|
|
13
|
+
import translationEN from '../../i18n/crowdin/ui.json';
|
|
14
|
+
import { store } from '../../store';
|
|
15
|
+
|
|
16
|
+
import Header from './Header';
|
|
17
|
+
|
|
18
|
+
/* eslint-disable react/jsx-no-bind*/
|
|
19
|
+
describe('<Header /> component with logged in state', () => {
|
|
20
|
+
afterEach(cleanup);
|
|
21
|
+
|
|
22
|
+
test('should load the component in logged out state', () => {
|
|
23
|
+
renderWithStore(
|
|
24
|
+
<Router>
|
|
25
|
+
<Header />
|
|
26
|
+
</Router>,
|
|
27
|
+
store
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
expect(screen.queryByTestId('logInDialogIcon')).toBeNull();
|
|
31
|
+
expect(screen.getByText('Login')).toBeTruthy();
|
|
32
|
+
expect(screen.queryByTestId('header--button-login')).toBeInTheDocument();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test('should load the component in logged in state', async () => {
|
|
36
|
+
renderWithStore(
|
|
37
|
+
<Router>
|
|
38
|
+
<Header />
|
|
39
|
+
</Router>,
|
|
40
|
+
store
|
|
41
|
+
);
|
|
42
|
+
store.dispatch.login.logInUser({ username: 'store', token: '12345' });
|
|
43
|
+
|
|
44
|
+
await waitFor(() => {
|
|
45
|
+
expect(screen.getByTestId('logInDialogIcon')).toBeTruthy();
|
|
46
|
+
expect(screen.queryByText('Login')).toBeNull();
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test('should open login dialog', async () => {
|
|
51
|
+
renderWithStore(
|
|
52
|
+
<Router>
|
|
53
|
+
<Header />
|
|
54
|
+
</Router>,
|
|
55
|
+
store
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
store.dispatch.login.logOutUser();
|
|
59
|
+
|
|
60
|
+
const loginBtn = screen.getByTestId('header--button-login');
|
|
61
|
+
fireEvent.click(loginBtn);
|
|
62
|
+
const loginDialog = await waitFor(() => screen.getByTestId('login--dialog'));
|
|
63
|
+
expect(loginDialog).toBeTruthy();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test('should logout the user', async () => {
|
|
67
|
+
const { getByText, getByTestId } = renderWithStore(
|
|
68
|
+
<Router>
|
|
69
|
+
<Header />
|
|
70
|
+
</Router>,
|
|
71
|
+
store
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
store.dispatch.login.logInUser({ username: 'store', token: '12345' });
|
|
75
|
+
|
|
76
|
+
const headerMenuAccountCircle = getByTestId('logInDialogIcon');
|
|
77
|
+
fireEvent.click(headerMenuAccountCircle);
|
|
78
|
+
|
|
79
|
+
// wait for button Logout's appearance and return the element
|
|
80
|
+
const logoutBtn = await waitFor(() => getByText('Logout'));
|
|
81
|
+
fireEvent.click(logoutBtn);
|
|
82
|
+
expect(getByText('Login')).toBeTruthy();
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test("The question icon should open a new tab of verdaccio's website - installation doc", () => {
|
|
86
|
+
const { getByTestId } = renderWithStore(
|
|
87
|
+
<Router>
|
|
88
|
+
<Header />
|
|
89
|
+
</Router>,
|
|
90
|
+
store
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
const documentationBtn = getByTestId('header--tooltip-documentation');
|
|
94
|
+
expect(documentationBtn.getAttribute('href')).toBe(
|
|
95
|
+
'https://verdaccio.org/docs/en/installation'
|
|
96
|
+
);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
test('should open the registrationInfo modal when clicking on the info icon', async () => {
|
|
100
|
+
const { getByTestId } = renderWithStore(
|
|
101
|
+
<Router>
|
|
102
|
+
<Header />
|
|
103
|
+
</Router>,
|
|
104
|
+
store
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
const infoBtn = getByTestId('header--tooltip-info');
|
|
108
|
+
fireEvent.click(infoBtn);
|
|
109
|
+
|
|
110
|
+
// wait for registrationInfo modal appearance and return the element
|
|
111
|
+
const registrationInfoModal = await waitFor(() => getByTestId('registryInfo--dialog'));
|
|
112
|
+
expect(registrationInfoModal).toBeTruthy();
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
test('should close the registrationInfo modal when clicking on the button close', async () => {
|
|
116
|
+
const { getByTestId, getByText, queryByTestId } = renderWithStore(
|
|
117
|
+
<Router>
|
|
118
|
+
<Header />
|
|
119
|
+
</Router>,
|
|
120
|
+
store
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
const infoBtn = getByTestId('header--tooltip-info');
|
|
124
|
+
fireEvent.click(infoBtn);
|
|
125
|
+
|
|
126
|
+
// wait for Close's button of registrationInfo modal appearance and return the element
|
|
127
|
+
const closeBtn = await waitFor(() => getByText(translationEN.button.close));
|
|
128
|
+
fireEvent.click(closeBtn);
|
|
129
|
+
|
|
130
|
+
const hasRegistrationInfoModalBeenRemoved = await waitForElementToBeRemoved(() =>
|
|
131
|
+
queryByTestId('registryInfo--dialog')
|
|
132
|
+
);
|
|
133
|
+
expect(hasRegistrationInfoModalBeenRemoved).not.toBeDefined();
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
test('should hide login if is disabled', () => {
|
|
137
|
+
window.__VERDACCIO_BASENAME_UI_OPTIONS = {
|
|
138
|
+
base: 'foo',
|
|
139
|
+
login: false,
|
|
140
|
+
};
|
|
141
|
+
renderWithStore(
|
|
142
|
+
<Router>
|
|
143
|
+
<Header />
|
|
144
|
+
</Router>,
|
|
145
|
+
store
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
expect(screen.queryByTestId('header--button-login')).not.toBeInTheDocument();
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
test.todo('autocompletion should display suggestions according to the type value');
|
|
152
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { useDispatch, useSelector } from 'react-redux';
|
|
4
|
+
|
|
5
|
+
import Button from 'verdaccio-ui/components/Button';
|
|
6
|
+
import { useConfig } from 'verdaccio-ui/providers/config';
|
|
7
|
+
|
|
8
|
+
import { Dispatch, RootState } from '../../store/store';
|
|
9
|
+
|
|
10
|
+
import HeaderInfoDialog from './HeaderInfoDialog';
|
|
11
|
+
import HeaderLeft from './HeaderLeft';
|
|
12
|
+
import HeaderRight from './HeaderRight';
|
|
13
|
+
import LoginDialog from './LoginDialog';
|
|
14
|
+
import Search from './Search';
|
|
15
|
+
import { NavBar, InnerNavBar, MobileNavBar, InnerMobileNavBar } from './styles';
|
|
16
|
+
|
|
17
|
+
interface Props {
|
|
18
|
+
withoutSearch?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* eslint-disable react/jsx-no-bind*/
|
|
22
|
+
const Header: React.FC<Props> = ({ withoutSearch }) => {
|
|
23
|
+
const { t } = useTranslation();
|
|
24
|
+
const [isInfoDialogOpen, setOpenInfoDialog] = useState<boolean>(false);
|
|
25
|
+
const [showMobileNavBar, setShowMobileNavBar] = useState<boolean>(false);
|
|
26
|
+
const [showLoginModal, setShowLoginModal] = useState<boolean>(false);
|
|
27
|
+
const loginStore = useSelector((state: RootState) => state.login);
|
|
28
|
+
const configStore = useSelector((state: RootState) => state.configuration);
|
|
29
|
+
const { configOptions } = useConfig();
|
|
30
|
+
const dispatch = useDispatch<Dispatch>();
|
|
31
|
+
const handleLogout = () => {
|
|
32
|
+
dispatch.login.logOutUser();
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<>
|
|
37
|
+
<NavBar data-testid="header" position="static">
|
|
38
|
+
<InnerNavBar>
|
|
39
|
+
<HeaderLeft />
|
|
40
|
+
<HeaderRight
|
|
41
|
+
hasLogin={configOptions?.login}
|
|
42
|
+
onLogout={handleLogout}
|
|
43
|
+
onOpenRegistryInfoDialog={() => setOpenInfoDialog(true)}
|
|
44
|
+
onToggleLogin={() => setShowLoginModal(!showLoginModal)}
|
|
45
|
+
onToggleMobileNav={() => setShowMobileNavBar(!showMobileNavBar)}
|
|
46
|
+
username={loginStore?.username}
|
|
47
|
+
withoutSearch={withoutSearch}
|
|
48
|
+
/>
|
|
49
|
+
</InnerNavBar>
|
|
50
|
+
<HeaderInfoDialog
|
|
51
|
+
isOpen={isInfoDialogOpen}
|
|
52
|
+
onCloseDialog={() => setOpenInfoDialog(false)}
|
|
53
|
+
registryUrl={configOptions.base}
|
|
54
|
+
scope={configStore.scope}
|
|
55
|
+
/>
|
|
56
|
+
</NavBar>
|
|
57
|
+
{showMobileNavBar && !withoutSearch && (
|
|
58
|
+
<MobileNavBar>
|
|
59
|
+
<InnerMobileNavBar>
|
|
60
|
+
<Search />
|
|
61
|
+
</InnerMobileNavBar>
|
|
62
|
+
<Button color="inherit" onClick={() => setShowMobileNavBar(false)}>
|
|
63
|
+
{t('button.cancel')}
|
|
64
|
+
</Button>
|
|
65
|
+
</MobileNavBar>
|
|
66
|
+
)}
|
|
67
|
+
{!loginStore.user && (
|
|
68
|
+
<LoginDialog onClose={() => setShowLoginModal(false)} open={showLoginModal} />
|
|
69
|
+
)}
|
|
70
|
+
</>
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export default Header;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
|
|
4
|
+
import Label from 'verdaccio-ui/components/Label';
|
|
5
|
+
|
|
6
|
+
import { Greetings } from './styles';
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
username: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const HeaderGreetings: React.FC<Props> = ({ username }) => {
|
|
13
|
+
const { t } = useTranslation();
|
|
14
|
+
return (
|
|
15
|
+
<>
|
|
16
|
+
<Greetings>{t('header.greetings')}</Greetings>
|
|
17
|
+
<Label data-testid="greetings-label" text={username} weight="bold" />
|
|
18
|
+
</>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default HeaderGreetings;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import RegistryInfoContent from './RegistryInfoContent';
|
|
4
|
+
import RegistryInfoDialog from './RegistryInfoDialog';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
isOpen: boolean;
|
|
8
|
+
onCloseDialog: () => void;
|
|
9
|
+
registryUrl: string;
|
|
10
|
+
scope: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const HeaderInfoDialog: React.FC<Props> = ({ onCloseDialog, isOpen, registryUrl, scope }) => (
|
|
14
|
+
<RegistryInfoDialog onClose={onCloseDialog} open={isOpen}>
|
|
15
|
+
<RegistryInfoContent registryUrl={registryUrl} scope={scope} />
|
|
16
|
+
</RegistryInfoDialog>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export default HeaderInfoDialog;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Link } from 'react-router-dom';
|
|
4
|
+
|
|
5
|
+
import Logo from 'verdaccio-ui/components/Logo';
|
|
6
|
+
|
|
7
|
+
import Search from './Search';
|
|
8
|
+
import { LeftSide, SearchWrapper } from './styles';
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
withoutSearch?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const StyledLink = styled(Link)({
|
|
15
|
+
marginRight: '1em',
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const HeaderLeft: React.FC<Props> = ({ withoutSearch = false }) => (
|
|
19
|
+
<LeftSide>
|
|
20
|
+
<StyledLink to={'/'}>
|
|
21
|
+
<Logo />
|
|
22
|
+
</StyledLink>
|
|
23
|
+
{!withoutSearch && (
|
|
24
|
+
<SearchWrapper>
|
|
25
|
+
<Search />
|
|
26
|
+
</SearchWrapper>
|
|
27
|
+
)}
|
|
28
|
+
</LeftSide>
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
export default HeaderLeft;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import AccountCircle from '@material-ui/icons/AccountCircle';
|
|
2
|
+
import React, { MouseEvent } from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
|
|
5
|
+
import IconButton from 'verdaccio-ui/components/IconButton';
|
|
6
|
+
import Menu from 'verdaccio-ui/components/Menu';
|
|
7
|
+
import MenuItem from 'verdaccio-ui/components/MenuItem';
|
|
8
|
+
|
|
9
|
+
import HeaderGreetings from './HeaderGreetings';
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
username: string;
|
|
13
|
+
isMenuOpen: boolean;
|
|
14
|
+
anchorEl?: Element | ((element: Element) => Element) | null | undefined;
|
|
15
|
+
onLogout: () => void;
|
|
16
|
+
onLoggedInMenu: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
17
|
+
onLoggedInMenuClose: () => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const HeaderMenu: React.FC<Props> = ({
|
|
21
|
+
onLogout,
|
|
22
|
+
username,
|
|
23
|
+
isMenuOpen = false,
|
|
24
|
+
anchorEl,
|
|
25
|
+
onLoggedInMenu,
|
|
26
|
+
onLoggedInMenuClose,
|
|
27
|
+
}) => {
|
|
28
|
+
const { t } = useTranslation();
|
|
29
|
+
return (
|
|
30
|
+
<>
|
|
31
|
+
<IconButton
|
|
32
|
+
color="inherit"
|
|
33
|
+
data-testid="logInDialogIcon"
|
|
34
|
+
id="header--button-account"
|
|
35
|
+
onClick={onLoggedInMenu}>
|
|
36
|
+
<AccountCircle />
|
|
37
|
+
</IconButton>
|
|
38
|
+
<Menu
|
|
39
|
+
anchorEl={anchorEl}
|
|
40
|
+
anchorOrigin={{
|
|
41
|
+
vertical: 'top',
|
|
42
|
+
horizontal: 'right',
|
|
43
|
+
}}
|
|
44
|
+
onClose={onLoggedInMenuClose}
|
|
45
|
+
open={isMenuOpen}
|
|
46
|
+
transformOrigin={{
|
|
47
|
+
vertical: 'top',
|
|
48
|
+
horizontal: 'right',
|
|
49
|
+
}}>
|
|
50
|
+
<MenuItem>
|
|
51
|
+
<HeaderGreetings username={username} />
|
|
52
|
+
</MenuItem>
|
|
53
|
+
<MenuItem
|
|
54
|
+
button={true}
|
|
55
|
+
data-testid="logOutDialogIcon"
|
|
56
|
+
id="logOutDialogIcon"
|
|
57
|
+
onClick={onLogout}>
|
|
58
|
+
{t('button.logout')}
|
|
59
|
+
</MenuItem>
|
|
60
|
+
</Menu>
|
|
61
|
+
</>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export default HeaderMenu;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import React, { useState, useEffect, useContext, MouseEvent } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
|
|
4
|
+
import Button from 'verdaccio-ui/components/Button';
|
|
5
|
+
import ThemeContext from 'verdaccio-ui/design-tokens/ThemeContext';
|
|
6
|
+
|
|
7
|
+
import HeaderMenu from './HeaderMenu';
|
|
8
|
+
import HeaderToolTip from './HeaderToolTip';
|
|
9
|
+
import LanguageSwitch from './LanguageSwitch';
|
|
10
|
+
import { RightSide } from './styles';
|
|
11
|
+
|
|
12
|
+
interface Props {
|
|
13
|
+
withoutSearch?: boolean;
|
|
14
|
+
username?: string | null;
|
|
15
|
+
hasLogin?: boolean;
|
|
16
|
+
onToggleLogin: () => void;
|
|
17
|
+
onOpenRegistryInfoDialog: () => void;
|
|
18
|
+
onToggleMobileNav: () => void;
|
|
19
|
+
onLogout: () => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const HeaderRight: React.FC<Props> = ({
|
|
23
|
+
withoutSearch = false,
|
|
24
|
+
username,
|
|
25
|
+
onToggleLogin,
|
|
26
|
+
hasLogin,
|
|
27
|
+
onLogout,
|
|
28
|
+
onToggleMobileNav,
|
|
29
|
+
onOpenRegistryInfoDialog,
|
|
30
|
+
}) => {
|
|
31
|
+
const themeContext = useContext(ThemeContext);
|
|
32
|
+
const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);
|
|
33
|
+
const [isMenuOpen, setIsMenuOpen] = useState<boolean>(false);
|
|
34
|
+
const hideLoginSection = hasLogin === false;
|
|
35
|
+
|
|
36
|
+
const { t } = useTranslation();
|
|
37
|
+
|
|
38
|
+
if (!themeContext) {
|
|
39
|
+
throw Error(t('theme-context-not-correct-used'));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
setIsMenuOpen(Boolean(anchorEl));
|
|
44
|
+
}, [anchorEl]);
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* opens popover menu for logged in user.
|
|
48
|
+
*/
|
|
49
|
+
const handleLoggedInMenu = (event: MouseEvent<HTMLButtonElement>) => {
|
|
50
|
+
setAnchorEl(event.currentTarget);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* closes popover menu for logged in user
|
|
55
|
+
*/
|
|
56
|
+
const handleLoggedInMenuClose = () => {
|
|
57
|
+
setAnchorEl(null);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* close/open popover menu for logged in users.
|
|
62
|
+
*/
|
|
63
|
+
const handleToggleLogin = () => {
|
|
64
|
+
setAnchorEl(null);
|
|
65
|
+
onToggleLogin();
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const handleToggleDarkLightMode = () => {
|
|
69
|
+
setTimeout(() => {
|
|
70
|
+
themeContext.setIsDarkMode(!themeContext.isDarkMode);
|
|
71
|
+
}, 300);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<RightSide data-testid="header-right">
|
|
76
|
+
{!withoutSearch && (
|
|
77
|
+
<HeaderToolTip
|
|
78
|
+
onClick={onToggleMobileNav}
|
|
79
|
+
title={t('search.packages')}
|
|
80
|
+
tooltipIconType={'search'}
|
|
81
|
+
/>
|
|
82
|
+
)}
|
|
83
|
+
<LanguageSwitch />
|
|
84
|
+
<HeaderToolTip title={t('header.documentation')} tooltipIconType={'help'} />
|
|
85
|
+
<HeaderToolTip
|
|
86
|
+
onClick={onOpenRegistryInfoDialog}
|
|
87
|
+
title={t('header.registry-info')}
|
|
88
|
+
tooltipIconType={'info'}
|
|
89
|
+
/>
|
|
90
|
+
<HeaderToolTip
|
|
91
|
+
onClick={handleToggleDarkLightMode}
|
|
92
|
+
title={t('header.documentation')}
|
|
93
|
+
tooltipIconType={themeContext.isDarkMode ? 'dark-mode' : 'light-mode'}
|
|
94
|
+
/>
|
|
95
|
+
|
|
96
|
+
{!hideLoginSection && (
|
|
97
|
+
<>
|
|
98
|
+
{username ? (
|
|
99
|
+
<HeaderMenu
|
|
100
|
+
anchorEl={anchorEl}
|
|
101
|
+
isMenuOpen={isMenuOpen}
|
|
102
|
+
onLoggedInMenu={handleLoggedInMenu}
|
|
103
|
+
onLoggedInMenuClose={handleLoggedInMenuClose}
|
|
104
|
+
onLogout={onLogout}
|
|
105
|
+
username={username}
|
|
106
|
+
/>
|
|
107
|
+
) : (
|
|
108
|
+
<Button color="inherit" data-testid="header--button-login" onClick={handleToggleLogin}>
|
|
109
|
+
{t('button.login')}
|
|
110
|
+
</Button>
|
|
111
|
+
)}
|
|
112
|
+
</>
|
|
113
|
+
)}
|
|
114
|
+
</RightSide>
|
|
115
|
+
);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export default HeaderRight;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import Tooltip from 'verdaccio-ui/components/Tooltip';
|
|
4
|
+
|
|
5
|
+
import HeaderToolTipIcon, { TooltipIconType } from './HeaderToolTipIcon';
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
title: string;
|
|
9
|
+
tooltipIconType: TooltipIconType;
|
|
10
|
+
onClick?: () => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const HeaderToolTip: React.FC<Props> = ({ tooltipIconType, title, onClick }) => (
|
|
14
|
+
<Tooltip disableFocusListener={true} title={title}>
|
|
15
|
+
<HeaderToolTipIcon onClick={onClick} tooltipIconType={tooltipIconType} />
|
|
16
|
+
</Tooltip>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export default HeaderToolTip;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import Help from '@material-ui/icons/Help';
|
|
2
|
+
import Info from '@material-ui/icons/Info';
|
|
3
|
+
import NightsStay from '@material-ui/icons/NightsStay';
|
|
4
|
+
import Search from '@material-ui/icons/Search';
|
|
5
|
+
import WbSunny from '@material-ui/icons/WbSunny';
|
|
6
|
+
import React, { forwardRef } from 'react';
|
|
7
|
+
|
|
8
|
+
import IconButton from 'verdaccio-ui/components/IconButton';
|
|
9
|
+
|
|
10
|
+
import { IconSearchButton, StyledLink } from './styles';
|
|
11
|
+
|
|
12
|
+
export type TooltipIconType = 'search' | 'help' | 'info' | 'dark-mode' | 'light-mode';
|
|
13
|
+
interface Props {
|
|
14
|
+
tooltipIconType: TooltipIconType;
|
|
15
|
+
onClick?: () => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type HeaderToolTipIconRef = HTMLButtonElement;
|
|
19
|
+
|
|
20
|
+
/* eslint-disable react/jsx-no-undef */
|
|
21
|
+
/* eslint-disable react/display-name */
|
|
22
|
+
const HeaderToolTipIcon = forwardRef<HeaderToolTipIconRef, Props>(function HeaderToolTipIcon(
|
|
23
|
+
{ tooltipIconType, onClick },
|
|
24
|
+
ref
|
|
25
|
+
) {
|
|
26
|
+
switch (tooltipIconType) {
|
|
27
|
+
case 'help':
|
|
28
|
+
return (
|
|
29
|
+
<StyledLink
|
|
30
|
+
data-testid={'header--tooltip-documentation'}
|
|
31
|
+
external={true}
|
|
32
|
+
to={'https://verdaccio.org/docs/en/installation'}>
|
|
33
|
+
<IconButton color={'inherit'}>
|
|
34
|
+
<Help />
|
|
35
|
+
</IconButton>
|
|
36
|
+
</StyledLink>
|
|
37
|
+
);
|
|
38
|
+
case 'info':
|
|
39
|
+
return (
|
|
40
|
+
<IconButton
|
|
41
|
+
color="inherit"
|
|
42
|
+
data-testid={'header--tooltip-info'}
|
|
43
|
+
id="header--button-registryInfo"
|
|
44
|
+
onClick={onClick}
|
|
45
|
+
ref={ref}>
|
|
46
|
+
<Info />
|
|
47
|
+
</IconButton>
|
|
48
|
+
);
|
|
49
|
+
case 'search':
|
|
50
|
+
return (
|
|
51
|
+
<IconSearchButton color="inherit" onClick={onClick}>
|
|
52
|
+
<Search />
|
|
53
|
+
</IconSearchButton>
|
|
54
|
+
);
|
|
55
|
+
case 'dark-mode':
|
|
56
|
+
// todo(Priscila): Add Zoom transition effect
|
|
57
|
+
return (
|
|
58
|
+
<IconButton color="inherit" onClick={onClick} ref={ref}>
|
|
59
|
+
<NightsStay />
|
|
60
|
+
</IconButton>
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
case 'light-mode':
|
|
64
|
+
// todo(Priscila): Add Zoom transition effect
|
|
65
|
+
return (
|
|
66
|
+
<IconButton color="inherit" onClick={onClick} ref={ref}>
|
|
67
|
+
<WbSunny />
|
|
68
|
+
</IconButton>
|
|
69
|
+
);
|
|
70
|
+
default:
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
export default HeaderToolTipIcon;
|