@verdaccio/ui-components 3.0.0-next.2 → 4.0.0-next-8.0
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/.eslintrc +1 -1
- package/CHANGELOG.md +85 -0
- package/build/AppTest/AppRoute.js +34 -0
- package/build/AppTest/pages/Front/Home.js +9 -0
- package/build/AppTest/pages/Front/index.js +14 -0
- package/build/AppTest/pages/Version/Version.js +34 -0
- package/build/AppTest/pages/Version/index.js +14 -0
- package/build/Theme/ResetStyles.js +2 -3
- package/build/Theme/StyleBaseline.js +2 -3
- package/build/Theme/ThemeProvider.js +3 -3
- package/build/Theme/colors.js +1 -2
- package/build/Theme/index.js +3 -3
- package/build/Theme/theme.js +17 -7
- package/build/__mocks__/react-markdown.js +1 -1
- package/build/components/ActionBar/ActionBar.js +8 -7
- package/build/components/ActionBar/ActionBarAction.js +13 -14
- package/build/components/ActionBar/index.js +1 -1
- package/build/components/Author/Author.js +15 -45
- package/build/components/Author/index.js +1 -1
- package/build/components/Author/styles.js +3 -5
- package/build/components/CopyClipboard/CopyToClipBoard.js +2 -3
- package/build/components/CopyClipboard/index.js +1 -1
- package/build/components/CopyClipboard/utils.js +3 -12
- package/build/components/Dependencies/Dependencies.js +31 -58
- package/build/components/Dependencies/DependencyBlock.js +102 -0
- package/build/components/Dependencies/index.js +1 -1
- package/build/components/Dependencies/utits.js +10 -0
- package/build/components/Deprecated/Deprecated.js +2 -3
- package/build/components/Deprecated/index.js +1 -1
- package/build/components/Developers/DeveloperType.js +12 -0
- package/build/components/Developers/Developers.js +26 -32
- package/build/components/Developers/Title.js +7 -13
- package/build/components/Developers/get-unique-developer-values.js +1 -2
- package/build/components/Developers/index.js +4 -4
- package/build/components/Distribution/Dist.js +3 -4
- package/build/components/Distribution/index.js +1 -1
- package/build/components/Distribution/styles.js +14 -31
- package/build/components/Engines/Engines.js +10 -5
- package/build/components/Engines/index.js +1 -1
- package/build/components/Engines/styles.js +9 -11
- package/build/components/ErrorBoundary/ErrorBoundary.js +2 -2
- package/build/components/ErrorBoundary/index.js +1 -1
- package/build/components/Forbidden/Forbidden.js +75 -0
- package/build/components/Forbidden/index.js +14 -0
- package/build/components/FundButton/FundButton.js +11 -13
- package/build/components/FundButton/index.js +1 -1
- package/build/components/HeaderInfoDialog/HeaderInfoDialog.js +5 -5
- package/build/components/HeaderInfoDialog/index.js +1 -1
- package/build/components/Heading/Heading.js +5 -6
- package/build/components/Heading/index.js +1 -1
- package/build/components/Help/Help.js +4 -5
- package/build/components/Help/index.js +1 -1
- package/build/components/Help/styles.js +2 -3
- package/build/components/Icons/DevsIcons/CommonJS.js +2 -13
- package/build/components/Icons/DevsIcons/ES6Module.js +3 -14
- package/build/components/Icons/DevsIcons/Git.js +2 -13
- package/build/components/Icons/DevsIcons/NodeJS.js +2 -13
- package/build/components/Icons/DevsIcons/TypeScript.js +2 -13
- package/build/components/Icons/Earth.js +3 -4
- package/build/components/Icons/FileBinary.js +14 -9
- package/build/components/Icons/Law.js +15 -10
- package/build/components/Icons/License.js +3 -4
- package/build/components/Icons/License.js.map +1 -1
- package/build/components/Icons/Managers/Npm.js +2 -13
- package/build/components/Icons/Managers/Pnpm.js +2 -13
- package/build/components/Icons/Managers/Yarn.js +2 -13
- package/build/components/Icons/SvgIcon.js +3 -4
- package/build/components/Icons/Time.js +3 -4
- package/build/components/Icons/Version.js +3 -4
- package/build/components/Install/Install.js +30 -26
- package/build/components/Install/InstallListItem.js +22 -23
- package/build/components/Install/index.js +1 -1
- package/build/components/Keywords/KeywordListItems.js +34 -0
- package/build/components/Keywords/Keywords.js +39 -0
- package/build/components/Keywords/index.js +14 -0
- package/build/components/Label/Label.js +3 -4
- package/build/components/Label/index.js +1 -1
- package/build/components/Link/Link.js +5 -19
- package/build/components/Link/index.js +2 -2
- package/build/components/LinkExternal/LinkExternal.js +32 -0
- package/build/components/LinkExternal/index.js +14 -0
- package/build/components/Loading/Loading.js +2 -3
- package/build/components/Loading/Spinner/Spinner.js +2 -3
- package/build/components/Loading/Spinner/index.js +1 -1
- package/build/components/Loading/index.js +1 -1
- package/build/components/Loading/styles.js +6 -7
- package/build/components/LoginDialog/LoginDialog.js +16 -6
- package/build/components/LoginDialog/LoginDialogCloseButton.js +5 -5
- package/build/components/LoginDialog/LoginDialogForm.js +7 -20
- package/build/components/LoginDialog/LoginDialogFormError.js +7 -7
- package/build/components/LoginDialog/LoginDialogHeader.js +2 -3
- package/build/components/LoginDialog/index.js +1 -1
- package/build/components/Logo/Logo.js +15 -9
- package/build/components/Logo/index.js +1 -1
- package/build/components/MenuItem/MenuItem.js +5 -6
- package/build/components/MenuItem/index.js +1 -1
- package/build/components/NoItems/NoItems.js +2 -3
- package/build/components/NoItems/index.js +1 -1
- package/build/components/NotFound/NotFound.js +20 -19
- package/build/components/NotFound/index.js +1 -1
- package/build/components/Package/Package.js +48 -40
- package/build/components/Package/index.js +2 -2
- package/build/components/Package/styles.js +59 -84
- package/build/components/PackageList/PackageList.js +2 -3
- package/build/components/PackageList/index.js +1 -1
- package/build/components/Person/Person.js +48 -0
- package/build/components/Person/PersonTooltip.js +22 -0
- package/build/components/Person/index.js +14 -0
- package/build/components/Person/utils.js +17 -0
- package/build/components/RawViewer/RawViewer.js +13 -8
- package/build/components/RawViewer/index.js +1 -1
- package/build/components/Readme/Readme.js +46 -11
- package/build/components/Readme/Readme.js.map +1 -1
- package/build/components/Readme/Readme.spec.js +20 -1
- package/build/components/Readme/Readme.spec.js.map +1 -1
- package/build/components/Readme/{github-markdown-dark.css → github-markdown.css} +266 -83
- package/build/components/Readme/index.js +1 -1
- package/build/components/Readme/utils.js +14 -17
- package/build/components/RegistryInfoDialog/RegistryInfoDialog.js +2 -3
- package/build/components/RegistryInfoDialog/index.js +1 -1
- package/build/components/RegistryInfoDialog/styles.js +13 -17
- package/build/components/Repository/Repository.js +23 -36
- package/build/components/Repository/index.js +1 -1
- package/build/components/Search/AutoComplete/AutoComplete.js +4 -5
- package/build/components/Search/AutoComplete/index.js +1 -1
- package/build/components/Search/AutoComplete/styles.js +6 -45
- package/build/components/Search/Search.js +11 -10
- package/build/components/Search/SearchItem.js +56 -45
- package/build/components/Search/index.js +1 -1
- package/build/components/Search/styles.js +3 -5
- package/build/components/Search/utils.js +23 -0
- package/build/components/SettingsMenu/SettingsMenu.js +36 -11
- package/build/components/SettingsMenu/index.js +1 -1
- package/build/components/SideBarTitle/SideBarTitle.js +104 -0
- package/build/components/SideBarTitle/index.js +14 -0
- package/build/components/{SideBarTittle → SideBarTitle}/utils.js +2 -3
- package/build/components/TextField/TextField.js +5 -6
- package/build/components/TextField/index.js +1 -1
- package/build/components/UpLinks/UpLinks.js +37 -9
- package/build/components/UpLinks/UplinkLink.js +22 -0
- package/build/components/UpLinks/index.js +1 -1
- package/build/components/UpLinks/styles.js +9 -11
- package/build/components/Versions/HistoryList.js +32 -26
- package/build/components/Versions/TagList.js +10 -7
- package/build/components/Versions/Versions.js +69 -16
- package/build/components/Versions/index.js +1 -1
- package/build/components/Versions/styles.js +3 -5
- package/build/hooks/index.js +1 -1
- package/build/hooks/useLocalStorage.js +1 -2
- package/build/hooks/useOnClickOutside.js +1 -2
- package/build/index.js +40 -8
- package/build/layouts/Version/Version.js +2 -3
- package/build/layouts/Version/index.js +1 -1
- package/build/providers/AppConfigurationProvider/AppConfigurationProvider.js +5 -5
- package/build/providers/AppConfigurationProvider/index.js +2 -2
- package/build/providers/PersistenceSettingProvider/PersistenceSettingProvider.js +5 -5
- package/build/providers/PersistenceSettingProvider/index.js +2 -2
- package/build/providers/TranslatorProvider/TranslatorProvider.js +4 -5
- package/build/providers/TranslatorProvider/TranslatorProvider.spec.js +3 -3
- package/build/providers/TranslatorProvider/index.js +2 -2
- package/build/providers/VersionProvider/VersionProvider.js +5 -7
- package/build/providers/VersionProvider/index.js +2 -2
- package/build/sections/Detail/ContainerContent.js +5 -7
- package/build/sections/Detail/Detail.js +13 -11
- package/build/sections/Detail/ReadmeSection.js +2 -3
- package/build/sections/Detail/Tabs.js +6 -8
- package/build/sections/Detail/index.js +1 -1
- package/build/sections/Footer/Footer.js +39 -11
- package/build/sections/Footer/index.js +1 -1
- package/build/sections/Footer/styles.js +19 -21
- package/build/sections/Header/Header.js +4 -5
- package/build/sections/Header/HeaderGreetings.js +2 -3
- package/build/sections/Header/HeaderLeft.js +16 -20
- package/build/sections/Header/HeaderMenu.js +3 -4
- package/build/sections/Header/HeaderRight.js +16 -8
- package/build/sections/Header/HeaderSettingsDialog.js +6 -10
- package/build/sections/Header/HeaderToolTip.js +2 -3
- package/build/sections/Header/HeaderToolTipIcon.js +4 -5
- package/build/sections/Header/LanguageSwitch.js +10 -13
- package/build/sections/Header/RegistryInfoContent/RegistryInfoContent.js +14 -24
- package/build/sections/Header/RegistryInfoContent/index.js +1 -1
- package/build/sections/Header/RegistryInfoContent/styles.js +3 -5
- package/build/sections/Header/index.js +1 -1
- package/build/sections/Header/styles.js +54 -106
- package/build/sections/Home/Home.js +4 -5
- package/build/sections/Home/index.js +1 -1
- package/build/sections/SideBar/Sidebar.js +23 -30
- package/build/sections/SideBar/index.js +1 -1
- package/build/sections/index.js +1 -1
- package/build/src/AppTest/App.stories.d.ts +8 -0
- package/build/src/AppTest/AppRoute.d.ts +3 -0
- package/build/src/AppTest/pages/Front/Home.d.ts +2 -0
- package/build/src/AppTest/pages/Front/index.d.ts +1 -0
- package/build/src/AppTest/pages/Version/Version.d.ts +3 -0
- package/build/src/AppTest/pages/Version/index.d.ts +1 -0
- package/build/src/Theme/ThemeProvider.test.d.ts +1 -0
- package/build/src/components/Author/Author.d.ts +0 -5
- package/build/src/components/CopyClipboard/CopyToClipBoard.test.d.ts +1 -0
- package/build/src/components/Dependencies/DependencyBlock.d.ts +16 -0
- package/build/src/components/Dependencies/DependencyBlock.test.d.ts +1 -0
- package/build/src/components/Dependencies/utits.d.ts +3 -0
- package/build/src/components/Developers/DeveloperType.d.ts +4 -0
- package/build/src/components/Developers/Developers.d.ts +1 -4
- package/build/src/components/Developers/Title.d.ts +1 -4
- package/build/src/components/Developers/index.d.ts +2 -1
- package/build/src/components/Distribution/styles.d.ts +0 -1
- package/build/src/components/ErrorBoundary/ErrorBoundary.test.d.ts +1 -0
- package/build/src/components/Forbidden/Forbidden.d.ts +3 -0
- package/build/src/components/Forbidden/Forbidden.test.d.ts +1 -0
- package/build/src/components/Forbidden/index.d.ts +1 -0
- package/build/src/components/HeaderInfoDialog/HeaderInfoDialog.test.d.ts +1 -0
- package/build/src/components/Heading/Heading.test.d.ts +1 -0
- package/build/src/components/Icons/Icons.test.d.ts +1 -0
- package/build/src/components/Install/InstallListItem.d.ts +1 -1
- package/build/src/components/Keywords/KeywordListItems.d.ts +5 -0
- package/build/src/components/Keywords/Keywords.d.ts +6 -0
- package/build/src/components/Keywords/Keywords.stories.d.ts +5 -0
- package/build/src/components/Keywords/Keywords.test.d.ts +1 -0
- package/build/src/components/Keywords/index.d.ts +1 -0
- package/build/src/components/Link/Link.d.ts +0 -3
- package/build/src/components/Link/Link.test.d.ts +1 -0
- package/build/src/components/Link/index.d.ts +1 -1
- package/build/src/components/LinkExternal/LinkExternal.d.ts +3 -0
- package/build/src/components/LinkExternal/LinkExternal.test.d.ts +1 -0
- package/build/src/components/LinkExternal/index.d.ts +1 -0
- package/build/src/components/Loading/styles.d.ts +2 -2
- package/build/src/components/Logo/Logo.d.ts +1 -0
- package/build/src/components/Logo/Logo.stories.d.ts +5 -0
- package/build/src/components/Package/Package.d.ts +1 -1
- package/build/src/components/Package/styles.d.ts +7 -15
- package/build/src/components/Person/Person.d.ts +9 -0
- package/build/src/components/Person/Person.test.d.ts +1 -0
- package/build/src/components/Person/PersonTooltip.d.ts +6 -0
- package/build/src/components/Person/index.d.ts +1 -0
- package/build/src/components/Person/utils.d.ts +3 -0
- package/build/src/components/Readme/Readme.d.ts +1 -1
- package/build/src/components/RegistryInfoDialog/styles.d.ts +1 -1
- package/build/src/components/Search/AutoComplete/styles.d.ts +1 -9
- package/build/src/components/Search/SearchItem.d.ts +1 -1
- package/build/src/components/Search/utils.d.ts +1 -0
- package/build/src/components/SettingsMenu/SettingsMenu.d.ts +2 -2
- package/build/src/components/SettingsMenu/SettingsMenu.test.d.ts +1 -0
- package/build/src/components/SideBarTitle/index.d.ts +1 -0
- package/build/src/components/UpLinks/UplinkLink.d.ts +6 -0
- package/build/src/components/UpLinks/styles.d.ts +2 -2
- package/build/src/components/Versions/Versions.d.ts +1 -0
- package/build/src/components/Versions/styles.d.ts +2 -2
- package/build/src/index.d.ts +6 -2
- package/build/src/sections/Detail/Detail.stories.d.ts +1 -0
- package/build/src/sections/Detail/Tabs.d.ts +1 -0
- package/build/src/sections/Footer/styles.d.ts +5 -5
- package/build/src/sections/Header/RegistryInfoContent/RegistryInfoContent.d.ts +3 -3
- package/build/src/sections/Header/RegistryInfoContent/styles.d.ts +2 -2
- package/build/src/sections/Header/styles.d.ts +4 -11
- package/build/src/sections/Home/Home.test.d.ts +1 -0
- package/build/src/store/models/manifest.d.ts +11 -0
- package/build/src/store/models/routes.d.ts +8 -0
- package/build/src/store/models/utils.d.ts +1 -0
- package/build/src/types/packageMeta.d.ts +7 -5
- package/build/src/utils/__partials__/packageMeta.d.ts +0 -1
- package/build/src/utils/routes.d.ts +1 -0
- package/build/src/utils/utils.d.ts +1 -0
- package/build/store/api.js +14 -9
- package/build/store/index.js +1 -1
- package/build/store/models/configuration.js +4 -4
- package/build/store/models/download.js +2 -3
- package/build/store/models/index.js +1 -2
- package/build/store/models/login.js +7 -7
- package/build/store/models/manifest.js +27 -8
- package/build/store/models/packages.js +6 -5
- package/build/store/models/routes.js +18 -0
- package/build/store/models/search.js +7 -6
- package/build/store/models/utils.js +10 -0
- package/build/store/storage.js +2 -3
- package/build/store/store.js +2 -3
- package/build/test/i18n-config.js +2 -3
- package/build/test/test-react-testing-library.js +1 -1
- package/build/utils/__partials__/packageMeta.js +1 -3
- package/build/utils/index.js +3 -3
- package/build/utils/loadable.js +2 -2
- package/build/utils/routes.js +2 -2
- package/build/utils/token.js +1 -1
- package/build/utils/url.js +1 -1
- package/build/utils/utils.js +22 -4
- package/package.json +33 -32
- package/src/AppTest/App.stories.tsx +32 -0
- package/src/AppTest/AppRoute.test.tsx +65 -0
- package/src/AppTest/AppRoute.tsx +42 -0
- package/src/AppTest/pages/Front/Home.ts +3 -0
- package/src/AppTest/pages/Front/index.ts +1 -0
- package/src/AppTest/pages/Version/Version.tsx +28 -0
- package/src/AppTest/pages/Version/index.ts +1 -0
- package/src/Theme/ThemeProvider.test.tsx +27 -0
- package/src/Theme/theme.ts +12 -5
- package/src/components/ActionBar/ActionBar.test.tsx +36 -15
- package/src/components/ActionBar/ActionBar.tsx +1 -1
- package/src/components/ActionBar/ActionBarAction.tsx +8 -5
- package/src/components/Author/Author.test.tsx +7 -1
- package/src/components/Author/Author.tsx +3 -41
- package/src/components/CopyClipboard/CopyToClipBoard.test.tsx +23 -0
- package/src/components/CopyClipboard/utils.ts +2 -13
- package/src/components/Dependencies/Dependencies.stories.tsx +11 -11
- package/src/components/Dependencies/Dependencies.test.tsx +1 -11
- package/src/components/Dependencies/Dependencies.tsx +30 -69
- package/src/components/Dependencies/DependencyBlock.test.tsx +46 -0
- package/src/components/Dependencies/DependencyBlock.tsx +83 -0
- package/src/components/Dependencies/utits.ts +3 -0
- package/src/components/Developers/DeveloperType.tsx +4 -0
- package/src/components/Developers/Developers.test.tsx +37 -10
- package/src/components/Developers/Developers.tsx +13 -13
- package/src/components/Developers/Title.tsx +1 -5
- package/src/components/Developers/index.ts +2 -1
- package/src/components/Distribution/Dist.test.tsx +1 -1
- package/src/components/Distribution/Dist.tsx +2 -4
- package/src/components/Distribution/styles.ts +0 -6
- package/src/components/Engines/Engines.tsx +6 -2
- package/src/components/Engines/styles.ts +1 -1
- package/src/components/ErrorBoundary/ErrorBoundary.test.tsx +39 -0
- package/src/components/Forbidden/Forbidden.test.tsx +38 -0
- package/src/components/Forbidden/Forbidden.tsx +56 -0
- package/src/components/Forbidden/index.ts +1 -0
- package/src/components/FundButton/FundButton.tsx +5 -5
- package/src/components/HeaderInfoDialog/HeaderInfoDialog.test.tsx +51 -0
- package/src/components/HeaderInfoDialog/HeaderInfoDialog.tsx +2 -2
- package/src/components/Heading/Heading.test.tsx +20 -0
- package/src/components/Help/Help.test.tsx +10 -3
- package/src/components/Icons/DevsIcons/CommonJS.tsx +1 -7
- package/src/components/Icons/DevsIcons/ES6Module.tsx +2 -8
- package/src/components/Icons/DevsIcons/Git.tsx +1 -7
- package/src/components/Icons/DevsIcons/NodeJS.tsx +1 -7
- package/src/components/Icons/DevsIcons/TypeScript.tsx +1 -7
- package/src/components/Icons/FileBinary.tsx +2 -1
- package/src/components/Icons/Icons.stories.tsx +21 -5
- package/src/components/Icons/Icons.test.tsx +70 -0
- package/src/components/Icons/Law.tsx +2 -1
- package/src/components/Icons/Managers/Npm.tsx +1 -7
- package/src/components/Icons/Managers/Pnpm.tsx +1 -7
- package/src/components/Icons/Managers/Yarn.tsx +1 -7
- package/src/components/Install/Install.test.tsx +54 -13
- package/src/components/Install/Install.tsx +12 -11
- package/src/components/Install/InstallListItem.tsx +15 -13
- package/src/components/Keywords/KeywordListItems.tsx +22 -0
- package/src/components/Keywords/Keywords.stories.tsx +19 -0
- package/src/components/Keywords/Keywords.test.tsx +57 -0
- package/src/components/Keywords/Keywords.tsx +35 -0
- package/src/components/Keywords/index.ts +1 -0
- package/src/components/Link/Link.test.tsx +25 -0
- package/src/components/Link/Link.tsx +4 -18
- package/src/components/Link/index.ts +1 -1
- package/src/components/LinkExternal/LinkExternal.test.tsx +18 -0
- package/src/components/LinkExternal/LinkExternal.tsx +22 -0
- package/src/components/LinkExternal/index.ts +1 -0
- package/src/components/Loading/Loading.test.tsx +8 -4
- package/src/components/Loading/styles.ts +1 -0
- package/src/components/LoginDialog/LoginDialog.test.tsx +1 -1
- package/src/components/LoginDialog/LoginDialog.tsx +10 -1
- package/src/components/LoginDialog/LoginDialogCloseButton.tsx +1 -0
- package/src/components/LoginDialog/LoginDialogForm.tsx +0 -2
- package/src/components/LoginDialog/LoginDialogFormError.tsx +1 -1
- package/src/components/Logo/Logo.stories.tsx +16 -0
- package/src/components/Logo/Logo.test.tsx +8 -1
- package/src/components/Logo/Logo.tsx +19 -3
- package/src/components/NotFound/NotFound.tsx +6 -5
- package/src/components/NotFound/Notfound.test.tsx +6 -3
- package/src/components/Package/Package.test.tsx +47 -14
- package/src/components/Package/Package.tsx +41 -44
- package/src/components/Package/styles.ts +7 -17
- package/src/components/PackageList/Packagelist.test.tsx +1 -0
- package/src/components/Person/Person.test.tsx +50 -0
- package/src/components/Person/Person.tsx +45 -0
- package/src/components/Person/PersonTooltip.tsx +26 -0
- package/src/components/Person/index.ts +1 -0
- package/src/components/Person/utils.ts +20 -0
- package/src/components/RawViewer/RawViewer.tsx +8 -4
- package/src/components/Readme/Readme.spec.tsx +17 -0
- package/src/components/Readme/Readme.tsx +34 -7
- package/src/components/Readme/{github-markdown-dark.css → github-markdown.css} +266 -83
- package/src/components/Readme/utils.ts +15 -14
- package/src/components/RegistryInfoDialog/styles.ts +5 -4
- package/src/components/Repository/Repository.tsx +10 -17
- package/src/components/Search/AutoComplete/AutoComplete.tsx +1 -1
- package/src/components/Search/AutoComplete/styles.ts +7 -0
- package/src/components/Search/Search.test.tsx +38 -11
- package/src/components/Search/Search.tsx +4 -2
- package/src/components/Search/SearchItem.tsx +19 -8
- package/src/components/Search/utils.ts +17 -0
- package/src/components/SettingsMenu/SettingsMenu.test.tsx +41 -0
- package/src/components/SettingsMenu/SettingsMenu.tsx +48 -10
- package/src/components/{SideBarTittle/SideBarTittle.tsx → SideBarTitle/SideBarTitle.tsx} +19 -3
- package/src/components/SideBarTitle/index.ts +1 -0
- package/src/components/UpLinks/UpLinks.test.tsx +7 -0
- package/src/components/UpLinks/UpLinks.tsx +38 -15
- package/src/components/UpLinks/UplinkLink.tsx +20 -0
- package/src/components/UpLinks/styles.ts +1 -0
- package/src/components/Versions/HistoryList.tsx +11 -6
- package/src/components/Versions/TagList.tsx +4 -3
- package/src/components/Versions/Versions.test.tsx +26 -8
- package/src/components/Versions/Versions.tsx +81 -28
- package/src/index.ts +6 -2
- package/src/providers/AppConfigurationProvider/AppConfigurationProvider.tsx +1 -0
- package/src/providers/PersistenceSettingProvider/PersistenceSettingProvider.tsx +2 -0
- package/src/providers/VersionProvider/VersionProvider.test.tsx +3 -3
- package/src/sections/Detail/Detail.stories.tsx +10 -0
- package/src/sections/Detail/Detail.test.tsx +8 -1
- package/src/sections/Detail/Detail.tsx +11 -4
- package/src/sections/Detail/Tabs.tsx +6 -9
- package/src/sections/Footer/Footer.tsx +26 -12
- package/src/sections/Footer/styles.ts +4 -0
- package/src/sections/Header/Header.test.tsx +12 -10
- package/src/sections/Header/HeaderLeft.tsx +19 -11
- package/src/sections/Header/HeaderMenu.tsx +1 -1
- package/src/sections/Header/HeaderRight.tsx +14 -3
- package/src/sections/Header/HeaderSettingsDialog.tsx +2 -3
- package/src/sections/Header/LanguageSwitch.tsx +10 -7
- package/src/sections/Header/RegistryInfoContent/RegistryInfoContent.test.tsx +1 -1
- package/src/sections/Header/RegistryInfoContent/RegistryInfoContent.tsx +2 -7
- package/src/sections/Header/styles.ts +4 -16
- package/src/sections/Home/Home.test.tsx +37 -0
- package/src/sections/Home/Home.tsx +0 -1
- package/src/sections/SideBar/Sidebar.test.tsx +52 -84
- package/src/sections/SideBar/Sidebar.tsx +11 -26
- package/src/store/api.test.ts +19 -2
- package/src/store/api.ts +13 -6
- package/src/store/models/configuration.ts +2 -1
- package/src/store/models/login.ts +10 -12
- package/src/store/models/manifest.ts +25 -6
- package/src/store/models/packages.ts +4 -5
- package/src/store/models/routes.ts +10 -0
- package/src/store/models/search.ts +4 -2
- package/src/store/models/utils.ts +3 -0
- package/src/types/packageMeta.ts +7 -5
- package/src/utils/__partials__/packageMeta.ts +0 -1
- package/src/utils/routes.ts +1 -0
- package/src/utils/utils.test.ts +34 -0
- package/src/utils/utils.ts +20 -5
- package/tsconfig.json +1 -1
- package/build/components/Dependencies/styles.js +0 -68
- package/build/components/Developers/styles.js +0 -69
- package/build/components/Distribution/utils.js +0 -25
- package/build/components/Distribution/utilts.spec.js +0 -18
- package/build/components/Package/Tag/Tag.js +0 -15
- package/build/components/Package/Tag/index.js +0 -14
- package/build/components/Package/Tag/styles.js +0 -25
- package/build/components/Readme/ReadmeDark.js +0 -46
- package/build/components/Readme/ReadmeLight.js +0 -46
- package/build/components/Readme/github-markdown-light.css +0 -1014
- package/build/components/SideBarTittle/SideBarTittle.js +0 -95
- package/build/components/SideBarTittle/index.js +0 -14
- package/build/sections/Header/RegistryInfoDialog/RegistryInfoDialog.js +0 -37
- package/build/sections/Header/RegistryInfoDialog/index.js +0 -14
- package/build/sections/Header/RegistryInfoDialog/styles.js +0 -49
- package/build/sections/Header/RegistryInfoDialog/types.js +0 -6
- package/build/src/components/Dependencies/styles.d.ts +0 -8
- package/build/src/components/Developers/styles.d.ts +0 -11
- package/build/src/components/Distribution/utils.d.ts +0 -7
- package/build/src/components/Package/Tag/Tag.d.ts +0 -6
- package/build/src/components/Package/Tag/index.d.ts +0 -1
- package/build/src/components/Package/Tag/styles.d.ts +0 -5
- package/build/src/components/Readme/ReadmeDark.d.ts +0 -5
- package/build/src/components/Readme/ReadmeLight.d.ts +0 -5
- package/build/src/components/SideBarTittle/index.d.ts +0 -1
- package/build/src/sections/Header/RegistryInfoDialog/RegistryInfoDialog.d.ts +0 -4
- package/build/src/sections/Header/RegistryInfoDialog/index.d.ts +0 -1
- package/build/src/sections/Header/RegistryInfoDialog/styles.d.ts +0 -13
- package/build/src/sections/Header/RegistryInfoDialog/types.d.ts +0 -7
- package/src/components/Dependencies/styles.ts +0 -26
- package/src/components/Developers/styles.ts +0 -31
- package/src/components/Distribution/utils.ts +0 -32
- package/src/components/Distribution/utilts.spec.ts +0 -17
- package/src/components/Package/Tag/Tag.test.tsx +0 -15
- package/src/components/Package/Tag/Tag.tsx +0 -11
- package/src/components/Package/Tag/index.ts +0 -1
- package/src/components/Package/Tag/styles.ts +0 -11
- package/src/components/Readme/ReadmeDark.tsx +0 -32
- package/src/components/Readme/ReadmeLight.tsx +0 -32
- package/src/components/Readme/github-markdown-light.css +0 -1014
- package/src/components/Search/AutoComplete/styles.tsx +0 -42
- package/src/components/SideBarTittle/index.ts +0 -1
- package/src/sections/Header/RegistryInfoDialog/RegistryInfoDialog.tsx +0 -31
- package/src/sections/Header/RegistryInfoDialog/index.ts +0 -1
- package/src/sections/Header/RegistryInfoDialog/styles.ts +0 -21
- package/src/sections/Header/RegistryInfoDialog/types.ts +0 -8
- /package/build/components/Icons/DevsIcons/{es6modules.svg → es6module.svg} +0 -0
- /package/build/src/{components/Package/Tag/Tag.test.d.ts → AppTest/AppRoute.test.d.ts} +0 -0
- /package/build/src/components/{SideBarTittle/SideBarTittle.d.ts → SideBarTitle/SideBarTitle.d.ts} +0 -0
- /package/build/src/components/{SideBarTittle/SideBarTittle.stories.d.ts → SideBarTitle/SideBarTitle.stories.d.ts} +0 -0
- /package/build/src/components/{SideBarTittle → SideBarTitle}/utils.d.ts +0 -0
- /package/src/components/Icons/DevsIcons/{es6modules.svg → es6module.svg} +0 -0
- /package/src/components/{SideBarTittle/SideBarTittle.stories.tsx → SideBarTitle/SideBarTitle.stories.tsx} +0 -0
- /package/src/components/{SideBarTittle → SideBarTitle}/utils.ts +0 -0
|
@@ -41,7 +41,7 @@ const ActionBar: React.FC<Props> = ({ showRaw, showDownloadTarball = true, packa
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
return (
|
|
44
|
-
<Box alignItems="center" display="flex"
|
|
44
|
+
<Box alignItems="center" display="flex" sx={{ my: 2 }}>
|
|
45
45
|
<Stack direction="row" spacing={1}>
|
|
46
46
|
{actions.map((action) => (
|
|
47
47
|
<ActionBarAction key={action.type} {...action} />
|
|
@@ -12,11 +12,14 @@ import { useDispatch, useSelector } from 'react-redux';
|
|
|
12
12
|
|
|
13
13
|
import { Theme } from '../../Theme';
|
|
14
14
|
import { Dispatch, RootState } from '../../store/store';
|
|
15
|
-
import
|
|
15
|
+
import LinkExternal from '../LinkExternal';
|
|
16
16
|
|
|
17
17
|
export const Fab = styled(FabMUI)<{ theme?: Theme }>(({ theme }) => ({
|
|
18
18
|
backgroundColor:
|
|
19
19
|
theme?.palette.mode === 'light' ? theme?.palette.primary.main : theme?.palette.cyanBlue,
|
|
20
|
+
'&:hover': {
|
|
21
|
+
color: theme?.palette.mode === 'light' ? theme?.palette.primary.main : theme?.palette.cyanBlue,
|
|
22
|
+
},
|
|
20
23
|
color: theme?.palette.white,
|
|
21
24
|
}));
|
|
22
25
|
|
|
@@ -42,21 +45,21 @@ const ActionBarAction: React.FC<ActionBarActionProps> = ({ type, link, action })
|
|
|
42
45
|
case 'VISIT_HOMEPAGE':
|
|
43
46
|
return (
|
|
44
47
|
<Tooltip title={t('action-bar-action.visit-home-page') as string}>
|
|
45
|
-
<
|
|
48
|
+
<LinkExternal to={link} variant="button">
|
|
46
49
|
<Fab size="small">
|
|
47
50
|
<HomeIcon />
|
|
48
51
|
</Fab>
|
|
49
|
-
</
|
|
52
|
+
</LinkExternal>
|
|
50
53
|
</Tooltip>
|
|
51
54
|
);
|
|
52
55
|
case 'OPEN_AN_ISSUE':
|
|
53
56
|
return (
|
|
54
57
|
<Tooltip title={t('action-bar-action.open-an-issue') as string}>
|
|
55
|
-
<
|
|
58
|
+
<LinkExternal to={link} variant="button">
|
|
56
59
|
<Fab size="small">
|
|
57
60
|
<BugReportIcon />
|
|
58
61
|
</Fab>
|
|
59
|
-
</
|
|
62
|
+
</LinkExternal>
|
|
60
63
|
</Tooltip>
|
|
61
64
|
);
|
|
62
65
|
case 'DOWNLOAD_TARBALL':
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { cleanup, render } from '../../test/test-react-testing-library';
|
|
3
|
+
import { cleanup, render, screen } from '../../test/test-react-testing-library';
|
|
4
4
|
import { PackageMetaInterface } from '../../types/packageMeta';
|
|
5
5
|
import Authors from './Author';
|
|
6
6
|
|
|
@@ -66,4 +66,10 @@ describe('<Author /> component', () => {
|
|
|
66
66
|
const wrapper = render(withAuthorComponent(packageMeta));
|
|
67
67
|
expect(wrapper).toMatchSnapshot();
|
|
68
68
|
});
|
|
69
|
+
|
|
70
|
+
test('should not render if data is missing', () => {
|
|
71
|
+
// @ts-ignore - testing with missing data
|
|
72
|
+
render(withAuthorComponent(undefined));
|
|
73
|
+
expect(screen.queryByText('sidebar.author.title')).toBeNull();
|
|
74
|
+
});
|
|
69
75
|
});
|
|
@@ -1,35 +1,13 @@
|
|
|
1
|
-
import { Typography } from '@mui/material';
|
|
2
|
-
import Avatar from '@mui/material/Avatar';
|
|
3
1
|
import List from '@mui/material/List';
|
|
4
|
-
import { useTheme } from '@mui/styles';
|
|
5
|
-
import i18next from 'i18next';
|
|
6
2
|
import React, { FC } from 'react';
|
|
7
3
|
import { useTranslation } from 'react-i18next';
|
|
8
4
|
|
|
9
|
-
import
|
|
5
|
+
import Person from '../Person';
|
|
10
6
|
import { AuthorListItem, StyledText } from './styles';
|
|
11
7
|
|
|
12
|
-
export function getAuthorName(authorName?: string): string {
|
|
13
|
-
if (!authorName) {
|
|
14
|
-
return i18next.t('author-unknown');
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (authorName.toLowerCase() === 'anonymous') {
|
|
18
|
-
return i18next.t('author-anonymous');
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return authorName;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @param param0
|
|
26
|
-
* @returns
|
|
27
|
-
*/
|
|
28
8
|
const Author: FC<{ packageMeta }> = ({ packageMeta }) => {
|
|
29
9
|
const { t } = useTranslation();
|
|
30
10
|
|
|
31
|
-
const theme = useTheme();
|
|
32
|
-
|
|
33
11
|
if (!packageMeta) {
|
|
34
12
|
return null;
|
|
35
13
|
}
|
|
@@ -40,26 +18,10 @@ const Author: FC<{ packageMeta }> = ({ packageMeta }) => {
|
|
|
40
18
|
return null;
|
|
41
19
|
}
|
|
42
20
|
|
|
43
|
-
const { email, name } = author;
|
|
44
|
-
const avatarComponent = (
|
|
45
|
-
<Avatar
|
|
46
|
-
alt={author.name}
|
|
47
|
-
src={author.avatar}
|
|
48
|
-
sx={{ width: 40, height: 40, marginRight: theme.spacing(1) }}
|
|
49
|
-
/>
|
|
50
|
-
);
|
|
51
|
-
|
|
52
21
|
return (
|
|
53
22
|
<List subheader={<StyledText variant={'subtitle1'}>{t('sidebar.author.title')}</StyledText>}>
|
|
54
|
-
<AuthorListItem>
|
|
55
|
-
{
|
|
56
|
-
avatarComponent
|
|
57
|
-
) : (
|
|
58
|
-
<a href={`mailto:${email}?subject=${packageName}@${version}`} target={'_top'}>
|
|
59
|
-
{avatarComponent}
|
|
60
|
-
</a>
|
|
61
|
-
)}
|
|
62
|
-
{name && <Typography variant="subtitle2">{getAuthorName(name)}</Typography>}
|
|
23
|
+
<AuthorListItem sx={{ my: 1 }}>
|
|
24
|
+
<Person packageName={packageName} person={author} version={version} withText={true} />
|
|
63
25
|
</AuthorListItem>
|
|
64
26
|
</List>
|
|
65
27
|
);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { fireEvent, render, screen } from '../../test/test-react-testing-library';
|
|
4
|
+
import CopyToClipBoard from './CopyToClipBoard';
|
|
5
|
+
|
|
6
|
+
Object.assign(navigator, {
|
|
7
|
+
clipboard: { writeText: jest.fn().mockImplementation(() => Promise.resolve()) },
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
describe('CopyToClipBoard component', () => {
|
|
11
|
+
test('should copy text to clipboard', async () => {
|
|
12
|
+
const copyThis = 'copy this';
|
|
13
|
+
render(
|
|
14
|
+
<CopyToClipBoard dataTestId={'copy-component'} text={copyThis} title={`npm i verdaccio`} />
|
|
15
|
+
);
|
|
16
|
+
expect(screen.getByTestId('copy-component')).toBeInTheDocument();
|
|
17
|
+
|
|
18
|
+
const copyComponent = await screen.findByTestId('copy-component');
|
|
19
|
+
await fireEvent.click(copyComponent);
|
|
20
|
+
|
|
21
|
+
expect(navigator.clipboard.writeText).toHaveBeenCalledWith(copyThis);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -5,17 +5,6 @@ export const copyToClipBoardUtility =
|
|
|
5
5
|
(event: SyntheticEvent<HTMLElement>): void => {
|
|
6
6
|
event.preventDefault();
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (document.body) {
|
|
11
|
-
document.body.appendChild(node);
|
|
12
|
-
|
|
13
|
-
const range = document.createRange();
|
|
14
|
-
const selection = window.getSelection() as Selection;
|
|
15
|
-
range.selectNodeContents(node);
|
|
16
|
-
selection.removeAllRanges();
|
|
17
|
-
selection.addRange(range);
|
|
18
|
-
document.execCommand('copy');
|
|
19
|
-
document.body.removeChild(node);
|
|
20
|
-
}
|
|
8
|
+
// document.execCommand is deprecated
|
|
9
|
+
navigator.clipboard.writeText(str);
|
|
21
10
|
};
|
|
@@ -71,17 +71,17 @@ const packageMeta = {
|
|
|
71
71
|
shelljs: '^0.7.8',
|
|
72
72
|
'update-notifier': '^2.1.0',
|
|
73
73
|
},
|
|
74
|
-
bundleDependencies:
|
|
75
|
-
'styled-components'
|
|
76
|
-
'cross-spawn'
|
|
77
|
-
jscodeshift
|
|
78
|
-
json5
|
|
79
|
-
'latest-version'
|
|
80
|
-
'merge-dirs'
|
|
81
|
-
opencollective
|
|
82
|
-
shelljs
|
|
83
|
-
'update-notifier'
|
|
84
|
-
|
|
74
|
+
bundleDependencies: [
|
|
75
|
+
'styled-components',
|
|
76
|
+
'cross-spawn',
|
|
77
|
+
'jscodeshift',
|
|
78
|
+
'json5',
|
|
79
|
+
'latest-version',
|
|
80
|
+
'merge-dirs',
|
|
81
|
+
'opencollective',
|
|
82
|
+
'shelljs',
|
|
83
|
+
'update-notifier',
|
|
84
|
+
],
|
|
85
85
|
},
|
|
86
86
|
_uplinks: {},
|
|
87
87
|
};
|
|
@@ -6,7 +6,6 @@ import Dependencies from './Dependencies';
|
|
|
6
6
|
|
|
7
7
|
describe('<Dependencies /> component', () => {
|
|
8
8
|
test('Renders a message when there are no dependencies', () => {
|
|
9
|
-
// Given
|
|
10
9
|
const packageMeta = {
|
|
11
10
|
latest: {
|
|
12
11
|
name: 'verdaccio',
|
|
@@ -25,15 +24,12 @@ describe('<Dependencies /> component', () => {
|
|
|
25
24
|
_uplinks: {},
|
|
26
25
|
};
|
|
27
26
|
|
|
28
|
-
// When
|
|
29
27
|
const { getByText } = render(<Dependencies packageMeta={packageMeta} />);
|
|
30
28
|
|
|
31
|
-
// Then
|
|
32
29
|
expect(getByText('dependencies.has-no-dependencies')).toBeDefined();
|
|
33
30
|
});
|
|
34
31
|
|
|
35
|
-
test('
|
|
36
|
-
// Given
|
|
32
|
+
test('renders a link to each dependency', () => {
|
|
37
33
|
const packageMeta = {
|
|
38
34
|
latest: {
|
|
39
35
|
name: 'verdaccio',
|
|
@@ -59,18 +55,12 @@ describe('<Dependencies /> component', () => {
|
|
|
59
55
|
_uplinks: {},
|
|
60
56
|
};
|
|
61
57
|
|
|
62
|
-
// When
|
|
63
58
|
const { getByText } = render(
|
|
64
59
|
<HashRouter>
|
|
65
60
|
<Dependencies packageMeta={packageMeta} />
|
|
66
61
|
</HashRouter>
|
|
67
62
|
);
|
|
68
63
|
|
|
69
|
-
// Then
|
|
70
|
-
// FIXME: currently MaterialUI chips do not support the children
|
|
71
|
-
// prop, therefore it is impossible to use proper links for
|
|
72
|
-
// dependencies. Those are for now clickable spans
|
|
73
|
-
|
|
74
64
|
expect(getByText('dependencies (2)')).toBeDefined();
|
|
75
65
|
expect(getByText('devDependencies (1)')).toBeDefined();
|
|
76
66
|
expect(getByText('peerDependencies (1)')).toBeDefined();
|
|
@@ -1,63 +1,16 @@
|
|
|
1
1
|
import Box from '@mui/material/Box';
|
|
2
|
+
import Card from '@mui/material/Card';
|
|
2
3
|
import CardContent from '@mui/material/CardContent';
|
|
3
|
-
import {
|
|
4
|
-
import React from 'react';
|
|
4
|
+
import React, { Fragment } from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import { useHistory } from 'react-router-dom';
|
|
7
6
|
|
|
8
|
-
import { PackageDependencies } from '../../types/packageMeta';
|
|
9
7
|
import NoItems from '../NoItems';
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
interface DependencyBlockProps {
|
|
13
|
-
title: string;
|
|
14
|
-
dependencies: PackageDependencies;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const DependencyBlock: React.FC<DependencyBlockProps> = ({ title, dependencies }) => {
|
|
18
|
-
const history = useHistory();
|
|
19
|
-
const { t } = useTranslation();
|
|
20
|
-
const theme = useTheme();
|
|
21
|
-
|
|
22
|
-
const deps = Object.entries(dependencies);
|
|
23
|
-
|
|
24
|
-
function handleClick(name: string): void {
|
|
25
|
-
history.push(`/-/web/detail/${name}`);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<Box data-testid={title} sx={{ margin: theme.spacing(2) }}>
|
|
30
|
-
<StyledText sx={{ marginBottom: theme.spacing(1) }} variant="subtitle1">
|
|
31
|
-
{`${title} (${deps.length})`}
|
|
32
|
-
</StyledText>
|
|
33
|
-
<Tags>
|
|
34
|
-
{deps.map(([name, version]) => (
|
|
35
|
-
<Tag
|
|
36
|
-
className={'dep-tag'}
|
|
37
|
-
clickable={true}
|
|
38
|
-
data-testid={name}
|
|
39
|
-
key={name}
|
|
40
|
-
label={t('dependencies.dependency-block', { package: name, version })}
|
|
41
|
-
// eslint-disable-next-line
|
|
42
|
-
onClick={() => handleClick(name)}
|
|
43
|
-
/>
|
|
44
|
-
))}
|
|
45
|
-
</Tags>
|
|
46
|
-
</Box>
|
|
47
|
-
);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
function hasKeys(object?: { [key: string]: any }): boolean {
|
|
51
|
-
return !!object && Object.keys(object).length > 0;
|
|
52
|
-
}
|
|
8
|
+
import { DependencyBlock } from './DependencyBlock';
|
|
9
|
+
import { hasKeys } from './utits';
|
|
53
10
|
|
|
54
11
|
const Dependencies: React.FC<{ packageMeta: any }> = ({ packageMeta }) => {
|
|
55
12
|
const { t } = useTranslation();
|
|
56
13
|
|
|
57
|
-
if (!packageMeta) {
|
|
58
|
-
throw new Error(t('error.package-meta-is-required-at-detail-context'));
|
|
59
|
-
}
|
|
60
|
-
|
|
61
14
|
const { latest } = packageMeta;
|
|
62
15
|
// FIXME: add dependencies to package meta type
|
|
63
16
|
// @ts-ignore
|
|
@@ -73,8 +26,8 @@ const Dependencies: React.FC<{ packageMeta: any }> = ({ packageMeta }) => {
|
|
|
73
26
|
dependencies,
|
|
74
27
|
devDependencies,
|
|
75
28
|
peerDependencies,
|
|
76
|
-
bundleDependencies,
|
|
77
29
|
optionalDependencies,
|
|
30
|
+
bundleDependencies,
|
|
78
31
|
};
|
|
79
32
|
const hasDependencies =
|
|
80
33
|
hasKeys(dependencies) ||
|
|
@@ -84,28 +37,36 @@ const Dependencies: React.FC<{ packageMeta: any }> = ({ packageMeta }) => {
|
|
|
84
37
|
hasKeys(peerDependencies);
|
|
85
38
|
if (hasDependencies) {
|
|
86
39
|
return (
|
|
87
|
-
<
|
|
40
|
+
<Card sx={{ mb: 2 }}>
|
|
88
41
|
<CardContent>
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
42
|
+
<Box data-testid="dependencies-box" sx={{ m: 2 }}>
|
|
43
|
+
{Object.entries(dependencyMap).map(([dependencyType, dependencies]) => {
|
|
44
|
+
if (!dependencies || Object.keys(dependencies).length === 0) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
return (
|
|
48
|
+
<Fragment key={dependencyType}>
|
|
49
|
+
<DependencyBlock
|
|
50
|
+
dependencies={dependencies}
|
|
51
|
+
key={dependencyType}
|
|
52
|
+
title={dependencyType}
|
|
53
|
+
/>
|
|
54
|
+
</Fragment>
|
|
55
|
+
);
|
|
56
|
+
})}
|
|
57
|
+
</Box>
|
|
103
58
|
</CardContent>
|
|
104
|
-
</
|
|
59
|
+
</Card>
|
|
105
60
|
);
|
|
106
61
|
}
|
|
107
62
|
|
|
108
|
-
return
|
|
63
|
+
return (
|
|
64
|
+
<Card sx={{ mb: 2 }}>
|
|
65
|
+
<CardContent>
|
|
66
|
+
<NoItems text={t('dependencies.has-no-dependencies', { package: name })} />
|
|
67
|
+
</CardContent>
|
|
68
|
+
</Card>
|
|
69
|
+
);
|
|
109
70
|
};
|
|
110
71
|
|
|
111
72
|
export default Dependencies;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MemoryRouter, Route } from 'react-router';
|
|
3
|
+
|
|
4
|
+
import { fireEvent, render, screen } from '../../test/test-react-testing-library';
|
|
5
|
+
import { DependencyBlock } from './DependencyBlock';
|
|
6
|
+
|
|
7
|
+
const mockHistory = jest.fn();
|
|
8
|
+
|
|
9
|
+
jest.mock('react-router-dom', () => ({
|
|
10
|
+
useHistory: () => ({
|
|
11
|
+
push: mockHistory,
|
|
12
|
+
}),
|
|
13
|
+
}));
|
|
14
|
+
|
|
15
|
+
describe('<DependencyBlock /> component', () => {
|
|
16
|
+
test('renders dependency block', () => {
|
|
17
|
+
render(<DependencyBlock dependencies={{ jquery: '1.0.0' }} title="foo" />);
|
|
18
|
+
|
|
19
|
+
expect(screen.getByText('foo (1)')).toBeInTheDocument();
|
|
20
|
+
expect(screen.getByText('dependencies.dependency-block')).toBeInTheDocument();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test('renders bundleDependencies block', () => {
|
|
24
|
+
render(<DependencyBlock dependencies={{ semver: '7.6.0' }} title="bundleDependencies" />);
|
|
25
|
+
|
|
26
|
+
expect(screen.getByText('bundleDependencies (1)')).toBeInTheDocument();
|
|
27
|
+
expect(screen.getByText('dependencies.dependency-block-bundle')).toBeInTheDocument();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test('handle change of route', async () => {
|
|
31
|
+
render(
|
|
32
|
+
<MemoryRouter
|
|
33
|
+
initialEntries={[`/-/web/detail/some-dep`, `/-/web/detail/jquery`]}
|
|
34
|
+
initialIndex={0}
|
|
35
|
+
>
|
|
36
|
+
<Route exact={true} path="/-/web/detail/:package">
|
|
37
|
+
<DependencyBlock dependencies={{ jquery: '1.0.0' }} title="foo" />
|
|
38
|
+
</Route>
|
|
39
|
+
</MemoryRouter>
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
fireEvent.click(screen.getByTestId('jquery'));
|
|
43
|
+
|
|
44
|
+
await expect(mockHistory).toHaveBeenCalled();
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import Chip from '@mui/material/Chip';
|
|
4
|
+
import Typography from '@mui/material/Typography';
|
|
5
|
+
import { useTheme } from '@mui/styles';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
import { useHistory } from 'react-router-dom';
|
|
9
|
+
|
|
10
|
+
import { Theme } from '../../Theme';
|
|
11
|
+
import { PackageDependencies } from '../../types/packageMeta';
|
|
12
|
+
import { Route } from '../../utils';
|
|
13
|
+
|
|
14
|
+
interface DependencyBlockProps {
|
|
15
|
+
title: string;
|
|
16
|
+
dependencies: PackageDependencies;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({
|
|
20
|
+
fontWeight: props.theme && props.theme.fontWeight.bold,
|
|
21
|
+
textTransform: 'capitalize',
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
export const Tags = styled('div')<{ theme?: Theme }>((props) => ({
|
|
25
|
+
display: 'flex',
|
|
26
|
+
justifyContent: 'start',
|
|
27
|
+
flexWrap: 'wrap',
|
|
28
|
+
// force title to be on the same line as the title
|
|
29
|
+
// could be better to avoid margin on the first element
|
|
30
|
+
// but it is a bit tricky to do with flexbox
|
|
31
|
+
marginLeft: props.theme.spacing(-0.6),
|
|
32
|
+
}));
|
|
33
|
+
|
|
34
|
+
export const Tag = styled(Chip)<{ theme?: Theme }>((props) => ({
|
|
35
|
+
margin: props.theme.spacing(0.6),
|
|
36
|
+
}));
|
|
37
|
+
|
|
38
|
+
export const DependencyBlock: React.FC<DependencyBlockProps> = ({ title, dependencies }) => {
|
|
39
|
+
const history = useHistory();
|
|
40
|
+
const { t } = useTranslation();
|
|
41
|
+
const theme = useTheme();
|
|
42
|
+
const deps = Object.entries(dependencies);
|
|
43
|
+
|
|
44
|
+
function handleClick(name: string): void {
|
|
45
|
+
history.push(`${Route.DETAIL}${name}`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function labelText(title: string, name: string, version: string): string {
|
|
49
|
+
if (title === 'bundleDependencies') {
|
|
50
|
+
return t('dependencies.dependency-block-bundle', { package: name });
|
|
51
|
+
} else {
|
|
52
|
+
return t('dependencies.dependency-block', { package: name, version });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<Box data-testid={title} sx={{ margin: theme.spacing(2) }}>
|
|
58
|
+
<StyledText sx={{ marginBottom: theme.spacing(1) }} variant="subtitle1">
|
|
59
|
+
{`${title} (${deps.length})`}
|
|
60
|
+
</StyledText>
|
|
61
|
+
<Tags>
|
|
62
|
+
{deps.map(([name, version]: [string, string]) => {
|
|
63
|
+
// Bundle dependencies are stored as array, for example [ 0: "semver" ]
|
|
64
|
+
// so the package name arrives here in the version field
|
|
65
|
+
const packageName = title == 'bundleDependencies' ? version : name;
|
|
66
|
+
return (
|
|
67
|
+
<Tag
|
|
68
|
+
className={'dep-tag'}
|
|
69
|
+
clickable={true}
|
|
70
|
+
data-testid={packageName}
|
|
71
|
+
key={packageName}
|
|
72
|
+
label={labelText(title, packageName, version)}
|
|
73
|
+
// eslint-disable-next-line
|
|
74
|
+
onClick={() => {
|
|
75
|
+
handleClick(packageName);
|
|
76
|
+
}}
|
|
77
|
+
/>
|
|
78
|
+
);
|
|
79
|
+
})}
|
|
80
|
+
</Tags>
|
|
81
|
+
</Box>
|
|
82
|
+
);
|
|
83
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { cleanup, fireEvent, render } from '../../test/test-react-testing-library';
|
|
3
|
+
import { cleanup, fireEvent, render, screen } from '../../test/test-react-testing-library';
|
|
4
|
+
import { DeveloperType } from './DeveloperType';
|
|
4
5
|
import Developers from './Developers';
|
|
5
|
-
import { DeveloperType } from './Title';
|
|
6
6
|
|
|
7
7
|
describe('test Developers', () => {
|
|
8
8
|
afterEach(() => {
|
|
@@ -63,7 +63,7 @@ describe('test Developers', () => {
|
|
|
63
63
|
expect(wrapper).toMatchSnapshot();
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
test('should
|
|
66
|
+
test('should show only up to max items', () => {
|
|
67
67
|
const packageMeta = {
|
|
68
68
|
latest: {
|
|
69
69
|
packageName: 'foo',
|
|
@@ -72,6 +72,7 @@ describe('test Developers', () => {
|
|
|
72
72
|
{
|
|
73
73
|
name: 'dmethvin',
|
|
74
74
|
email: 'test@gmail.com',
|
|
75
|
+
url: 'https://example.com/',
|
|
75
76
|
},
|
|
76
77
|
{
|
|
77
78
|
name: 'dmethvin2',
|
|
@@ -89,14 +90,40 @@ describe('test Developers', () => {
|
|
|
89
90
|
<Developers packageMeta={packageMeta} type={DeveloperType.CONTRIBUTORS} visibleMax={1} />
|
|
90
91
|
);
|
|
91
92
|
|
|
92
|
-
// const item2 = wrapper.find(Fab);
|
|
93
|
-
// // TODO: I am not sure here how to verify the method inside the component was called.
|
|
94
|
-
// item2.simulate('click');
|
|
95
|
-
|
|
96
93
|
expect(wrapper.getByText('sidebar.contributors.title')).toBeInTheDocument();
|
|
97
|
-
|
|
94
|
+
expect(wrapper.getByTestId(packageMeta.latest.contributors[0].name)).toBeInTheDocument();
|
|
95
|
+
expect(wrapper.queryByTestId(packageMeta.latest.contributors[1].name)).not.toBeInTheDocument();
|
|
96
|
+
expect(wrapper.queryByTestId(packageMeta.latest.contributors[2].name)).not.toBeInTheDocument();
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
test('renders only the first six contributors when there are more than six', () => {
|
|
100
|
+
const packageMeta = {
|
|
101
|
+
latest: {
|
|
102
|
+
contributors: [
|
|
103
|
+
{ name: 'contributor1', email: 'c1@test.com' },
|
|
104
|
+
{ name: 'contributor2', email: 'c2@test.com' },
|
|
105
|
+
{ name: 'contributor3', email: 'c3@test.com' },
|
|
106
|
+
{ name: 'contributor4', email: 'c4@test.com' },
|
|
107
|
+
{ name: 'contributor5', email: 'c5@test.com' },
|
|
108
|
+
{ name: 'contributor6', email: 'c6@test.com' },
|
|
109
|
+
{ name: 'contributor7', email: 'c7@test.com' },
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
render(<Developers packageMeta={packageMeta} type={DeveloperType.CONTRIBUTORS} />);
|
|
115
|
+
|
|
116
|
+
expect(screen.getByTestId('contributor1')).toBeInTheDocument();
|
|
117
|
+
expect(screen.getByTestId('contributor2')).toBeInTheDocument();
|
|
118
|
+
expect(screen.getByTestId('contributor3')).toBeInTheDocument();
|
|
119
|
+
expect(screen.getByTestId('contributor4')).toBeInTheDocument();
|
|
120
|
+
expect(screen.getByTestId('contributor5')).toBeInTheDocument();
|
|
121
|
+
expect(screen.getByTestId('contributor6')).toBeInTheDocument();
|
|
122
|
+
expect(screen.queryByTestId('contributor7')).not.toBeInTheDocument();
|
|
123
|
+
expect(screen.getByTestId('fab-add')).toBeInTheDocument();
|
|
98
124
|
|
|
99
|
-
|
|
100
|
-
|
|
125
|
+
// click on "more"
|
|
126
|
+
fireEvent.click(screen.getByTestId('fab-add'));
|
|
127
|
+
expect(screen.getByTestId('contributor7')).toBeInTheDocument();
|
|
101
128
|
});
|
|
102
129
|
});
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
2
|
import Add from '@mui/icons-material/Add';
|
|
3
|
-
import Avatar from '@mui/material/Avatar';
|
|
4
3
|
import Box from '@mui/material/Box';
|
|
5
4
|
import FabMUI from '@mui/material/Fab';
|
|
6
|
-
import Tooltip from '@mui/material/Tooltip';
|
|
7
5
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
8
6
|
|
|
9
7
|
import { Theme } from '../../Theme';
|
|
8
|
+
import Person from '../Person';
|
|
9
|
+
import { DeveloperType } from './DeveloperType';
|
|
10
10
|
import Title from './Title';
|
|
11
11
|
import getUniqueDeveloperValues from './get-unique-developer-values';
|
|
12
12
|
|
|
13
|
-
export enum DeveloperType {
|
|
14
|
-
CONTRIBUTORS = 'contributors',
|
|
15
|
-
MAINTAINERS = 'maintainers',
|
|
16
|
-
}
|
|
17
|
-
|
|
18
13
|
export const Fab = styled(FabMUI)<{ theme?: Theme }>((props) => ({
|
|
19
14
|
backgroundColor: props.theme?.palette.primary.main,
|
|
20
15
|
color: props.theme?.palette.white,
|
|
@@ -28,7 +23,7 @@ interface Props {
|
|
|
28
23
|
|
|
29
24
|
const StyledBox = styled(Box)({
|
|
30
25
|
'> *': {
|
|
31
|
-
|
|
26
|
+
marginRight: 5,
|
|
32
27
|
},
|
|
33
28
|
});
|
|
34
29
|
|
|
@@ -58,19 +53,24 @@ const Developers: React.FC<Props> = ({ type, visibleMax = VISIBLE_MAX, packageMe
|
|
|
58
53
|
return null;
|
|
59
54
|
}
|
|
60
55
|
|
|
56
|
+
const { name: packageName, version } = packageMeta.latest;
|
|
57
|
+
|
|
61
58
|
return (
|
|
62
59
|
<>
|
|
63
60
|
<Title type={type} />
|
|
64
61
|
<StyledBox display="flex" flexWrap="wrap" margin="10px 0 10px 0">
|
|
65
|
-
{visibleDevelopers.map((visibleDeveloper) => {
|
|
62
|
+
{visibleDevelopers.map((visibleDeveloper, index) => {
|
|
66
63
|
return (
|
|
67
|
-
<
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
<Person
|
|
65
|
+
key={index}
|
|
66
|
+
packageName={packageName}
|
|
67
|
+
person={visibleDeveloper}
|
|
68
|
+
version={version}
|
|
69
|
+
/>
|
|
70
70
|
);
|
|
71
71
|
})}
|
|
72
72
|
{visibleDevelopersMax < developers.length && (
|
|
73
|
-
<Fab onClick={handleSetVisibleDevelopersMax} size="small">
|
|
73
|
+
<Fab data-testid={'fab-add'} onClick={handleSetVisibleDevelopersMax} size="small">
|
|
74
74
|
<Add />
|
|
75
75
|
</Fab>
|
|
76
76
|
)}
|