@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,125 @@
|
|
|
1
|
+
/* eslint-disable react/jsx-pascal-case */
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
import { withStyles } from '@material-ui/core/styles';
|
|
4
|
+
import LanguageIcon from '@material-ui/icons/Language';
|
|
5
|
+
import i18next from 'i18next';
|
|
6
|
+
import React, { useCallback, useContext, useState, useMemo } from 'react';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
|
|
9
|
+
import { AutoComplete } from 'verdaccio-ui/components/AutoComplete/AutoCompleteV2';
|
|
10
|
+
import MenuItem from 'verdaccio-ui/components/MenuItem';
|
|
11
|
+
import { Theme } from 'verdaccio-ui/design-tokens/theme';
|
|
12
|
+
import ThemeContext from 'verdaccio-ui/design-tokens/ThemeContext';
|
|
13
|
+
|
|
14
|
+
import { Language, listLanguages } from '../../i18n/enabledLanguages';
|
|
15
|
+
|
|
16
|
+
const listConverted = listLanguages.reduce((prev, item) => {
|
|
17
|
+
prev[item.lng] = {
|
|
18
|
+
translation: item.menuKey,
|
|
19
|
+
icon: item.icon,
|
|
20
|
+
};
|
|
21
|
+
return prev;
|
|
22
|
+
}, {});
|
|
23
|
+
|
|
24
|
+
const LanguageSwitch = () => {
|
|
25
|
+
const themeContext = useContext(ThemeContext);
|
|
26
|
+
const [languages] = useState<Language[]>(
|
|
27
|
+
Object.keys(i18next.options?.resources || {}) as Language[]
|
|
28
|
+
);
|
|
29
|
+
const { t } = useTranslation();
|
|
30
|
+
|
|
31
|
+
if (!themeContext) {
|
|
32
|
+
throw Error(t('theme-context-not-correct-used'));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const currentLanguage = themeContext.language;
|
|
36
|
+
|
|
37
|
+
const switchLanguage = useCallback(
|
|
38
|
+
({ language }: { language: Language }) => {
|
|
39
|
+
themeContext.setLanguage(language);
|
|
40
|
+
},
|
|
41
|
+
[themeContext]
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const getCurrentLngDetails = useCallback(
|
|
45
|
+
(language: Language) => {
|
|
46
|
+
const lng = listConverted[language] || listConverted['en-US'];
|
|
47
|
+
return {
|
|
48
|
+
icon: <lng.icon />,
|
|
49
|
+
translation: t(lng.translation),
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
[t]
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const options = useMemo(
|
|
56
|
+
() =>
|
|
57
|
+
languages.map((language) => {
|
|
58
|
+
const { icon, translation } = getCurrentLngDetails(language);
|
|
59
|
+
return {
|
|
60
|
+
language,
|
|
61
|
+
icon,
|
|
62
|
+
translation,
|
|
63
|
+
};
|
|
64
|
+
}),
|
|
65
|
+
[languages, getCurrentLngDetails]
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
const option = useCallback(
|
|
69
|
+
({ icon, translation }: ReturnType<typeof getCurrentLngDetails>) => (
|
|
70
|
+
<StyledMenuItem component="div">
|
|
71
|
+
{icon}
|
|
72
|
+
{translation}
|
|
73
|
+
</StyledMenuItem>
|
|
74
|
+
),
|
|
75
|
+
[]
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
const optionLabel = useCallback(
|
|
79
|
+
({ translation }: ReturnType<typeof getCurrentLngDetails>) => translation,
|
|
80
|
+
[]
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<Wrapper>
|
|
85
|
+
<AutoComplete
|
|
86
|
+
defaultValue={getCurrentLngDetails(currentLanguage).translation}
|
|
87
|
+
getOptionLabel={optionLabel}
|
|
88
|
+
hasClearIcon={true}
|
|
89
|
+
inputStartAdornment={<StyledLanguageIcon />}
|
|
90
|
+
onClick={switchLanguage}
|
|
91
|
+
options={options}
|
|
92
|
+
renderOption={option}
|
|
93
|
+
variant="outlined"
|
|
94
|
+
/>
|
|
95
|
+
</Wrapper>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export default LanguageSwitch;
|
|
100
|
+
|
|
101
|
+
const StyledLanguageIcon = styled(LanguageIcon)<{ theme?: Theme }>(({ theme }) => ({
|
|
102
|
+
color: theme?.palette.white,
|
|
103
|
+
}));
|
|
104
|
+
|
|
105
|
+
const Wrapper = styled('div')<{ theme?: Theme }>(({ theme }) => ({
|
|
106
|
+
width: 220,
|
|
107
|
+
display: 'none',
|
|
108
|
+
[`@media screen and (min-width: ${theme?.breakPoints.medium}px)`]: {
|
|
109
|
+
display: 'inline-block',
|
|
110
|
+
},
|
|
111
|
+
}));
|
|
112
|
+
|
|
113
|
+
const StyledMenuItem = withStyles((theme: Theme) => ({
|
|
114
|
+
root: {
|
|
115
|
+
display: 'grid',
|
|
116
|
+
cursor: 'pointer',
|
|
117
|
+
gridGap: theme?.spacing(0.5),
|
|
118
|
+
gridTemplateColumns: '20px 1fr',
|
|
119
|
+
alignItems: 'center',
|
|
120
|
+
'&:first-child': {
|
|
121
|
+
borderTopLeftRadius: 4,
|
|
122
|
+
borderTopRightRadius: 4,
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
}))(MenuItem);
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import api from 'verdaccio-ui/providers/API/api';
|
|
4
|
+
import {
|
|
5
|
+
renderWithStore,
|
|
6
|
+
waitFor,
|
|
7
|
+
fireEvent,
|
|
8
|
+
cleanup,
|
|
9
|
+
screen,
|
|
10
|
+
act,
|
|
11
|
+
} from 'verdaccio-ui/utils/test-react-testing-library';
|
|
12
|
+
|
|
13
|
+
import { store } from '../../../store';
|
|
14
|
+
|
|
15
|
+
import LoginDialog from './LoginDialog';
|
|
16
|
+
|
|
17
|
+
describe('<LoginDialog /> component', () => {
|
|
18
|
+
beforeEach(() => {
|
|
19
|
+
jest.resetModules();
|
|
20
|
+
jest.resetAllMocks();
|
|
21
|
+
cleanup();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test('should render the component in default state', () => {
|
|
25
|
+
const props = {
|
|
26
|
+
onClose: jest.fn(),
|
|
27
|
+
};
|
|
28
|
+
const { container } = renderWithStore(<LoginDialog onClose={props.onClose} />, store);
|
|
29
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('should load the component with the open prop', async () => {
|
|
33
|
+
const props = {
|
|
34
|
+
open: true,
|
|
35
|
+
onClose: jest.fn(),
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const { getByTestId } = renderWithStore(
|
|
39
|
+
<LoginDialog onClose={props.onClose} open={props.open} />,
|
|
40
|
+
store
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const loginDialogHeading = await waitFor(() => getByTestId('login-dialog-form-login-button'));
|
|
44
|
+
expect(loginDialogHeading).toBeTruthy();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test('onClose: should close the login modal', async () => {
|
|
48
|
+
const props = {
|
|
49
|
+
open: true,
|
|
50
|
+
onClose: jest.fn(),
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const { getByTestId } = renderWithStore(
|
|
54
|
+
<LoginDialog onClose={props.onClose} open={props.open} />,
|
|
55
|
+
store
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const loginDialogButton = await waitFor(() => getByTestId('close-login-dialog-button'));
|
|
59
|
+
expect(loginDialogButton).toBeTruthy();
|
|
60
|
+
|
|
61
|
+
await act(() => {
|
|
62
|
+
fireEvent.click(loginDialogButton, { open: false });
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
expect(props.onClose).toHaveBeenCalled();
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test('setCredentials - should set username and password in state', async () => {
|
|
69
|
+
const props = {
|
|
70
|
+
open: true,
|
|
71
|
+
onClose: jest.fn(),
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
jest.spyOn(api, 'request').mockImplementation(() =>
|
|
75
|
+
Promise.resolve({
|
|
76
|
+
username: 'xyz',
|
|
77
|
+
token: 'djsadaskljd',
|
|
78
|
+
})
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
await act(async () => {
|
|
82
|
+
renderWithStore(<LoginDialog onClose={props.onClose} open={props.open} />, store);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const userNameInput = screen.getByPlaceholderText('Your username');
|
|
86
|
+
expect(userNameInput).toBeInTheDocument();
|
|
87
|
+
|
|
88
|
+
fireEvent.focus(userNameInput);
|
|
89
|
+
|
|
90
|
+
fireEvent.change(userNameInput, { target: { value: 'xyz' } });
|
|
91
|
+
|
|
92
|
+
const passwordInput = screen.getByPlaceholderText('Your strong password');
|
|
93
|
+
expect(userNameInput).toBeInTheDocument();
|
|
94
|
+
fireEvent.focus(passwordInput);
|
|
95
|
+
|
|
96
|
+
await act(async () => {
|
|
97
|
+
fireEvent.change(passwordInput, { target: { value: '1234' } });
|
|
98
|
+
});
|
|
99
|
+
const signInButton = screen.getByTestId('login-dialog-form-login-button');
|
|
100
|
+
expect(signInButton).not.toBeDisabled();
|
|
101
|
+
|
|
102
|
+
await act(async () => {
|
|
103
|
+
fireEvent.click(signInButton);
|
|
104
|
+
});
|
|
105
|
+
expect(props.onClose).toHaveBeenCalledTimes(1);
|
|
106
|
+
// screen.debug();
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
test.todo('validateCredentials: should validate credentials');
|
|
110
|
+
|
|
111
|
+
test.todo('submitCredentials: should submit credentials');
|
|
112
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import i18next from 'i18next';
|
|
2
|
+
import isEmpty from 'lodash/isEmpty';
|
|
3
|
+
import React, { useEffect, useCallback } from 'react';
|
|
4
|
+
import { useDispatch, useSelector } from 'react-redux';
|
|
5
|
+
|
|
6
|
+
import Dialog from 'verdaccio-ui/components/Dialog';
|
|
7
|
+
import DialogContent from 'verdaccio-ui/components/DialogContent';
|
|
8
|
+
|
|
9
|
+
import { LoginBody } from '../../../store/models/login';
|
|
10
|
+
import { Dispatch, RootState } from '../../../store/store';
|
|
11
|
+
|
|
12
|
+
import LoginDialogCloseButton from './LoginDialogCloseButton';
|
|
13
|
+
import LoginDialogForm, { FormValues } from './LoginDialogForm';
|
|
14
|
+
import LoginDialogHeader from './LoginDialogHeader';
|
|
15
|
+
|
|
16
|
+
interface Props {
|
|
17
|
+
open?: boolean;
|
|
18
|
+
onClose: () => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const LoginDialog: React.FC<Props> = ({ onClose, open = false }) => {
|
|
22
|
+
const loginStore = useSelector((state: RootState) => state.login);
|
|
23
|
+
const dispatch = useDispatch<Dispatch>();
|
|
24
|
+
const makeLogin = useCallback(
|
|
25
|
+
async (username?: string, password?: string): Promise<LoginBody | void> => {
|
|
26
|
+
// checks isEmpty
|
|
27
|
+
if (isEmpty(username) || isEmpty(password)) {
|
|
28
|
+
dispatch.login.addError({
|
|
29
|
+
type: 'error',
|
|
30
|
+
description: i18next.t('form-validation.username-or-password-cant-be-empty'),
|
|
31
|
+
});
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
try {
|
|
36
|
+
dispatch.login.getUser({ username, password });
|
|
37
|
+
// const response: LoginBody = await doLogin(username as string, password as string);
|
|
38
|
+
dispatch.login.clearError();
|
|
39
|
+
} catch (e: any) {
|
|
40
|
+
dispatch.login.addError({
|
|
41
|
+
type: 'error',
|
|
42
|
+
description: i18next.t('form-validation.unable-to-sign-in'),
|
|
43
|
+
});
|
|
44
|
+
// eslint-disable-next-line no-console
|
|
45
|
+
console.error('login error', e.message);
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
[dispatch]
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
const handleDoLogin = useCallback(
|
|
52
|
+
async (data: FormValues) => {
|
|
53
|
+
await makeLogin(data.username, data.password);
|
|
54
|
+
},
|
|
55
|
+
[makeLogin]
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (loginStore.token && typeof loginStore.error === 'undefined') {
|
|
60
|
+
onClose();
|
|
61
|
+
}
|
|
62
|
+
}, [loginStore, onClose]);
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<Dialog
|
|
66
|
+
data-testid="login--dialog"
|
|
67
|
+
fullWidth={true}
|
|
68
|
+
id="login--dialog"
|
|
69
|
+
maxWidth="sm"
|
|
70
|
+
onClose={onClose}
|
|
71
|
+
open={open}>
|
|
72
|
+
<LoginDialogCloseButton onClose={onClose} />
|
|
73
|
+
<DialogContent>
|
|
74
|
+
<LoginDialogHeader />
|
|
75
|
+
<LoginDialogForm error={loginStore.error} onSubmit={handleDoLogin} />
|
|
76
|
+
</DialogContent>
|
|
77
|
+
</Dialog>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export default LoginDialog;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import CloseIcon from '@material-ui/icons/Close';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
|
|
6
|
+
import DialogTitle from 'verdaccio-ui/components/DialogTitle';
|
|
7
|
+
import IconButton from 'verdaccio-ui/components/IconButton';
|
|
8
|
+
import { Theme } from 'verdaccio-ui/design-tokens/theme';
|
|
9
|
+
|
|
10
|
+
const StyledIconButton = styled(IconButton)<{ theme?: Theme }>(({ theme }) => ({
|
|
11
|
+
position: 'absolute',
|
|
12
|
+
right: theme.spacing() / 2,
|
|
13
|
+
top: theme.spacing() / 2,
|
|
14
|
+
color: theme.palette.grey[500],
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
interface Props {
|
|
18
|
+
onClose: () => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const LoginDialogCloseButton: React.FC<Props> = ({ onClose }) => {
|
|
22
|
+
const { t } = useTranslation();
|
|
23
|
+
return (
|
|
24
|
+
<DialogTitle>
|
|
25
|
+
<StyledIconButton data-testid="close-login-dialog-button" onClick={onClose}>
|
|
26
|
+
<CloseIcon titleAccess={t('button.close')} />
|
|
27
|
+
</StyledIconButton>
|
|
28
|
+
</DialogTitle>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default LoginDialogCloseButton;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/* eslint-disable verdaccio/jsx-spread */
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
import React, { memo } from 'react';
|
|
4
|
+
import { useForm } from 'react-hook-form';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
|
|
7
|
+
import Button from 'verdaccio-ui/components/Button';
|
|
8
|
+
import TextField from 'verdaccio-ui/components/TextField';
|
|
9
|
+
import { Theme } from 'verdaccio-ui/design-tokens/theme';
|
|
10
|
+
import { LoginError } from 'verdaccio-ui/utils/login';
|
|
11
|
+
|
|
12
|
+
import LoginDialogFormError from './LoginDialogFormError';
|
|
13
|
+
|
|
14
|
+
const StyledForm = styled('form')<{ theme?: Theme }>(({ theme }) => ({
|
|
15
|
+
marginTop: theme.spacing(1),
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
const StyledButton = styled(Button)<{ theme?: Theme }>(({ theme }) => ({
|
|
19
|
+
margin: theme.spacing(3, 0, 2),
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
export interface FormValues {
|
|
23
|
+
username: string;
|
|
24
|
+
password: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface Props {
|
|
28
|
+
onSubmit: (formValues: FormValues) => void;
|
|
29
|
+
error?: LoginError;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const LoginDialogForm = memo(({ onSubmit, error }: Props) => {
|
|
33
|
+
const { t } = useTranslation();
|
|
34
|
+
const {
|
|
35
|
+
register,
|
|
36
|
+
handleSubmit,
|
|
37
|
+
formState: { isValid, errors },
|
|
38
|
+
} = useForm<FormValues>({ mode: 'onChange' });
|
|
39
|
+
|
|
40
|
+
const onSubmitForm = (formValues: FormValues) => {
|
|
41
|
+
onSubmit(formValues);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<StyledForm noValidate={true} onSubmit={handleSubmit(onSubmitForm)}>
|
|
46
|
+
<TextField
|
|
47
|
+
autoComplete="username"
|
|
48
|
+
error={!!errors.username}
|
|
49
|
+
fullWidth={true}
|
|
50
|
+
helperText={errors.username?.message}
|
|
51
|
+
id="login--dialog-username"
|
|
52
|
+
{...register('username', {
|
|
53
|
+
required: { value: true, message: t('form-validation.required-field') },
|
|
54
|
+
minLength: { value: 2, message: t('form-validation.required-min-length', { length: 2 }) },
|
|
55
|
+
})}
|
|
56
|
+
label={t('form.username')}
|
|
57
|
+
margin="normal"
|
|
58
|
+
name="username"
|
|
59
|
+
placeholder={t('form-placeholder.username')}
|
|
60
|
+
required={true}
|
|
61
|
+
variant="outlined"
|
|
62
|
+
/>
|
|
63
|
+
<TextField
|
|
64
|
+
autoComplete="current-password"
|
|
65
|
+
error={!!errors.password}
|
|
66
|
+
fullWidth={true}
|
|
67
|
+
helperText={errors.password?.message}
|
|
68
|
+
id="login--dialog-password"
|
|
69
|
+
{...register('password', {
|
|
70
|
+
required: { value: true, message: t('form-validation.required-field') },
|
|
71
|
+
minLength: { value: 2, message: t('form-validation.required-min-length', { length: 2 }) },
|
|
72
|
+
})}
|
|
73
|
+
label={t('form.password')}
|
|
74
|
+
margin="normal"
|
|
75
|
+
name="password"
|
|
76
|
+
placeholder={t('form-placeholder.password')}
|
|
77
|
+
required={true}
|
|
78
|
+
type="password"
|
|
79
|
+
variant="outlined"
|
|
80
|
+
/>
|
|
81
|
+
{error && <LoginDialogFormError error={error} />}
|
|
82
|
+
<StyledButton
|
|
83
|
+
color="primary"
|
|
84
|
+
data-testid="login-dialog-form-login-button"
|
|
85
|
+
disabled={!isValid}
|
|
86
|
+
fullWidth={true}
|
|
87
|
+
id="login--dialog-button-submit"
|
|
88
|
+
size="large"
|
|
89
|
+
type="submit"
|
|
90
|
+
variant="contained">
|
|
91
|
+
{t('button.login')}
|
|
92
|
+
</StyledButton>
|
|
93
|
+
</StyledForm>
|
|
94
|
+
);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
export default LoginDialogForm;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import Error from '@material-ui/icons/Error';
|
|
3
|
+
import React, { memo } from 'react';
|
|
4
|
+
|
|
5
|
+
import Box from 'verdaccio-ui/components/Box';
|
|
6
|
+
import SnackbarContent from 'verdaccio-ui/components/SnackbarContent';
|
|
7
|
+
import { Theme } from 'verdaccio-ui/design-tokens/theme';
|
|
8
|
+
import { LoginError } from 'verdaccio-ui/utils/login';
|
|
9
|
+
|
|
10
|
+
const StyledSnackbarContent = styled(SnackbarContent)<{ theme?: Theme }>(({ theme }) => ({
|
|
11
|
+
backgroundColor: theme?.palette.error.dark,
|
|
12
|
+
color: theme?.palette.white,
|
|
13
|
+
}));
|
|
14
|
+
|
|
15
|
+
const StyledErrorIcon = styled(Error)<{ theme?: Theme }>(({ theme }) => ({
|
|
16
|
+
fontSize: 20,
|
|
17
|
+
opacity: 0.9,
|
|
18
|
+
marginRight: theme?.spacing(1),
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
export interface FormValues {
|
|
22
|
+
username: string;
|
|
23
|
+
password: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface Props {
|
|
27
|
+
error: LoginError;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const LoginDialogFormError = memo(({ error }: Props) => {
|
|
31
|
+
return (
|
|
32
|
+
<StyledSnackbarContent
|
|
33
|
+
message={
|
|
34
|
+
<Box alignItems="center" display="flex">
|
|
35
|
+
<StyledErrorIcon />
|
|
36
|
+
{error.description}
|
|
37
|
+
</Box>
|
|
38
|
+
}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export default LoginDialogFormError;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import CloseIcon from '@material-ui/icons/Close';
|
|
3
|
+
import LockOutlined from '@material-ui/icons/LockOutlined';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
|
|
7
|
+
import Avatar from 'verdaccio-ui/components/Avatar';
|
|
8
|
+
import Box from 'verdaccio-ui/components/Box';
|
|
9
|
+
import Heading from 'verdaccio-ui/components/Heading';
|
|
10
|
+
import IconButton from 'verdaccio-ui/components/IconButton';
|
|
11
|
+
import { Theme } from 'verdaccio-ui/design-tokens/theme';
|
|
12
|
+
interface Props {
|
|
13
|
+
onClose?: () => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const LoginDialogHeader: React.FC<Props> = ({ onClose }) => {
|
|
17
|
+
const { t } = useTranslation();
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Box alignItems="center" display="flex" flexDirection="column" position="relative">
|
|
21
|
+
{onClose && (
|
|
22
|
+
<StyledIconButton aria-label={t('button.close')} onClick={onClose}>
|
|
23
|
+
<CloseIcon />
|
|
24
|
+
</StyledIconButton>
|
|
25
|
+
)}
|
|
26
|
+
<StyledAvatar>
|
|
27
|
+
<LockOutlined />
|
|
28
|
+
</StyledAvatar>
|
|
29
|
+
<Heading>{t('button.login')}</Heading>
|
|
30
|
+
</Box>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default LoginDialogHeader;
|
|
35
|
+
|
|
36
|
+
const StyledAvatar = styled(Avatar)<{ theme?: Theme }>(({ theme }) => ({
|
|
37
|
+
margin: theme?.spacing(1),
|
|
38
|
+
backgroundColor:
|
|
39
|
+
theme?.palette.type === 'light' ? theme?.palette.primary.main : theme?.palette.cyanBlue,
|
|
40
|
+
color: theme?.palette.white,
|
|
41
|
+
}));
|
|
42
|
+
|
|
43
|
+
const StyledIconButton = styled(IconButton)<{ theme?: Theme }>(({ theme }) => ({
|
|
44
|
+
position: 'absolute',
|
|
45
|
+
right: theme?.spacing() / 2,
|
|
46
|
+
top: theme?.spacing() / 2,
|
|
47
|
+
color: theme?.palette.grey[500],
|
|
48
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './LoginDialog';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { screen, render, cleanup } from 'verdaccio-ui/utils/test-react-testing-library';
|
|
4
|
+
|
|
5
|
+
import RegistryInfoContent from './RegistryInfoContent';
|
|
6
|
+
|
|
7
|
+
describe('<RegistryInfoContent /> component', () => {
|
|
8
|
+
afterEach(() => {
|
|
9
|
+
cleanup();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test('should load the component with no data', () => {
|
|
13
|
+
render(<RegistryInfoContent registryUrl={''} scope={''} />);
|
|
14
|
+
expect(screen.getByText('No configurations available')).toBeInTheDocument();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test('should load the appropiate tab content when the tab is clicked', () => {
|
|
18
|
+
const props = { registryUrl: 'http://localhost:4872', scope: '@' };
|
|
19
|
+
render(<RegistryInfoContent registryUrl={props.registryUrl} scope={props.scope} />);
|
|
20
|
+
|
|
21
|
+
expect(screen.getByText('pnpm set @:registry http://localhost:4872')).toBeInTheDocument();
|
|
22
|
+
expect(screen.getByText('pnpm adduser --registry http://localhost:4872')).toBeInTheDocument();
|
|
23
|
+
expect(
|
|
24
|
+
screen.getByText('pnpm profile set password --registry http://localhost:4872')
|
|
25
|
+
).toBeInTheDocument();
|
|
26
|
+
});
|
|
27
|
+
});
|