@verdaccio/ui-components 3.0.0-next.1 → 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 +108 -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 +13 -8
- package/build/components/ActionBar/ActionBarAction.js +26 -19
- package/build/components/ActionBar/index.js +1 -1
- package/build/components/Author/Author.js +12 -34
- package/build/components/Author/index.js +1 -1
- package/build/components/Author/styles.js +10 -28
- package/build/components/CopyClipboard/CopyToClipBoard.js +13 -13
- 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 +13 -22
- 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 +17 -12
- 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 +36 -29
- package/build/components/Install/InstallListItem.js +35 -48
- 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 +56 -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 -9
- package/build/components/RawViewer/index.js +1 -1
- package/build/components/Readme/Readme.js +41 -21
- 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.css +1198 -0
- 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 +49 -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 +52 -18
- package/build/components/Versions/TagList.js +10 -7
- package/build/components/Versions/Versions.js +82 -15
- package/build/components/Versions/__partials__/data.json +1 -0
- package/build/components/Versions/__partials__/deprecated-versions.json +175 -0
- 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 +6 -5
- package/build/providers/AppConfigurationProvider/index.js +2 -2
- package/build/providers/PersistenceSettingProvider/PersistenceSettingProvider.js +7 -6
- 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/__mocks__/react-markdown.d.ts +2 -2
- package/build/src/components/Author/Author.d.ts +0 -5
- package/build/src/components/Author/styles.d.ts +0 -4
- package/build/src/components/CopyClipboard/CopyToClipBoard.d.ts +1 -1
- 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/Deprecated/Deprecated.d.ts +0 -1
- 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.d.ts +1 -1
- package/build/src/components/Heading/Heading.test.d.ts +1 -0
- package/build/src/components/Icons/DevsIcons/CommonJS.d.ts +2 -2
- package/build/src/components/Icons/DevsIcons/ES6Module.d.ts +2 -2
- package/build/src/components/Icons/DevsIcons/Git.d.ts +2 -2
- package/build/src/components/Icons/DevsIcons/NodeJS.d.ts +2 -2
- package/build/src/components/Icons/DevsIcons/TypeScript.d.ts +2 -2
- package/build/src/components/Icons/Earth.d.ts +2 -2
- package/build/src/components/Icons/FileBinary.d.ts +2 -2
- package/build/src/components/Icons/Icons.test.d.ts +1 -0
- package/build/src/components/Icons/Law.d.ts +2 -2
- package/build/src/components/Icons/License.d.ts +2 -2
- package/build/src/components/Icons/Managers/Npm.d.ts +2 -2
- package/build/src/components/Icons/Managers/Pnpm.d.ts +2 -2
- package/build/src/components/Icons/Managers/Yarn.d.ts +2 -2
- package/build/src/components/Icons/SvgIcon.d.ts +1 -1
- package/build/src/components/Icons/Time.d.ts +2 -2
- package/build/src/components/Icons/Version.d.ts +2 -2
- package/build/src/components/Install/InstallListItem.d.ts +2 -0
- 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 +1 -4
- 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/LoginDialog/LoginDialog.stories.d.ts +2 -2
- package/build/src/components/LoginDialog/LoginDialogForm.d.ts +1 -1
- package/build/src/components/LoginDialog/LoginDialogFormError.d.ts +1 -1
- 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/MenuItem/MenuItem.d.ts +1 -1
- 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 -2
- 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/Search.stories.d.ts +2 -2
- package/build/src/components/Search/SearchItem.d.ts +1 -1
- package/build/src/components/Search/styles.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/TextField/TextField.d.ts +1 -1
- 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/HistoryList.d.ts +1 -0
- 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/Footer.d.ts +2 -2
- package/build/src/sections/Footer/styles.d.ts +5 -5
- package/build/src/sections/Header/LanguageSwitch.d.ts +2 -2
- 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 +8 -5
- package/build/src/utils/__partials__/packageMeta.d.ts +0 -1
- package/build/src/utils/loadable.d.ts +2 -2
- 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 -4
- 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 +34 -31
- 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.stories.tsx +1 -1
- package/src/components/ActionBar/ActionBar.test.tsx +44 -16
- package/src/components/ActionBar/ActionBar.tsx +17 -13
- package/src/components/ActionBar/ActionBarAction.tsx +22 -14
- package/src/components/Author/Author.test.tsx +7 -1
- package/src/components/Author/Author.tsx +4 -33
- package/src/components/Author/styles.ts +0 -6
- package/src/components/CopyClipboard/CopyToClipBoard.test.tsx +23 -0
- package/src/components/CopyClipboard/CopyToClipBoard.tsx +4 -3
- 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/Deprecated/Deprecated.tsx +6 -19
- 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 +10 -6
- 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 +74 -41
- package/src/components/Install/Install.tsx +27 -15
- package/src/components/Install/InstallListItem.tsx +49 -31
- 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 +51 -45
- 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 +9 -10
- package/src/components/Readme/Readme.spec.tsx +17 -0
- package/src/components/Readme/Readme.tsx +28 -12
- package/src/components/Readme/github-markdown.css +1198 -0
- 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 +64 -7
- package/src/components/{SideBarTittle/SideBarTittle.tsx → SideBarTitle/SideBarTitle.tsx} +20 -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 +39 -6
- package/src/components/Versions/TagList.tsx +4 -3
- package/src/components/Versions/Versions.test.tsx +40 -7
- package/src/components/Versions/Versions.tsx +88 -19
- package/src/components/Versions/__partials__/data.json +1 -0
- package/src/components/Versions/__partials__/deprecated-versions.json +175 -0
- package/src/index.ts +6 -2
- package/src/providers/AppConfigurationProvider/AppConfigurationProvider.tsx +2 -0
- package/src/providers/PersistenceSettingProvider/PersistenceSettingProvider.tsx +4 -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/download.ts +0 -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 +8 -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/SideBarTittle/SideBarTittle.js +0 -94
- 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/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/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
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import * as DOMPurify from 'dompurify';
|
|
2
|
-
import
|
|
2
|
+
import { Marked } from 'marked';
|
|
3
|
+
import { markedHighlight } from 'marked-highlight';
|
|
4
|
+
|
|
5
|
+
const marked = new Marked(
|
|
6
|
+
markedHighlight({
|
|
7
|
+
async: false,
|
|
8
|
+
highlight(code, lang) {
|
|
9
|
+
const hljs = require('highlight.js');
|
|
10
|
+
const language = hljs.getLanguage(lang) ? lang : 'plaintext';
|
|
11
|
+
return hljs.highlight(code, { language }).value;
|
|
12
|
+
},
|
|
13
|
+
})
|
|
14
|
+
);
|
|
3
15
|
|
|
4
16
|
marked.setOptions({
|
|
5
17
|
renderer: new marked.Renderer(),
|
|
6
|
-
highlight: function (code, lang) {
|
|
7
|
-
const hljs = require('highlight.js');
|
|
8
|
-
const language = hljs.getLanguage(lang) ? lang : 'plaintext';
|
|
9
|
-
return hljs.highlight(code, { language }).value;
|
|
10
|
-
},
|
|
11
|
-
langPrefix: 'hljs language-', // highlight.js css expects a top-level 'hljs' class.
|
|
12
18
|
pedantic: false,
|
|
13
19
|
gfm: true,
|
|
14
20
|
breaks: false,
|
|
15
|
-
mangle: false,
|
|
16
|
-
xhtml: false,
|
|
17
21
|
});
|
|
18
22
|
|
|
19
23
|
export function parseReadme(readme: string): string | void {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return DOMPurify.sanitize(html);
|
|
23
|
-
}
|
|
24
|
-
return '';
|
|
24
|
+
const html = marked.parse(readme);
|
|
25
|
+
return DOMPurify.sanitize(html);
|
|
25
26
|
}
|
|
@@ -4,10 +4,11 @@ import DialogTitle from '@mui/material/DialogTitle';
|
|
|
4
4
|
|
|
5
5
|
import { Theme } from '../../';
|
|
6
6
|
|
|
7
|
-
export const Title = styled(DialogTitle)<{ theme?: Theme }>((
|
|
8
|
-
backgroundColor:
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
export const Title = styled(DialogTitle)<{ theme?: Theme }>(({ theme }) => ({
|
|
8
|
+
backgroundColor:
|
|
9
|
+
theme?.palette.mode === 'light' ? theme?.palette.primary.main : theme?.palette.cyanBlue,
|
|
10
|
+
color: theme?.palette.white,
|
|
11
|
+
fontSize: theme?.fontSize.lg,
|
|
11
12
|
}));
|
|
12
13
|
|
|
13
14
|
export const Content = styled(DialogContent)<{ theme?: Theme }>(({ theme }) => ({
|
|
@@ -4,6 +4,7 @@ import List from '@mui/material/List';
|
|
|
4
4
|
import ListItem from '@mui/material/ListItem';
|
|
5
5
|
import ListItemText from '@mui/material/ListItemText';
|
|
6
6
|
import Typography from '@mui/material/Typography';
|
|
7
|
+
import { useTheme } from '@mui/styles';
|
|
7
8
|
import React from 'react';
|
|
8
9
|
import { useTranslation } from 'react-i18next';
|
|
9
10
|
|
|
@@ -11,20 +12,13 @@ import { Theme } from '../../Theme';
|
|
|
11
12
|
import { url as urlUtils } from '../../utils';
|
|
12
13
|
import CopyClipboard from '../CopyClipboard';
|
|
13
14
|
import { Git } from '../Icons';
|
|
14
|
-
import
|
|
15
|
+
import LinkExternal from '../LinkExternal';
|
|
15
16
|
|
|
16
17
|
const StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({
|
|
17
18
|
fontWeight: props.theme?.fontWeight.bold,
|
|
18
19
|
textTransform: 'capitalize',
|
|
19
20
|
}));
|
|
20
21
|
|
|
21
|
-
const GithubLink = styled(Link)<{ theme?: Theme }>(({ theme }) => ({
|
|
22
|
-
color: theme?.palette.mode === 'light' ? theme?.palette.primary.main : theme?.palette.white,
|
|
23
|
-
':hover': {
|
|
24
|
-
color: theme?.palette.dodgerBlue,
|
|
25
|
-
},
|
|
26
|
-
}));
|
|
27
|
-
|
|
28
22
|
const RepositoryListItem = styled(ListItem)({
|
|
29
23
|
padding: 0,
|
|
30
24
|
':hover': {
|
|
@@ -33,20 +27,19 @@ const RepositoryListItem = styled(ListItem)({
|
|
|
33
27
|
});
|
|
34
28
|
|
|
35
29
|
const RepositoryListItemText = styled(ListItemText)({
|
|
36
|
-
padding: '0 10px',
|
|
30
|
+
padding: '0 0 0 10px',
|
|
37
31
|
margin: 0,
|
|
38
32
|
});
|
|
39
33
|
|
|
40
34
|
const RepositoryAvatar = styled(Avatar)({
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
backgroundColor: 'transparent',
|
|
45
|
-
},
|
|
35
|
+
padding: 0,
|
|
36
|
+
marginLeft: 0,
|
|
37
|
+
backgroundColor: 'transparent',
|
|
46
38
|
});
|
|
47
39
|
|
|
48
40
|
const Repository: React.FC<{ packageMeta: any }> = ({ packageMeta }) => {
|
|
49
41
|
const { t } = useTranslation();
|
|
42
|
+
const theme = useTheme();
|
|
50
43
|
const url = packageMeta?.latest?.repository?.url;
|
|
51
44
|
if (!url || !urlUtils.isURL(url)) {
|
|
52
45
|
return null;
|
|
@@ -68,15 +61,15 @@ const Repository: React.FC<{ packageMeta: any }> = ({ packageMeta }) => {
|
|
|
68
61
|
subheader={<StyledText variant="subtitle1">{t('sidebar.repository.title')}</StyledText>}
|
|
69
62
|
>
|
|
70
63
|
<RepositoryListItem>
|
|
71
|
-
<RepositoryAvatar sx={{
|
|
64
|
+
<RepositoryAvatar sx={{ bgcolor: theme.palette.white }}>
|
|
72
65
|
<Git />
|
|
73
66
|
</RepositoryAvatar>
|
|
74
67
|
<RepositoryListItemText
|
|
75
68
|
primary={
|
|
76
69
|
<CopyClipboard dataTestId="repositoryID" text={repositoryURL} title={repositoryURL}>
|
|
77
|
-
<
|
|
70
|
+
<LinkExternal to={repositoryURL} variant="outline">
|
|
78
71
|
{repositoryURL}
|
|
79
|
-
</
|
|
72
|
+
</LinkExternal>
|
|
80
73
|
</CopyClipboard>
|
|
81
74
|
}
|
|
82
75
|
/>
|
|
@@ -68,7 +68,7 @@ const AutoComplete: FC<Props> = ({
|
|
|
68
68
|
inputValue={inputValue}
|
|
69
69
|
loading={suggestionsLoading}
|
|
70
70
|
loadingText={t('autoComplete.loading')}
|
|
71
|
-
onChange={onSelectItem}
|
|
71
|
+
onChange={onSelectItem as any}
|
|
72
72
|
onClose={handleOnClose}
|
|
73
73
|
onInputChange={handleOnInputChange}
|
|
74
74
|
options={suggestions}
|
|
@@ -4,6 +4,7 @@ import { BrowserRouter as Router } from 'react-router-dom';
|
|
|
4
4
|
import { api, store } from '../../';
|
|
5
5
|
import { fireEvent, renderWithStore, screen, waitFor } from '../../test/test-react-testing-library';
|
|
6
6
|
import Search from './Search';
|
|
7
|
+
import { cleanDescription } from './utils';
|
|
7
8
|
|
|
8
9
|
jest.mock('lodash/debounce', () =>
|
|
9
10
|
jest.fn((fn) => {
|
|
@@ -40,12 +41,12 @@ describe('<Search /> component', () => {
|
|
|
40
41
|
});
|
|
41
42
|
|
|
42
43
|
test('should load the component in default state', () => {
|
|
43
|
-
|
|
44
|
-
expect(
|
|
44
|
+
renderWithStore(<ComponentToBeRendered />, store);
|
|
45
|
+
expect(screen.getByPlaceholderText('search.packages')).toBeInTheDocument();
|
|
45
46
|
});
|
|
46
47
|
|
|
47
48
|
test('handleSearch: when user type package name in search component, show suggestions', async () => {
|
|
48
|
-
const { getByPlaceholderText,
|
|
49
|
+
const { getByPlaceholderText, findAllByText } = renderWithStore(
|
|
49
50
|
<ComponentToBeRendered />,
|
|
50
51
|
store
|
|
51
52
|
);
|
|
@@ -57,14 +58,14 @@ describe('<Search /> component', () => {
|
|
|
57
58
|
|
|
58
59
|
expect(autoCompleteInput).toHaveAttribute('value', 'verdaccio');
|
|
59
60
|
|
|
60
|
-
const suggestionsElements = await waitFor(() =>
|
|
61
|
+
const suggestionsElements = await waitFor(() => findAllByText('verdaccio', { exact: true }));
|
|
61
62
|
|
|
62
63
|
expect(suggestionsElements).toHaveLength(1);
|
|
63
64
|
expect(api.request).toHaveBeenCalledTimes(1);
|
|
64
65
|
});
|
|
65
66
|
|
|
66
67
|
test('onBlur: should cancel all search requests', async () => {
|
|
67
|
-
const { getByPlaceholderText,
|
|
68
|
+
const { getByPlaceholderText, findAllByText } = renderWithStore(
|
|
68
69
|
<ComponentToBeRendered />,
|
|
69
70
|
store
|
|
70
71
|
);
|
|
@@ -75,7 +76,7 @@ describe('<Search /> component', () => {
|
|
|
75
76
|
fireEvent.change(autoCompleteInput, { target: { value: 'verdaccio' } });
|
|
76
77
|
expect(autoCompleteInput).toHaveAttribute('value', 'verdaccio');
|
|
77
78
|
|
|
78
|
-
const suggestionsElements = await waitFor(() =>
|
|
79
|
+
const suggestionsElements = await waitFor(() => findAllByText('verdaccio', { exact: true }));
|
|
79
80
|
expect(suggestionsElements).toHaveLength(1);
|
|
80
81
|
expect(api.request).toHaveBeenCalledTimes(1);
|
|
81
82
|
|
|
@@ -110,7 +111,7 @@ describe('<Search /> component', () => {
|
|
|
110
111
|
});
|
|
111
112
|
|
|
112
113
|
test('handlePackagesClearRequested: should clear suggestions', async () => {
|
|
113
|
-
const { getByPlaceholderText,
|
|
114
|
+
const { getByPlaceholderText, findAllByText } = renderWithStore(
|
|
114
115
|
<ComponentToBeRendered />,
|
|
115
116
|
store
|
|
116
117
|
);
|
|
@@ -120,18 +121,18 @@ describe('<Search /> component', () => {
|
|
|
120
121
|
fireEvent.change(autoCompleteInput, { target: { value: 'verdaccio' } });
|
|
121
122
|
expect(autoCompleteInput).toHaveAttribute('value', 'verdaccio');
|
|
122
123
|
|
|
123
|
-
const suggestionsElements = await waitFor(() =>
|
|
124
|
+
const suggestionsElements = await waitFor(() => findAllByText('verdaccio', { exact: true }));
|
|
124
125
|
expect(suggestionsElements).toHaveLength(1);
|
|
125
126
|
|
|
126
127
|
fireEvent.change(autoCompleteInput, { target: { value: ' ' } });
|
|
127
128
|
const listBoxElement = screen.queryAllByRole('listbox');
|
|
128
|
-
//
|
|
129
|
+
// when the page redirects, the list box should be empty again
|
|
129
130
|
expect(listBoxElement).toHaveLength(0);
|
|
130
131
|
expect(api.request).toHaveBeenCalledTimes(1);
|
|
131
132
|
});
|
|
132
133
|
|
|
133
134
|
test('handleClickSearch: should change the window location on click or return key', async () => {
|
|
134
|
-
const { getByPlaceholderText,
|
|
135
|
+
const { getByPlaceholderText, findAllByText } = renderWithStore(
|
|
135
136
|
<ComponentToBeRendered />,
|
|
136
137
|
store
|
|
137
138
|
);
|
|
@@ -141,7 +142,7 @@ describe('<Search /> component', () => {
|
|
|
141
142
|
fireEvent.change(autoCompleteInput, { target: { value: 'verdaccio' } });
|
|
142
143
|
expect(autoCompleteInput).toHaveAttribute('value', 'verdaccio');
|
|
143
144
|
|
|
144
|
-
const suggestionsElements = await waitFor(() =>
|
|
145
|
+
const suggestionsElements = await waitFor(() => findAllByText('verdaccio', { exact: true }));
|
|
145
146
|
// console.log('suggestionsElements', suggestionsElements);
|
|
146
147
|
expect(suggestionsElements).toHaveLength(1);
|
|
147
148
|
// click on the second suggestion
|
|
@@ -151,3 +152,29 @@ describe('<Search /> component', () => {
|
|
|
151
152
|
expect(listBoxElement).toHaveLength(0);
|
|
152
153
|
});
|
|
153
154
|
});
|
|
155
|
+
|
|
156
|
+
describe('cleanDescription', () => {
|
|
157
|
+
test('should return plain text', () => {
|
|
158
|
+
const description = 'Hello, Mars!';
|
|
159
|
+
const output = cleanDescription(description);
|
|
160
|
+
expect(output).toBe(description);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
test('should remove html tags from description', () => {
|
|
164
|
+
const description = '<h1>verdaccio</h1>';
|
|
165
|
+
const output = cleanDescription(description);
|
|
166
|
+
expect(output).toBe('verdaccio');
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
test('should remove markdown links from description', () => {
|
|
170
|
+
const description = '[verdaccio](https://verdaccio.org)';
|
|
171
|
+
const output = cleanDescription(description);
|
|
172
|
+
expect(output).toBe('verdaccio');
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
test('should remove markdown links', () => {
|
|
176
|
+
const description = '[]';
|
|
177
|
+
const output = cleanDescription(description);
|
|
178
|
+
expect(output).toBe('NPM version');
|
|
179
|
+
});
|
|
180
|
+
});
|
|
@@ -9,6 +9,7 @@ import { RouteComponentProps, withRouter } from 'react-router';
|
|
|
9
9
|
import { SearchResultWeb } from '@verdaccio/types';
|
|
10
10
|
|
|
11
11
|
import { Dispatch, RootState, useConfig } from '../../';
|
|
12
|
+
import { Route } from '../../utils';
|
|
12
13
|
import AutoComplete from './AutoComplete';
|
|
13
14
|
import SearchItem from './SearchItem';
|
|
14
15
|
import { StyledInputAdornment, StyledTextField } from './styles';
|
|
@@ -27,6 +28,7 @@ const Search: React.FC<RouteComponentProps> = ({ history }) => {
|
|
|
27
28
|
const { suggestions } = useSelector((state: RootState) => state.search);
|
|
28
29
|
const isLoading = useSelector((state: RootState) => state?.loading?.models.search);
|
|
29
30
|
const dispatch = useDispatch<Dispatch>();
|
|
31
|
+
|
|
30
32
|
/**
|
|
31
33
|
* Cancel all the requests which are in pending state.
|
|
32
34
|
*/
|
|
@@ -60,9 +62,9 @@ const Search: React.FC<RouteComponentProps> = ({ history }) => {
|
|
|
60
62
|
if (searchRemote) {
|
|
61
63
|
// TODO: check this part
|
|
62
64
|
// @ts-ignore
|
|
63
|
-
history.push(
|
|
65
|
+
history.push(`${Route.DETAIL}${value.package.name}`);
|
|
64
66
|
} else {
|
|
65
|
-
history.push(
|
|
67
|
+
history.push(`${Route.DETAIL}${value.name}`);
|
|
66
68
|
}
|
|
67
69
|
break;
|
|
68
70
|
}
|
|
@@ -9,6 +9,8 @@ import Stack from '@mui/material/Stack';
|
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import { useTranslation } from 'react-i18next';
|
|
11
11
|
|
|
12
|
+
import { cleanDescription } from './utils';
|
|
13
|
+
|
|
12
14
|
type SearchItemProps = {
|
|
13
15
|
name: string;
|
|
14
16
|
version?: string;
|
|
@@ -28,15 +30,23 @@ export const Description = styled('div')<{ theme?: Theme }>(({ theme }) => ({
|
|
|
28
30
|
display: 'none',
|
|
29
31
|
color: theme?.palette?.greyLight2,
|
|
30
32
|
lineHeight: '1.5rem',
|
|
33
|
+
whiteSpace: 'nowrap',
|
|
34
|
+
textOverflow: 'ellipsis',
|
|
35
|
+
alignItems: 'center',
|
|
36
|
+
overflow: 'hidden',
|
|
37
|
+
paddingLeft: theme.spacing(),
|
|
38
|
+
fontSize: theme?.fontSize.ssm,
|
|
39
|
+
[`@media (min-width: ${theme?.breakPoints.medium}px)`]: {
|
|
40
|
+
display: 'block',
|
|
41
|
+
width: '300px',
|
|
42
|
+
},
|
|
31
43
|
[`@media (min-width: ${theme?.breakPoints.large}px)`]: {
|
|
32
44
|
display: 'block',
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
paddingLeft: theme.spacing(),
|
|
39
|
-
fontSize: theme?.fontSize.ssm,
|
|
45
|
+
width: '500px',
|
|
46
|
+
},
|
|
47
|
+
[`@media (min-width: 1440px)`]: {
|
|
48
|
+
display: 'block',
|
|
49
|
+
width: '600px',
|
|
40
50
|
},
|
|
41
51
|
}));
|
|
42
52
|
|
|
@@ -68,11 +78,12 @@ const SearchItem: React.FC<SearchItemProps> = ({
|
|
|
68
78
|
// no action assigned by default
|
|
69
79
|
};
|
|
70
80
|
return (
|
|
81
|
+
// eslint-disable-next-line verdaccio/jsx-no-style
|
|
71
82
|
<li {...props} style={{ flexDirection: 'column' }}>
|
|
72
83
|
<Wrapper>
|
|
73
84
|
<NameGroup>
|
|
74
85
|
<Name>{name}</Name>
|
|
75
|
-
{description && <Description>{description}</Description>}
|
|
86
|
+
{description && <Description>{cleanDescription(description)}</Description>}
|
|
76
87
|
</NameGroup>
|
|
77
88
|
{version && <Version>{version}</Version>}
|
|
78
89
|
</Wrapper>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
function removeHtmlTags(input: string): string {
|
|
2
|
+
let previous;
|
|
3
|
+
do {
|
|
4
|
+
previous = input;
|
|
5
|
+
input = input.replace(/<[^>]*>?/gm, '');
|
|
6
|
+
} while (input !== previous);
|
|
7
|
+
return input;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function cleanDescription(description: string): string {
|
|
11
|
+
let output = description;
|
|
12
|
+
// remove html tags from description (e.g. <h1...>)
|
|
13
|
+
output = removeHtmlTags(output);
|
|
14
|
+
// remove markdown links from description (e.g. [link](url))
|
|
15
|
+
output = output.replace(/\(.*?\)/gm, '').replace(/(\[!?|\])/gm, '');
|
|
16
|
+
return output;
|
|
17
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { fireEvent, render, screen } from '../../test/test-react-testing-library';
|
|
4
|
+
import SettingsMenu from './SettingsMenu';
|
|
5
|
+
|
|
6
|
+
describe('<SettingsMenu />', () => {
|
|
7
|
+
test('should handle menu open and close', async () => {
|
|
8
|
+
render(<SettingsMenu packageName="foo" />);
|
|
9
|
+
const button = screen.getByRole('button');
|
|
10
|
+
fireEvent.click(button);
|
|
11
|
+
await screen.findByRole('menu');
|
|
12
|
+
// TODO onClose
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test('should handle latest select', () => {
|
|
16
|
+
const { getByRole, getByText } = render(<SettingsMenu packageName="foo" />);
|
|
17
|
+
const button = getByRole('button');
|
|
18
|
+
fireEvent.click(button);
|
|
19
|
+
const menuItem = getByText('sidebar.installation.latest');
|
|
20
|
+
fireEvent.click(menuItem);
|
|
21
|
+
expect(getByText('sidebar.installation.latest')).toBeInTheDocument();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test('should handle global select', () => {
|
|
25
|
+
const { getByRole, getByText } = render(<SettingsMenu packageName="foo" />);
|
|
26
|
+
const button = getByRole('button');
|
|
27
|
+
fireEvent.click(button);
|
|
28
|
+
const menuItem = getByText('sidebar.installation.global');
|
|
29
|
+
fireEvent.click(menuItem);
|
|
30
|
+
expect(getByText('sidebar.installation.global')).toBeInTheDocument();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test('should handle yarn modern select', () => {
|
|
34
|
+
const { getByRole, getByText } = render(<SettingsMenu packageName="foo" />);
|
|
35
|
+
const button = getByRole('button');
|
|
36
|
+
fireEvent.click(button);
|
|
37
|
+
const menuItem = getByText('sidebar.installation.yarnModern');
|
|
38
|
+
fireEvent.click(menuItem);
|
|
39
|
+
expect(getByText('sidebar.installation.yarnModern')).toBeInTheDocument();
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -7,28 +7,57 @@ import MenuItem from '@mui/material/MenuItem';
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { useTranslation } from 'react-i18next';
|
|
9
9
|
|
|
10
|
+
import { useConfig } from '../../providers';
|
|
10
11
|
import { useSettings } from '../../providers/PersistenceSettingProvider';
|
|
11
12
|
|
|
12
13
|
interface Props {
|
|
13
14
|
packageName: string;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
const
|
|
17
|
+
const SettingsMenu: React.FC<Props> = ({ packageName }) => {
|
|
17
18
|
const { t } = useTranslation();
|
|
18
19
|
const { localSettings, updateSettings } = useSettings();
|
|
20
|
+
const { configOptions } = useConfig();
|
|
19
21
|
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
|
|
20
22
|
const open = Boolean(anchorEl);
|
|
21
23
|
const handleOpenMenu = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
22
24
|
setAnchorEl(event.currentTarget);
|
|
23
25
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
updateSettings({
|
|
26
|
+
|
|
27
|
+
const handleLatestSelect = () => {
|
|
28
|
+
updateSettings({
|
|
29
|
+
...localSettings,
|
|
30
|
+
[packageName]: {
|
|
31
|
+
global: localSettings[packageName]?.global,
|
|
32
|
+
latest: !localSettings[packageName]?.latest,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
27
35
|
setAnchorEl(null);
|
|
28
36
|
};
|
|
37
|
+
|
|
38
|
+
const handleGlobalSelect = () => {
|
|
39
|
+
updateSettings({
|
|
40
|
+
...localSettings,
|
|
41
|
+
[packageName]: {
|
|
42
|
+
global: !localSettings[packageName]?.global,
|
|
43
|
+
latest: localSettings[packageName]?.latest,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
setAnchorEl(null);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const handleGlobalYarnModern = () => {
|
|
50
|
+
const statusYarnModern = !localSettings?.yarnModern;
|
|
51
|
+
updateSettings({ ...localSettings, yarnModern: statusYarnModern });
|
|
52
|
+
setAnchorEl(null);
|
|
53
|
+
};
|
|
54
|
+
|
|
29
55
|
const handleClose = () => {
|
|
30
56
|
setAnchorEl(null);
|
|
31
57
|
};
|
|
58
|
+
|
|
59
|
+
const statusLatest = localSettings[packageName]?.latest;
|
|
60
|
+
const statusGlobal = localSettings[packageName]?.global;
|
|
32
61
|
return (
|
|
33
62
|
<>
|
|
34
63
|
<IconButton
|
|
@@ -46,22 +75,50 @@ const InstallListItem: React.FC<Props> = ({ packageName }) => {
|
|
|
46
75
|
'aria-labelledby': 'basic-button',
|
|
47
76
|
}}
|
|
48
77
|
anchorEl={anchorEl}
|
|
78
|
+
anchorOrigin={{
|
|
79
|
+
vertical: 'bottom',
|
|
80
|
+
horizontal: 'right',
|
|
81
|
+
}}
|
|
49
82
|
id="basic-menu"
|
|
50
83
|
onClose={handleClose}
|
|
51
84
|
open={open}
|
|
85
|
+
transformOrigin={{
|
|
86
|
+
vertical: 'top',
|
|
87
|
+
horizontal: 'right',
|
|
88
|
+
}}
|
|
52
89
|
>
|
|
53
|
-
<MenuItem onClick={
|
|
90
|
+
<MenuItem onClick={handleLatestSelect}>
|
|
91
|
+
{' '}
|
|
92
|
+
{statusLatest === true ? (
|
|
93
|
+
<ListItemIcon>
|
|
94
|
+
<Check />
|
|
95
|
+
</ListItemIcon>
|
|
96
|
+
) : null}
|
|
97
|
+
{t('sidebar.installation.latest')}
|
|
98
|
+
</MenuItem>
|
|
99
|
+
<MenuItem onClick={handleGlobalSelect}>
|
|
54
100
|
{' '}
|
|
55
|
-
{
|
|
101
|
+
{statusGlobal === true ? (
|
|
56
102
|
<ListItemIcon>
|
|
57
103
|
<Check />
|
|
58
104
|
</ListItemIcon>
|
|
59
105
|
) : null}
|
|
60
106
|
{t('sidebar.installation.global')}
|
|
61
107
|
</MenuItem>
|
|
108
|
+
{configOptions?.pkgManagers?.includes('yarn') && (
|
|
109
|
+
<MenuItem onClick={handleGlobalYarnModern}>
|
|
110
|
+
{' '}
|
|
111
|
+
{localSettings?.yarnModern ? (
|
|
112
|
+
<ListItemIcon>
|
|
113
|
+
<Check />
|
|
114
|
+
</ListItemIcon>
|
|
115
|
+
) : null}
|
|
116
|
+
{t('sidebar.installation.yarnModern')}
|
|
117
|
+
</MenuItem>
|
|
118
|
+
)}
|
|
62
119
|
</Menu>
|
|
63
120
|
</>
|
|
64
121
|
);
|
|
65
122
|
};
|
|
66
123
|
|
|
67
|
-
export default
|
|
124
|
+
export default SettingsMenu;
|
|
@@ -20,11 +20,23 @@ interface Props {
|
|
|
20
20
|
time: string;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
const Icon = styled.div<{ theme?: Theme }>(({ theme }) => ({
|
|
24
|
+
marginLeft: theme?.spacing(1),
|
|
25
|
+
}));
|
|
26
|
+
|
|
23
27
|
const ModuleJS: React.FC<{ module: ModuleType | void }> = ({ module }) => {
|
|
24
28
|
if (module === 'commonjs') {
|
|
25
|
-
return
|
|
29
|
+
return (
|
|
30
|
+
<Icon>
|
|
31
|
+
<CommonJS />
|
|
32
|
+
</Icon>
|
|
33
|
+
);
|
|
26
34
|
} else if (module === 'module') {
|
|
27
|
-
return
|
|
35
|
+
return (
|
|
36
|
+
<Icon>
|
|
37
|
+
<ES6Modules />
|
|
38
|
+
</Icon>
|
|
39
|
+
);
|
|
28
40
|
} else {
|
|
29
41
|
return null;
|
|
30
42
|
}
|
|
@@ -46,7 +58,11 @@ const DetailSidebarTitle: React.FC<Props> = ({
|
|
|
46
58
|
<TitleWrapper>
|
|
47
59
|
<>
|
|
48
60
|
{packageName}
|
|
49
|
-
{hasTypes &&
|
|
61
|
+
{hasTypes && (
|
|
62
|
+
<Icon>
|
|
63
|
+
<TypeScript />
|
|
64
|
+
</Icon>
|
|
65
|
+
)}
|
|
50
66
|
<ModuleJS module={moduleType} />
|
|
51
67
|
</>
|
|
52
68
|
</TitleWrapper>
|
|
@@ -78,4 +94,5 @@ const StyledHeading = styled(Heading)({
|
|
|
78
94
|
|
|
79
95
|
const StyledBoxVersion = styled(Box)<{ theme?: Theme }>(({ theme }) => ({
|
|
80
96
|
color: theme?.palette.text.secondary,
|
|
97
|
+
fontSize: theme?.fontSize.sm,
|
|
81
98
|
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SideBarTitle';
|
|
@@ -44,4 +44,11 @@ describe('<UpLinks /> component', () => {
|
|
|
44
44
|
|
|
45
45
|
expect(wrapper).toMatchSnapshot();
|
|
46
46
|
});
|
|
47
|
+
|
|
48
|
+
test('should not render if input is missing', () => {
|
|
49
|
+
const wrapper = render(<UpLinks packageMeta={undefined} />);
|
|
50
|
+
// expect nothing to be rendered
|
|
51
|
+
expect(wrapper.queryByTestId('no-uplinks-npm')).toBeNull();
|
|
52
|
+
expect(wrapper.queryByTestId('uplinks')).toBeNull();
|
|
53
|
+
});
|
|
47
54
|
});
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import Box from '@mui/material/Box';
|
|
2
|
+
import Card from '@mui/material/Card';
|
|
3
|
+
import CardContent from '@mui/material/CardContent';
|
|
1
4
|
import List from '@mui/material/List';
|
|
2
5
|
import ListItem from '@mui/material/ListItem';
|
|
3
6
|
import React from 'react';
|
|
@@ -5,6 +8,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
5
8
|
|
|
6
9
|
import { utils } from '../../utils';
|
|
7
10
|
import NoItems from '../NoItems';
|
|
11
|
+
import UpLinkLink from './UplinkLink';
|
|
8
12
|
import { ListItemText, Spacer, StyledText } from './styles';
|
|
9
13
|
|
|
10
14
|
const UpLinks: React.FC<{ packageMeta: any }> = ({ packageMeta }) => {
|
|
@@ -17,24 +21,43 @@ const UpLinks: React.FC<{ packageMeta: any }> = ({ packageMeta }) => {
|
|
|
17
21
|
const { _uplinks: uplinks, latest } = packageMeta;
|
|
18
22
|
|
|
19
23
|
if (Object.keys(uplinks).length === 0) {
|
|
20
|
-
return
|
|
24
|
+
return (
|
|
25
|
+
<Card sx={{ mb: 2 }}>
|
|
26
|
+
<CardContent>
|
|
27
|
+
<NoItems data-testid="no-uplinks" text={t('uplinks.no-items', { name: latest.name })} />
|
|
28
|
+
</CardContent>
|
|
29
|
+
</Card>
|
|
30
|
+
);
|
|
21
31
|
}
|
|
22
32
|
|
|
23
33
|
return (
|
|
24
|
-
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
<Card sx={{ mb: 2 }}>
|
|
35
|
+
<CardContent>
|
|
36
|
+
<Box data-testid="uplinks" sx={{ m: 2 }}>
|
|
37
|
+
<StyledText variant="subtitle1">{t('uplinks.title')}</StyledText>
|
|
38
|
+
<List dense={true}>
|
|
39
|
+
{Object.keys(uplinks)
|
|
40
|
+
.reverse()
|
|
41
|
+
.map((name) => (
|
|
42
|
+
<ListItem
|
|
43
|
+
className="version-item"
|
|
44
|
+
data-testid={`uplink-${name}`}
|
|
45
|
+
key={name}
|
|
46
|
+
sx={{ pr: 0 }}
|
|
47
|
+
>
|
|
48
|
+
<ListItemText>
|
|
49
|
+
<UpLinkLink packageName={latest.name} uplinkName={name} />
|
|
50
|
+
</ListItemText>
|
|
51
|
+
<Spacer />
|
|
52
|
+
<ListItemText title={utils.formatDate(uplinks[name].fetched)}>
|
|
53
|
+
{utils.formatDateDistance(uplinks[name].fetched)}
|
|
54
|
+
</ListItemText>
|
|
55
|
+
</ListItem>
|
|
56
|
+
))}
|
|
57
|
+
</List>
|
|
58
|
+
</Box>
|
|
59
|
+
</CardContent>
|
|
60
|
+
</Card>
|
|
38
61
|
);
|
|
39
62
|
};
|
|
40
63
|
|