@verdaccio/ui-components 5.0.0-next-9.19 → 5.0.0-next-9.21
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/build/api/use-data-mutation.js +1 -4
- package/build/api/use-data-mutation.js.map +1 -1
- package/build/api/use-data-mutation.mjs +1 -4
- package/build/api/use-data-mutation.mjs.map +1 -1
- package/build/api/use-data.d.ts +1 -0
- package/build/api/use-data.js +3 -2
- package/build/api/use-data.js.map +1 -1
- package/build/api/use-data.mjs +3 -3
- package/build/api/use-data.mjs.map +1 -1
- package/build/components/ActionBar/ActionBar.js +4 -2
- package/build/components/ActionBar/ActionBar.js.map +1 -1
- package/build/components/ActionBar/ActionBar.mjs +4 -2
- package/build/components/ActionBar/ActionBar.mjs.map +1 -1
- package/build/components/ActionBar/ActionBarAction.js +1 -1
- package/build/components/ActionBar/ActionBarAction.mjs +1 -1
- package/build/components/AppRoute/AppRoute.js +13 -0
- package/build/components/AppRoute/AppRoute.js.map +1 -1
- package/build/components/AppRoute/AppRoute.mjs +13 -0
- package/build/components/AppRoute/AppRoute.mjs.map +1 -1
- package/build/components/Author/Author.js +1 -1
- package/build/components/Author/Author.mjs +1 -1
- package/build/components/CopyClipboard/CopyToClipBoard.js +5 -0
- package/build/components/CopyClipboard/CopyToClipBoard.js.map +1 -1
- package/build/components/CopyClipboard/CopyToClipBoard.mjs +5 -0
- package/build/components/CopyClipboard/CopyToClipBoard.mjs.map +1 -1
- package/build/components/CopyClipboard/utils.js +14 -1
- package/build/components/CopyClipboard/utils.js.map +1 -1
- package/build/components/CopyClipboard/utils.mjs +14 -1
- package/build/components/CopyClipboard/utils.mjs.map +1 -1
- package/build/components/Dependencies/Dependencies.js +2 -1
- package/build/components/Dependencies/Dependencies.js.map +1 -1
- package/build/components/Dependencies/Dependencies.mjs +2 -1
- package/build/components/Dependencies/Dependencies.mjs.map +1 -1
- package/build/components/Dependencies/DependencyBlock.js +1 -1
- package/build/components/Dependencies/DependencyBlock.mjs +1 -1
- package/build/components/Developers/Title.js +1 -1
- package/build/components/Developers/Title.mjs +1 -1
- package/build/components/Developers/get-unique-developer-values.js +2 -1
- package/build/components/Developers/get-unique-developer-values.js.map +1 -1
- package/build/components/Developers/get-unique-developer-values.mjs +2 -1
- package/build/components/Developers/get-unique-developer-values.mjs.map +1 -1
- package/build/components/Distribution/Dist.js +3 -3
- package/build/components/Distribution/Dist.js.map +1 -1
- package/build/components/Distribution/Dist.mjs +3 -3
- package/build/components/Distribution/Dist.mjs.map +1 -1
- package/build/components/Engines/Engines.js +1 -1
- package/build/components/Engines/Engines.mjs +1 -1
- package/build/components/Forbidden/Forbidden.js +1 -1
- package/build/components/Forbidden/Forbidden.mjs +1 -1
- package/build/components/FundButton/FundButton.js +4 -3
- package/build/components/FundButton/FundButton.js.map +1 -1
- package/build/components/FundButton/FundButton.mjs +4 -3
- package/build/components/FundButton/FundButton.mjs.map +1 -1
- package/build/components/GenericError/GenericError.d.ts +3 -0
- package/build/components/GenericError/GenericError.js +60 -0
- package/build/components/GenericError/GenericError.js.map +1 -0
- package/build/components/GenericError/GenericError.mjs +54 -0
- package/build/components/GenericError/GenericError.mjs.map +1 -0
- package/build/components/GenericError/index.d.ts +1 -0
- package/build/components/GenericError/index.js +2 -0
- package/build/components/GenericError/index.mjs +2 -0
- package/build/components/Help/Help.js +1 -1
- package/build/components/Help/Help.mjs +1 -1
- package/build/components/Install/Install.js +1 -1
- package/build/components/Install/Install.mjs +1 -1
- package/build/components/Install/InstallListItem.js +2 -2
- package/build/components/Install/InstallListItem.js.map +1 -1
- package/build/components/Install/InstallListItem.mjs +2 -2
- package/build/components/Install/InstallListItem.mjs.map +1 -1
- package/build/components/Keywords/KeywordListItems.js +1 -1
- package/build/components/Keywords/KeywordListItems.js.map +1 -1
- package/build/components/Keywords/KeywordListItems.mjs +1 -1
- package/build/components/Keywords/KeywordListItems.mjs.map +1 -1
- package/build/components/Keywords/Keywords.js +2 -2
- package/build/components/Keywords/Keywords.js.map +1 -1
- package/build/components/Keywords/Keywords.mjs +2 -2
- package/build/components/Keywords/Keywords.mjs.map +1 -1
- package/build/components/LoginDialog/LoginDialogCloseButton.js +1 -1
- package/build/components/LoginDialog/LoginDialogCloseButton.mjs +1 -1
- package/build/components/LoginDialog/LoginDialogForm.js +2 -1
- package/build/components/LoginDialog/LoginDialogForm.js.map +1 -1
- package/build/components/LoginDialog/LoginDialogForm.mjs +2 -1
- package/build/components/LoginDialog/LoginDialogForm.mjs.map +1 -1
- package/build/components/LoginForm/Login.d.ts +1 -0
- package/build/components/LoginForm/Login.js +6 -4
- package/build/components/LoginForm/Login.js.map +1 -1
- package/build/components/LoginForm/Login.mjs +9 -7
- package/build/components/LoginForm/Login.mjs.map +1 -1
- package/build/components/LoginForm/PasswordField.js +4 -6
- package/build/components/LoginForm/PasswordField.js.map +1 -1
- package/build/components/LoginForm/PasswordField.mjs +4 -6
- package/build/components/LoginForm/PasswordField.mjs.map +1 -1
- package/build/components/LoginForm/UsernameField.js +4 -6
- package/build/components/LoginForm/UsernameField.js.map +1 -1
- package/build/components/LoginForm/UsernameField.mjs +4 -6
- package/build/components/LoginForm/UsernameField.mjs.map +1 -1
- package/build/components/LoginForm/styles.js +1 -1
- package/build/components/LoginForm/styles.mjs +1 -1
- package/build/components/LoginForm/useLoginForm.js +13 -3
- package/build/components/LoginForm/useLoginForm.js.map +1 -1
- package/build/components/LoginForm/useLoginForm.mjs +14 -4
- package/build/components/LoginForm/useLoginForm.mjs.map +1 -1
- package/build/components/NoItems/NoItems.js +2 -2
- package/build/components/NoItems/NoItems.mjs +1 -1
- package/build/components/NotFound/NotFound.js +1 -1
- package/build/components/NotFound/NotFound.mjs +1 -1
- package/build/components/Package/Package.d.ts +1 -1
- package/build/components/Package/Package.js +28 -29
- package/build/components/Package/Package.js.map +1 -1
- package/build/components/Package/Package.mjs +29 -30
- package/build/components/Package/Package.mjs.map +1 -1
- package/build/components/Person/Person.js +1 -1
- package/build/components/Person/Person.js.map +1 -1
- package/build/components/Person/Person.mjs +1 -1
- package/build/components/Person/Person.mjs.map +1 -1
- package/build/components/RawViewer/RawViewer.js +1 -1
- package/build/components/RawViewer/RawViewer.mjs +1 -1
- package/build/components/RegistryInfoDialog/RegistryInfoDialog.js +1 -1
- package/build/components/RegistryInfoDialog/RegistryInfoDialog.mjs +1 -1
- package/build/components/Repository/Repository.js +5 -8
- package/build/components/Repository/Repository.js.map +1 -1
- package/build/components/Repository/Repository.mjs +5 -8
- package/build/components/Repository/Repository.mjs.map +1 -1
- package/build/components/Search/AutoComplete/AutoComplete.d.ts +1 -0
- package/build/components/Search/AutoComplete/AutoComplete.js +4 -4
- package/build/components/Search/AutoComplete/AutoComplete.js.map +1 -1
- package/build/components/Search/AutoComplete/AutoComplete.mjs +4 -4
- package/build/components/Search/AutoComplete/AutoComplete.mjs.map +1 -1
- package/build/components/Search/Search.js +12 -4
- package/build/components/Search/Search.js.map +1 -1
- package/build/components/Search/Search.mjs +13 -5
- package/build/components/Search/Search.mjs.map +1 -1
- package/build/components/Search/SearchItem.js +1 -1
- package/build/components/Search/SearchItem.mjs +1 -1
- package/build/components/SettingsMenu/SettingsMenu.js +1 -1
- package/build/components/SettingsMenu/SettingsMenu.mjs +1 -1
- package/build/components/SideBarTitle/SideBarTitle.js +2 -2
- package/build/components/SideBarTitle/SideBarTitle.js.map +1 -1
- package/build/components/SideBarTitle/SideBarTitle.mjs +2 -2
- package/build/components/SideBarTitle/SideBarTitle.mjs.map +1 -1
- package/build/components/UpLinks/UpLinks.js +1 -1
- package/build/components/UpLinks/UpLinks.mjs +1 -1
- package/build/components/Versions/HistoryList.js +2 -2
- package/build/components/Versions/HistoryList.js.map +1 -1
- package/build/components/Versions/HistoryList.mjs +2 -2
- package/build/components/Versions/HistoryList.mjs.map +1 -1
- package/build/components/Versions/Versions.js +22 -21
- package/build/components/Versions/Versions.js.map +1 -1
- package/build/components/Versions/Versions.mjs +22 -21
- package/build/components/Versions/Versions.mjs.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.js +4 -0
- package/build/index.mjs +4 -2
- package/build/pages/Stage/StageDetail.d.ts +2 -0
- package/build/pages/Stage/StageDetail.js +8 -0
- package/build/pages/Stage/StageDetail.js.map +1 -0
- package/build/pages/Stage/StageDetail.mjs +8 -0
- package/build/pages/Stage/StageDetail.mjs.map +1 -0
- package/build/pages/Stage/StageList.d.ts +2 -0
- package/build/pages/Stage/StageList.js +8 -0
- package/build/pages/Stage/StageList.js.map +1 -0
- package/build/pages/Stage/StageList.mjs +8 -0
- package/build/pages/Stage/StageList.mjs.map +1 -0
- package/build/pages/Stage/index.d.ts +2 -0
- package/build/pages/Version/Version.js +4 -1
- package/build/pages/Version/Version.js.map +1 -1
- package/build/pages/Version/Version.mjs +4 -1
- package/build/pages/Version/Version.mjs.map +1 -1
- package/build/providers/AuthProvider/AuthProvider.js +9 -7
- package/build/providers/AuthProvider/AuthProvider.js.map +1 -1
- package/build/providers/AuthProvider/AuthProvider.mjs +10 -8
- package/build/providers/AuthProvider/AuthProvider.mjs.map +1 -1
- package/build/providers/AuthProvider/utils.d.ts +12 -0
- package/build/providers/AuthProvider/utils.js +22 -0
- package/build/providers/AuthProvider/utils.js.map +1 -1
- package/build/providers/AuthProvider/utils.mjs +21 -2
- package/build/providers/AuthProvider/utils.mjs.map +1 -1
- package/build/providers/DownloadProvider/DownloadProvider.d.ts +1 -0
- package/build/providers/DownloadProvider/DownloadProvider.js +27 -4
- package/build/providers/DownloadProvider/DownloadProvider.js.map +1 -1
- package/build/providers/DownloadProvider/DownloadProvider.mjs +27 -6
- package/build/providers/DownloadProvider/DownloadProvider.mjs.map +1 -1
- package/build/providers/ManifestsProvider/ManifestsProvider.js +1 -1
- package/build/providers/ManifestsProvider/ManifestsProvider.js.map +1 -1
- package/build/providers/ManifestsProvider/ManifestsProvider.mjs +1 -1
- package/build/providers/ManifestsProvider/ManifestsProvider.mjs.map +1 -1
- package/build/providers/SearchProvider/SearchProvider.d.ts +1 -0
- package/build/providers/SearchProvider/SearchProvider.js +8 -6
- package/build/providers/SearchProvider/SearchProvider.js.map +1 -1
- package/build/providers/SearchProvider/SearchProvider.mjs +8 -6
- package/build/providers/SearchProvider/SearchProvider.mjs.map +1 -1
- package/build/providers/TranslatorProvider/TranslatorProvider.js +5 -3
- package/build/providers/TranslatorProvider/TranslatorProvider.js.map +1 -1
- package/build/providers/TranslatorProvider/TranslatorProvider.mjs +5 -3
- package/build/providers/TranslatorProvider/TranslatorProvider.mjs.map +1 -1
- package/build/providers/VersionProvider/VersionProvider.js +3 -3
- package/build/providers/VersionProvider/VersionProvider.js.map +1 -1
- package/build/providers/VersionProvider/VersionProvider.mjs +3 -3
- package/build/providers/VersionProvider/VersionProvider.mjs.map +1 -1
- package/build/sections/Detail/Tabs.js +1 -1
- package/build/sections/Detail/Tabs.mjs +1 -1
- package/build/sections/Footer/Footer.js +1 -1
- package/build/sections/Footer/Footer.mjs +1 -1
- package/build/sections/Header/Header.d.ts +0 -1
- package/build/sections/Header/Header.js +16 -14
- package/build/sections/Header/Header.js.map +1 -1
- package/build/sections/Header/Header.mjs +17 -15
- package/build/sections/Header/Header.mjs.map +1 -1
- package/build/sections/Header/HeaderGreetings.js +1 -1
- package/build/sections/Header/HeaderGreetings.mjs +1 -1
- package/build/sections/Header/HeaderMenu.js +26 -7
- package/build/sections/Header/HeaderMenu.js.map +1 -1
- package/build/sections/Header/HeaderMenu.mjs +26 -7
- package/build/sections/Header/HeaderMenu.mjs.map +1 -1
- package/build/sections/Header/HeaderRight.js +1 -1
- package/build/sections/Header/HeaderRight.mjs +1 -1
- package/build/sections/Header/HeaderSettingsDialog.js +1 -1
- package/build/sections/Header/HeaderSettingsDialog.mjs +1 -1
- package/build/sections/Header/LanguageSwitch.js +1 -1
- package/build/sections/Header/LanguageSwitch.mjs +1 -1
- package/build/sections/Header/RegistryInfoContent/RegistryInfoContent.js +1 -1
- package/build/sections/Header/RegistryInfoContent/RegistryInfoContent.mjs +1 -1
- package/build/sections/Home/Home.js +4 -3
- package/build/sections/Home/Home.js.map +1 -1
- package/build/sections/Home/Home.mjs +5 -4
- package/build/sections/Home/Home.mjs.map +1 -1
- package/build/sections/Security/AddUser.js +33 -18
- package/build/sections/Security/AddUser.js.map +1 -1
- package/build/sections/Security/AddUser.mjs +37 -22
- package/build/sections/Security/AddUser.mjs.map +1 -1
- package/build/sections/Security/ChangePassword.js +17 -15
- package/build/sections/Security/ChangePassword.js.map +1 -1
- package/build/sections/Security/ChangePassword.mjs +19 -17
- package/build/sections/Security/ChangePassword.mjs.map +1 -1
- package/build/sections/Security/Login.js +51 -35
- package/build/sections/Security/Login.js.map +1 -1
- package/build/sections/Security/Login.mjs +54 -38
- package/build/sections/Security/Login.mjs.map +1 -1
- package/build/sections/Security/Success.js +28 -24
- package/build/sections/Security/Success.js.map +1 -1
- package/build/sections/Security/Success.mjs +29 -25
- package/build/sections/Security/Success.mjs.map +1 -1
- package/build/sections/Stage/StageActions.d.ts +15 -0
- package/build/sections/Stage/StageActions.js +101 -0
- package/build/sections/Stage/StageActions.js.map +1 -0
- package/build/sections/Stage/StageActions.mjs +99 -0
- package/build/sections/Stage/StageActions.mjs.map +1 -0
- package/build/sections/Stage/StageDetail.d.ts +3 -0
- package/build/sections/Stage/StageDetail.js +110 -0
- package/build/sections/Stage/StageDetail.js.map +1 -0
- package/build/sections/Stage/StageDetail.mjs +108 -0
- package/build/sections/Stage/StageDetail.mjs.map +1 -0
- package/build/sections/Stage/StageList.d.ts +3 -0
- package/build/sections/Stage/StageList.js +153 -0
- package/build/sections/Stage/StageList.js.map +1 -0
- package/build/sections/Stage/StageList.mjs +151 -0
- package/build/sections/Stage/StageList.mjs.map +1 -0
- package/build/sections/Stage/index.d.ts +6 -0
- package/build/sections/Stage/index.js +13 -0
- package/build/sections/Stage/index.mjs +6 -0
- package/build/sections/Stage/types.d.ts +22 -0
- package/build/sections/Stage/useRequireSession.d.ts +14 -0
- package/build/sections/Stage/useRequireSession.js +33 -0
- package/build/sections/Stage/useRequireSession.js.map +1 -0
- package/build/sections/Stage/useRequireSession.mjs +33 -0
- package/build/sections/Stage/useRequireSession.mjs.map +1 -0
- package/build/sections/Stage/useStage.d.ts +34 -0
- package/build/sections/Stage/useStage.js +71 -0
- package/build/sections/Stage/useStage.js.map +1 -0
- package/build/sections/Stage/useStage.mjs +65 -0
- package/build/sections/Stage/useStage.mjs.map +1 -0
- package/build/store/api.js +7 -4
- package/build/store/api.js.map +1 -1
- package/build/store/api.mjs +7 -4
- package/build/store/api.mjs.map +1 -1
- package/build/types/packageMeta.d.ts +3 -2
- package/build/utils/cli-utils.js +2 -2
- package/build/utils/cli-utils.js.map +1 -1
- package/build/utils/cli-utils.mjs +2 -2
- package/build/utils/cli-utils.mjs.map +1 -1
- package/build/utils/index.js +1 -0
- package/build/utils/index.mjs +2 -2
- package/build/utils/routes.d.ts +5 -1
- package/build/utils/routes.js +4 -0
- package/build/utils/routes.js.map +1 -1
- package/build/utils/routes.mjs +4 -0
- package/build/utils/routes.mjs.map +1 -1
- package/build/utils/schemas.d.ts +1 -0
- package/build/utils/schemas.js +4 -4
- package/build/utils/schemas.js.map +1 -1
- package/build/utils/schemas.mjs +4 -4
- package/build/utils/schemas.mjs.map +1 -1
- package/build/utils/session-id.d.ts +8 -0
- package/build/utils/session-id.js +26 -0
- package/build/utils/session-id.js.map +1 -0
- package/build/utils/session-id.mjs +26 -0
- package/build/utils/session-id.mjs.map +1 -0
- package/build/utils/token.d.ts +1 -0
- package/build/utils/token.js +12 -8
- package/build/utils/token.js.map +1 -1
- package/build/utils/token.mjs +12 -9
- package/build/utils/token.mjs.map +1 -1
- package/build/utils/url.js +1 -1
- package/build/utils/url.js.map +1 -1
- package/build/utils/url.mjs +1 -1
- package/build/utils/url.mjs.map +1 -1
- package/build/utils/utils.d.ts +10 -0
- package/build/utils/utils.js +26 -0
- package/build/utils/utils.js.map +1 -1
- package/build/utils/utils.mjs +25 -1
- package/build/utils/utils.mjs.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Repository.js","names":[],"sources":["../../../src/components/Repository/Repository.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport Avatar from '@mui/material/Avatar';\nimport List from '@mui/material/List';\nimport ListItem from '@mui/material/ListItem';\nimport ListItemText from '@mui/material/ListItemText';\nimport Typography from '@mui/material/Typography';\nimport { common } from '@mui/material/colors';\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport type { Theme } from '../../Theme';\nimport { url as urlUtils } from '../../utils';\nimport CopyClipboard from '../CopyClipboard';\nimport { Git } from '../Icons';\nimport LinkExternal from '../LinkExternal';\n\nconst StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({\n fontWeight: props.theme.fontWeight.bold,\n textTransform: 'capitalize',\n}));\n\nconst RepositoryListItem = styled(ListItem)({\n padding: 0,\n ':hover': {\n backgroundColor: 'transparent',\n },\n});\n\nconst RepositoryListItemText = styled(ListItemText)({\n padding: '0 0 0 10px',\n margin: 0,\n});\n\nconst RepositoryAvatar = styled(Avatar)({\n padding: 0,\n marginLeft: 0,\n backgroundColor: 'transparent',\n});\n\nconst Repository: React.FC<{ packageMeta: any }> = ({ packageMeta }) => {\n const { t } = useTranslation();\n
|
|
1
|
+
{"version":3,"file":"Repository.js","names":[],"sources":["../../../src/components/Repository/Repository.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport Avatar from '@mui/material/Avatar';\nimport List from '@mui/material/List';\nimport ListItem from '@mui/material/ListItem';\nimport ListItemText from '@mui/material/ListItemText';\nimport Typography from '@mui/material/Typography';\nimport { common } from '@mui/material/colors';\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport type { Theme } from '../../Theme';\nimport { url as urlUtils, utils } from '../../utils';\nimport CopyClipboard from '../CopyClipboard';\nimport { Git } from '../Icons';\nimport LinkExternal from '../LinkExternal';\n\nconst StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({\n fontWeight: props.theme.fontWeight.bold,\n textTransform: 'capitalize',\n}));\n\nconst RepositoryListItem = styled(ListItem)({\n padding: 0,\n ':hover': {\n backgroundColor: 'transparent',\n },\n});\n\nconst RepositoryListItemText = styled(ListItemText)({\n padding: '0 0 0 10px',\n margin: 0,\n});\n\nconst RepositoryAvatar = styled(Avatar)({\n padding: 0,\n marginLeft: 0,\n backgroundColor: 'transparent',\n});\n\nconst Repository: React.FC<{ packageMeta: any }> = ({ packageMeta }) => {\n const { t } = useTranslation();\n // repository can be the object form or a plain string, both valid in npm;\n // `git+ssh://git@host/...` and `git://host/...` are valid manifest urls but\n // dead links in a browser, so they are rewritten to https before validating\n const url = utils.formatRepository(packageMeta?.latest?.repository);\n const repositoryURL = url\n ? url\n .replace(/^git\\+/, '')\n .replace(/^ssh:\\/\\/(git@)?/, 'https://')\n .replace(/^git:\\/\\//, 'https://')\n : null;\n if (!repositoryURL || !urlUtils.isURL(repositoryURL)) {\n return null;\n }\n\n return (\n <List\n dense={true}\n subheader={<StyledText variant=\"subtitle1\">{t('sidebar.repository.title')}</StyledText>}\n >\n <RepositoryListItem>\n <RepositoryAvatar sx={{ bgcolor: common.white }}>\n <Git />\n </RepositoryAvatar>\n <RepositoryListItemText\n primary={\n <CopyClipboard dataTestId=\"repositoryID\" text={repositoryURL} title={repositoryURL}>\n <LinkExternal to={repositoryURL} variant=\"outline\">\n {repositoryURL}\n </LinkExternal>\n </CopyClipboard>\n }\n />\n </RepositoryListItem>\n </List>\n );\n};\n\nexport default Repository;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,IAAM,cAAA,GAAa,gBAAA,QAAA,CAAO,yBAAA,OAAU,CAAC,EAAqB,WAAW;CACnE,YAAY,MAAM,MAAM,WAAW;CACnC,eAAe;AACjB,EAAE;AAEF,IAAM,sBAAA,GAAqB,gBAAA,QAAA,CAAO,uBAAA,OAAQ,CAAC,CAAC;CAC1C,SAAS;CACT,UAAU,EACR,iBAAiB,cACnB;AACF,CAAC;AAED,IAAM,0BAAA,GAAyB,gBAAA,QAAA,CAAO,2BAAA,OAAY,CAAC,CAAC;CAClD,SAAS;CACT,QAAQ;AACV,CAAC;AAED,IAAM,oBAAA,GAAmB,gBAAA,QAAA,CAAO,qBAAA,OAAM,CAAC,CAAC;CACtC,SAAS;CACT,YAAY;CACZ,iBAAiB;AACnB,CAAC;AAED,IAAM,cAA8C,EAAE,kBAAkB;CACtE,MAAM,EAAE,OAAA,GAAM,cAAA,eAAA,CAAe;CAI7B,MAAM,MAAA,cAAA,iBAA6B,aAAa,QAAQ,UAAU;CAClE,MAAM,gBAAgB,MAClB,IACG,QAAQ,UAAU,EAAE,CAAC,CACrB,QAAQ,oBAAoB,UAAU,CAAC,CACvC,QAAQ,aAAa,UAAU,IAClC;CACJ,IAAI,CAAC,iBAAiB,CAAA,YAAA,MAAgB,aAAa,GACjD,OAAO;CAGT,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,mBAAA,SAAD;EACE,OAAO;EACP,WAAW,iBAAA,GAAA,kBAAA,IAAA,CAAC,YAAD;GAAY,SAAQ;GAAa,UAAA,EAAE,0BAA0B;EAAc,CAAA;EAEtF,UAAA,iBAAA,GAAA,kBAAA,KAAA,CAAC,oBAAD,EAAA,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,kBAAD;GAAkB,IAAI,EAAE,SAAS,qBAAA,OAAO,MAAM;GAC5C,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,YAAA,KAAD,CAAM,CAAA;EACU,CAAA,GAClB,iBAAA,GAAA,kBAAA,IAAA,CAAC,wBAAD,EACE,SACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,wBAAA,SAAD;GAAe,YAAW;GAAe,MAAM;GAAe,OAAO;GACnE,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,qBAAA,SAAD;IAAc,IAAI;IAAe,SAAQ;IACtC,UAAA;GACW,CAAA;EACD,CAAA,EAElB,CAAA,CACiB,EAAA,CAAA;CAChB,CAAA;AAEV"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import CopyToClipBoard from "../CopyClipboard/CopyToClipBoard.mjs";
|
|
2
2
|
import "../CopyClipboard/index.mjs";
|
|
3
3
|
import { isURL } from "../../utils/url.mjs";
|
|
4
|
+
import { formatRepository } from "../../utils/utils.mjs";
|
|
4
5
|
import "../../utils/index.mjs";
|
|
5
6
|
import LinkExternal from "../LinkExternal/LinkExternal.mjs";
|
|
6
7
|
import "../LinkExternal/index.mjs";
|
|
@@ -8,8 +9,8 @@ import { Git } from "../Icons/DevsIcons/Git2.mjs";
|
|
|
8
9
|
import "../Icons/index.mjs";
|
|
9
10
|
import styled from "@emotion/styled";
|
|
10
11
|
import "react";
|
|
11
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import { useTranslation } from "react-i18next";
|
|
13
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
14
|
import { common } from "@mui/material/colors";
|
|
14
15
|
import List from "@mui/material/List";
|
|
15
16
|
import Avatar from "@mui/material/Avatar";
|
|
@@ -36,13 +37,9 @@ var RepositoryAvatar = styled(Avatar)({
|
|
|
36
37
|
});
|
|
37
38
|
var Repository = ({ packageMeta }) => {
|
|
38
39
|
const { t } = useTranslation();
|
|
39
|
-
const url = packageMeta?.latest?.repository
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (!url.includes("git+")) return url;
|
|
43
|
-
return url.split("git+")[1];
|
|
44
|
-
};
|
|
45
|
-
const repositoryURL = getCorrectRepositoryURL();
|
|
40
|
+
const url = formatRepository(packageMeta?.latest?.repository);
|
|
41
|
+
const repositoryURL = url ? url.replace(/^git\+/, "").replace(/^ssh:\/\/(git@)?/, "https://").replace(/^git:\/\//, "https://") : null;
|
|
42
|
+
if (!repositoryURL || !isURL(repositoryURL)) return null;
|
|
46
43
|
return /* @__PURE__ */ jsx(List, {
|
|
47
44
|
dense: true,
|
|
48
45
|
subheader: /* @__PURE__ */ jsx(StyledText, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Repository.mjs","names":[],"sources":["../../../src/components/Repository/Repository.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport Avatar from '@mui/material/Avatar';\nimport List from '@mui/material/List';\nimport ListItem from '@mui/material/ListItem';\nimport ListItemText from '@mui/material/ListItemText';\nimport Typography from '@mui/material/Typography';\nimport { common } from '@mui/material/colors';\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport type { Theme } from '../../Theme';\nimport { url as urlUtils } from '../../utils';\nimport CopyClipboard from '../CopyClipboard';\nimport { Git } from '../Icons';\nimport LinkExternal from '../LinkExternal';\n\nconst StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({\n fontWeight: props.theme.fontWeight.bold,\n textTransform: 'capitalize',\n}));\n\nconst RepositoryListItem = styled(ListItem)({\n padding: 0,\n ':hover': {\n backgroundColor: 'transparent',\n },\n});\n\nconst RepositoryListItemText = styled(ListItemText)({\n padding: '0 0 0 10px',\n margin: 0,\n});\n\nconst RepositoryAvatar = styled(Avatar)({\n padding: 0,\n marginLeft: 0,\n backgroundColor: 'transparent',\n});\n\nconst Repository: React.FC<{ packageMeta: any }> = ({ packageMeta }) => {\n const { t } = useTranslation();\n
|
|
1
|
+
{"version":3,"file":"Repository.mjs","names":[],"sources":["../../../src/components/Repository/Repository.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport Avatar from '@mui/material/Avatar';\nimport List from '@mui/material/List';\nimport ListItem from '@mui/material/ListItem';\nimport ListItemText from '@mui/material/ListItemText';\nimport Typography from '@mui/material/Typography';\nimport { common } from '@mui/material/colors';\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport type { Theme } from '../../Theme';\nimport { url as urlUtils, utils } from '../../utils';\nimport CopyClipboard from '../CopyClipboard';\nimport { Git } from '../Icons';\nimport LinkExternal from '../LinkExternal';\n\nconst StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({\n fontWeight: props.theme.fontWeight.bold,\n textTransform: 'capitalize',\n}));\n\nconst RepositoryListItem = styled(ListItem)({\n padding: 0,\n ':hover': {\n backgroundColor: 'transparent',\n },\n});\n\nconst RepositoryListItemText = styled(ListItemText)({\n padding: '0 0 0 10px',\n margin: 0,\n});\n\nconst RepositoryAvatar = styled(Avatar)({\n padding: 0,\n marginLeft: 0,\n backgroundColor: 'transparent',\n});\n\nconst Repository: React.FC<{ packageMeta: any }> = ({ packageMeta }) => {\n const { t } = useTranslation();\n // repository can be the object form or a plain string, both valid in npm;\n // `git+ssh://git@host/...` and `git://host/...` are valid manifest urls but\n // dead links in a browser, so they are rewritten to https before validating\n const url = utils.formatRepository(packageMeta?.latest?.repository);\n const repositoryURL = url\n ? url\n .replace(/^git\\+/, '')\n .replace(/^ssh:\\/\\/(git@)?/, 'https://')\n .replace(/^git:\\/\\//, 'https://')\n : null;\n if (!repositoryURL || !urlUtils.isURL(repositoryURL)) {\n return null;\n }\n\n return (\n <List\n dense={true}\n subheader={<StyledText variant=\"subtitle1\">{t('sidebar.repository.title')}</StyledText>}\n >\n <RepositoryListItem>\n <RepositoryAvatar sx={{ bgcolor: common.white }}>\n <Git />\n </RepositoryAvatar>\n <RepositoryListItemText\n primary={\n <CopyClipboard dataTestId=\"repositoryID\" text={repositoryURL} title={repositoryURL}>\n <LinkExternal to={repositoryURL} variant=\"outline\">\n {repositoryURL}\n </LinkExternal>\n </CopyClipboard>\n }\n />\n </RepositoryListItem>\n </List>\n );\n};\n\nexport default Repository;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgBA,IAAM,aAAa,OAAO,UAAU,CAAC,EAAqB,WAAW;CACnE,YAAY,MAAM,MAAM,WAAW;CACnC,eAAe;AACjB,EAAE;AAEF,IAAM,qBAAqB,OAAO,QAAQ,CAAC,CAAC;CAC1C,SAAS;CACT,UAAU,EACR,iBAAiB,cACnB;AACF,CAAC;AAED,IAAM,yBAAyB,OAAO,YAAY,CAAC,CAAC;CAClD,SAAS;CACT,QAAQ;AACV,CAAC;AAED,IAAM,mBAAmB,OAAO,MAAM,CAAC,CAAC;CACtC,SAAS;CACT,YAAY;CACZ,iBAAiB;AACnB,CAAC;AAED,IAAM,cAA8C,EAAE,kBAAkB;CACtE,MAAM,EAAE,MAAM,eAAe;CAI7B,MAAM,MAAM,iBAAuB,aAAa,QAAQ,UAAU;CAClE,MAAM,gBAAgB,MAClB,IACG,QAAQ,UAAU,EAAE,CAAC,CACrB,QAAQ,oBAAoB,UAAU,CAAC,CACvC,QAAQ,aAAa,UAAU,IAClC;CACJ,IAAI,CAAC,iBAAiB,CAAC,MAAe,aAAa,GACjD,OAAO;CAGT,OACE,oBAAC,MAAD;EACE,OAAO;EACP,WAAW,oBAAC,YAAD;GAAY,SAAQ;GAAa,UAAA,EAAE,0BAA0B;EAAc,CAAA;EAEtF,UAAA,qBAAC,oBAAD,EAAA,UAAA,CACE,oBAAC,kBAAD;GAAkB,IAAI,EAAE,SAAS,OAAO,MAAM;GAC5C,UAAA,oBAAC,KAAD,CAAM,CAAA;EACU,CAAA,GAClB,oBAAC,wBAAD,EACE,SACE,oBAAC,iBAAD;GAAe,YAAW;GAAe,MAAM;GAAe,OAAO;GACnE,UAAA,oBAAC,cAAD;IAAc,IAAI;IAAe,SAAQ;IACtC,UAAA;GACW,CAAA;EACD,CAAA,EAElB,CAAA,CACiB,EAAA,CAAA;CAChB,CAAA;AAEV"}
|
|
@@ -5,6 +5,7 @@ export type OnSelecItem = (event: React.SyntheticEvent, value: SearchResultWeb,
|
|
|
5
5
|
interface Props {
|
|
6
6
|
suggestions?: SearchResultWeb[];
|
|
7
7
|
suggestionsLoading?: boolean;
|
|
8
|
+
hasError?: boolean;
|
|
8
9
|
placeholder: string;
|
|
9
10
|
renderOption?: (props: any, option: any) => React.JSX.Element;
|
|
10
11
|
renderInput: (params: any) => React.JSX.Element;
|
|
@@ -2,12 +2,12 @@ const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
|
|
|
2
2
|
const require_styles = require("./styles.js");
|
|
3
3
|
let react = require("react");
|
|
4
4
|
react = require_runtime.__toESM(react);
|
|
5
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
5
|
let react_i18next = require("react-i18next");
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
7
|
let _mui_material_Autocomplete = require("@mui/material/Autocomplete");
|
|
8
8
|
_mui_material_Autocomplete = require_runtime.__toESM(_mui_material_Autocomplete);
|
|
9
9
|
//#region src/components/Search/AutoComplete/AutoComplete.tsx
|
|
10
|
-
var AutoComplete = ({ suggestions = [], onSuggestionsFetch, onCleanSuggestions, renderInput, renderOption, getOptionLabel, onSelectItem, suggestionsLoading = false }) => {
|
|
10
|
+
var AutoComplete = ({ suggestions = [], onSuggestionsFetch, onCleanSuggestions, renderInput, renderOption, getOptionLabel, onSelectItem, suggestionsLoading = false, hasError = false }) => {
|
|
11
11
|
const { t } = (0, react_i18next.useTranslation)();
|
|
12
12
|
const [inputValue, setInputValue] = (0, react.useState)("");
|
|
13
13
|
const handleOnInputChange = (event, value, reason) => {
|
|
@@ -34,11 +34,11 @@ var AutoComplete = ({ suggestions = [], onSuggestionsFetch, onCleanSuggestions,
|
|
|
34
34
|
inputValue,
|
|
35
35
|
loading: suggestionsLoading,
|
|
36
36
|
loadingText: t("autoComplete.loading"),
|
|
37
|
-
noOptionsText: t("autoComplete.no-results-found"),
|
|
37
|
+
noOptionsText: hasError ? t("autoComplete.error") : t("autoComplete.no-results-found"),
|
|
38
38
|
onChange: onSelectItem,
|
|
39
39
|
onClose: handleOnClose,
|
|
40
40
|
onInputChange: handleOnInputChange,
|
|
41
|
-
options: suggestions,
|
|
41
|
+
options: hasError ? [] : suggestions,
|
|
42
42
|
renderInput,
|
|
43
43
|
renderOption,
|
|
44
44
|
renderTags: () => null
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoComplete.js","names":[],"sources":["../../../../src/components/Search/AutoComplete/AutoComplete.tsx"],"sourcesContent":["import Autocomplete from '@mui/material/Autocomplete';\nimport type { FC } from 'react';\nimport React, { useState } from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport type { SearchResultWeb } from '@verdaccio/types';\n\nimport { Wrapper } from './styles';\n\nexport type OnSelecItem = (\n event: React.SyntheticEvent,\n value: SearchResultWeb,\n reason: string,\n details?: string\n) => void;\ninterface Props {\n suggestions?: SearchResultWeb[];\n suggestionsLoading?: boolean;\n placeholder: string;\n renderOption?: (props: any, option: any) => React.JSX.Element;\n renderInput: (params: any) => React.JSX.Element;\n onSuggestionsFetch: any;\n getOptionLabel: (option: any) => any;\n onCleanSuggestions: (event: React.SyntheticEvent) => void;\n onSelectItem: OnSelecItem;\n}\n\nconst AutoComplete: FC<Props> = ({\n suggestions = [],\n onSuggestionsFetch,\n onCleanSuggestions,\n renderInput,\n renderOption,\n getOptionLabel,\n onSelectItem,\n suggestionsLoading = false,\n}: Props) => {\n const { t } = useTranslation();\n const [inputValue, setInputValue] = useState('');\n\n const handleOnInputChange = (event: React.SyntheticEvent, value: string, reason: string) => {\n if (reason === 'input') {\n event.preventDefault();\n onSuggestionsFetch({ value });\n setInputValue(value);\n } else if (reason === 'clear') {\n onCleanSuggestions(event);\n setInputValue('');\n }\n };\n\n const handleOnClose = (event) => {\n onCleanSuggestions(event);\n setInputValue('');\n };\n\n // @ts-ignore\n return (\n <Wrapper>\n <Autocomplete\n /* @ts-ignore */\n clearOnBlur={true}\n disablePortal={true}\n filterOptions={(options, state) => (state.inputValue.trim() ? options : [])}\n fullWidth={true}\n getOptionLabel={getOptionLabel}\n id=\"search-header-suggest\"\n inputValue={inputValue}\n loading={suggestionsLoading}\n loadingText={t('autoComplete.loading')}\n noOptionsText={t('autoComplete.no-results-found')}\n onChange={onSelectItem as any}\n onClose={handleOnClose}\n onInputChange={handleOnInputChange}\n options={suggestions}\n renderInput={renderInput}\n renderOption={renderOption}\n renderTags={() => null}\n />\n </Wrapper>\n );\n};\n\nexport default AutoComplete;\n"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"AutoComplete.js","names":[],"sources":["../../../../src/components/Search/AutoComplete/AutoComplete.tsx"],"sourcesContent":["import Autocomplete from '@mui/material/Autocomplete';\nimport type { FC } from 'react';\nimport React, { useState } from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport type { SearchResultWeb } from '@verdaccio/types';\n\nimport { Wrapper } from './styles';\n\nexport type OnSelecItem = (\n event: React.SyntheticEvent,\n value: SearchResultWeb,\n reason: string,\n details?: string\n) => void;\ninterface Props {\n suggestions?: SearchResultWeb[];\n suggestionsLoading?: boolean;\n hasError?: boolean;\n placeholder: string;\n renderOption?: (props: any, option: any) => React.JSX.Element;\n renderInput: (params: any) => React.JSX.Element;\n onSuggestionsFetch: any;\n getOptionLabel: (option: any) => any;\n onCleanSuggestions: (event: React.SyntheticEvent) => void;\n onSelectItem: OnSelecItem;\n}\n\nconst AutoComplete: FC<Props> = ({\n suggestions = [],\n onSuggestionsFetch,\n onCleanSuggestions,\n renderInput,\n renderOption,\n getOptionLabel,\n onSelectItem,\n suggestionsLoading = false,\n hasError = false,\n}: Props) => {\n const { t } = useTranslation();\n const [inputValue, setInputValue] = useState('');\n\n const handleOnInputChange = (event: React.SyntheticEvent, value: string, reason: string) => {\n if (reason === 'input') {\n event.preventDefault();\n onSuggestionsFetch({ value });\n setInputValue(value);\n } else if (reason === 'clear') {\n onCleanSuggestions(event);\n setInputValue('');\n }\n };\n\n const handleOnClose = (event) => {\n onCleanSuggestions(event);\n setInputValue('');\n };\n\n // @ts-ignore\n return (\n <Wrapper>\n <Autocomplete\n /* @ts-ignore */\n clearOnBlur={true}\n disablePortal={true}\n filterOptions={(options, state) => (state.inputValue.trim() ? options : [])}\n fullWidth={true}\n getOptionLabel={getOptionLabel}\n id=\"search-header-suggest\"\n inputValue={inputValue}\n loading={suggestionsLoading}\n loadingText={t('autoComplete.loading')}\n // a failed search must not read as \"no results found\"\n noOptionsText={hasError ? t('autoComplete.error') : t('autoComplete.no-results-found')}\n onChange={onSelectItem as any}\n onClose={handleOnClose}\n onInputChange={handleOnInputChange}\n options={hasError ? [] : suggestions}\n renderInput={renderInput}\n renderOption={renderOption}\n renderTags={() => null}\n />\n </Wrapper>\n );\n};\n\nexport default AutoComplete;\n"],"mappings":";;;;;;;;;AA4BA,IAAM,gBAA2B,EAC/B,cAAc,CAAC,GACf,oBACA,oBACA,aACA,cACA,gBACA,cACA,qBAAqB,OACrB,WAAW,YACA;CACX,MAAM,EAAE,OAAA,GAAM,cAAA,eAAA,CAAe;CAC7B,MAAM,CAAC,YAAY,kBAAA,GAAiB,MAAA,SAAA,CAAS,EAAE;CAE/C,MAAM,uBAAuB,OAA6B,OAAe,WAAmB;EAC1F,IAAI,WAAW,SAAS;GACtB,MAAM,eAAe;GACrB,mBAAmB,EAAE,MAAM,CAAC;GAC5B,cAAc,KAAK;EACrB,OAAO,IAAI,WAAW,SAAS;GAC7B,mBAAmB,KAAK;GACxB,cAAc,EAAE;EAClB;CACF;CAEA,MAAM,iBAAiB,UAAU;EAC/B,mBAAmB,KAAK;EACxB,cAAc,EAAE;CAClB;CAGA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,eAAA,SAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,2BAAA,SAAD;EAEE,aAAa;EACb,eAAe;EACf,gBAAgB,SAAS,UAAW,MAAM,WAAW,KAAK,IAAI,UAAU,CAAC;EACzE,WAAW;EACK;EAChB,IAAG;EACS;EACZ,SAAS;EACT,aAAa,EAAE,sBAAsB;EAErC,eAAe,WAAW,EAAE,oBAAoB,IAAI,EAAE,+BAA+B;EACrF,UAAU;EACV,SAAS;EACT,eAAe;EACf,SAAS,WAAW,CAAC,IAAI;EACZ;EACC;EACd,kBAAkB;CACnB,CAAA,EACM,CAAA;AAEb"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Wrapper } from "./styles.mjs";
|
|
2
2
|
import { useState } from "react";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
3
|
import { useTranslation } from "react-i18next";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import Autocomplete from "@mui/material/Autocomplete";
|
|
6
6
|
//#region src/components/Search/AutoComplete/AutoComplete.tsx
|
|
7
|
-
var AutoComplete = ({ suggestions = [], onSuggestionsFetch, onCleanSuggestions, renderInput, renderOption, getOptionLabel, onSelectItem, suggestionsLoading = false }) => {
|
|
7
|
+
var AutoComplete = ({ suggestions = [], onSuggestionsFetch, onCleanSuggestions, renderInput, renderOption, getOptionLabel, onSelectItem, suggestionsLoading = false, hasError = false }) => {
|
|
8
8
|
const { t } = useTranslation();
|
|
9
9
|
const [inputValue, setInputValue] = useState("");
|
|
10
10
|
const handleOnInputChange = (event, value, reason) => {
|
|
@@ -31,11 +31,11 @@ var AutoComplete = ({ suggestions = [], onSuggestionsFetch, onCleanSuggestions,
|
|
|
31
31
|
inputValue,
|
|
32
32
|
loading: suggestionsLoading,
|
|
33
33
|
loadingText: t("autoComplete.loading"),
|
|
34
|
-
noOptionsText: t("autoComplete.no-results-found"),
|
|
34
|
+
noOptionsText: hasError ? t("autoComplete.error") : t("autoComplete.no-results-found"),
|
|
35
35
|
onChange: onSelectItem,
|
|
36
36
|
onClose: handleOnClose,
|
|
37
37
|
onInputChange: handleOnInputChange,
|
|
38
|
-
options: suggestions,
|
|
38
|
+
options: hasError ? [] : suggestions,
|
|
39
39
|
renderInput,
|
|
40
40
|
renderOption,
|
|
41
41
|
renderTags: () => null
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoComplete.mjs","names":[],"sources":["../../../../src/components/Search/AutoComplete/AutoComplete.tsx"],"sourcesContent":["import Autocomplete from '@mui/material/Autocomplete';\nimport type { FC } from 'react';\nimport React, { useState } from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport type { SearchResultWeb } from '@verdaccio/types';\n\nimport { Wrapper } from './styles';\n\nexport type OnSelecItem = (\n event: React.SyntheticEvent,\n value: SearchResultWeb,\n reason: string,\n details?: string\n) => void;\ninterface Props {\n suggestions?: SearchResultWeb[];\n suggestionsLoading?: boolean;\n placeholder: string;\n renderOption?: (props: any, option: any) => React.JSX.Element;\n renderInput: (params: any) => React.JSX.Element;\n onSuggestionsFetch: any;\n getOptionLabel: (option: any) => any;\n onCleanSuggestions: (event: React.SyntheticEvent) => void;\n onSelectItem: OnSelecItem;\n}\n\nconst AutoComplete: FC<Props> = ({\n suggestions = [],\n onSuggestionsFetch,\n onCleanSuggestions,\n renderInput,\n renderOption,\n getOptionLabel,\n onSelectItem,\n suggestionsLoading = false,\n}: Props) => {\n const { t } = useTranslation();\n const [inputValue, setInputValue] = useState('');\n\n const handleOnInputChange = (event: React.SyntheticEvent, value: string, reason: string) => {\n if (reason === 'input') {\n event.preventDefault();\n onSuggestionsFetch({ value });\n setInputValue(value);\n } else if (reason === 'clear') {\n onCleanSuggestions(event);\n setInputValue('');\n }\n };\n\n const handleOnClose = (event) => {\n onCleanSuggestions(event);\n setInputValue('');\n };\n\n // @ts-ignore\n return (\n <Wrapper>\n <Autocomplete\n /* @ts-ignore */\n clearOnBlur={true}\n disablePortal={true}\n filterOptions={(options, state) => (state.inputValue.trim() ? options : [])}\n fullWidth={true}\n getOptionLabel={getOptionLabel}\n id=\"search-header-suggest\"\n inputValue={inputValue}\n loading={suggestionsLoading}\n loadingText={t('autoComplete.loading')}\n noOptionsText={t('autoComplete.no-results-found')}\n onChange={onSelectItem as any}\n onClose={handleOnClose}\n onInputChange={handleOnInputChange}\n options={suggestions}\n renderInput={renderInput}\n renderOption={renderOption}\n renderTags={() => null}\n />\n </Wrapper>\n );\n};\n\nexport default AutoComplete;\n"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"AutoComplete.mjs","names":[],"sources":["../../../../src/components/Search/AutoComplete/AutoComplete.tsx"],"sourcesContent":["import Autocomplete from '@mui/material/Autocomplete';\nimport type { FC } from 'react';\nimport React, { useState } from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport type { SearchResultWeb } from '@verdaccio/types';\n\nimport { Wrapper } from './styles';\n\nexport type OnSelecItem = (\n event: React.SyntheticEvent,\n value: SearchResultWeb,\n reason: string,\n details?: string\n) => void;\ninterface Props {\n suggestions?: SearchResultWeb[];\n suggestionsLoading?: boolean;\n hasError?: boolean;\n placeholder: string;\n renderOption?: (props: any, option: any) => React.JSX.Element;\n renderInput: (params: any) => React.JSX.Element;\n onSuggestionsFetch: any;\n getOptionLabel: (option: any) => any;\n onCleanSuggestions: (event: React.SyntheticEvent) => void;\n onSelectItem: OnSelecItem;\n}\n\nconst AutoComplete: FC<Props> = ({\n suggestions = [],\n onSuggestionsFetch,\n onCleanSuggestions,\n renderInput,\n renderOption,\n getOptionLabel,\n onSelectItem,\n suggestionsLoading = false,\n hasError = false,\n}: Props) => {\n const { t } = useTranslation();\n const [inputValue, setInputValue] = useState('');\n\n const handleOnInputChange = (event: React.SyntheticEvent, value: string, reason: string) => {\n if (reason === 'input') {\n event.preventDefault();\n onSuggestionsFetch({ value });\n setInputValue(value);\n } else if (reason === 'clear') {\n onCleanSuggestions(event);\n setInputValue('');\n }\n };\n\n const handleOnClose = (event) => {\n onCleanSuggestions(event);\n setInputValue('');\n };\n\n // @ts-ignore\n return (\n <Wrapper>\n <Autocomplete\n /* @ts-ignore */\n clearOnBlur={true}\n disablePortal={true}\n filterOptions={(options, state) => (state.inputValue.trim() ? options : [])}\n fullWidth={true}\n getOptionLabel={getOptionLabel}\n id=\"search-header-suggest\"\n inputValue={inputValue}\n loading={suggestionsLoading}\n loadingText={t('autoComplete.loading')}\n // a failed search must not read as \"no results found\"\n noOptionsText={hasError ? t('autoComplete.error') : t('autoComplete.no-results-found')}\n onChange={onSelectItem as any}\n onClose={handleOnClose}\n onInputChange={handleOnInputChange}\n options={hasError ? [] : suggestions}\n renderInput={renderInput}\n renderOption={renderOption}\n renderTags={() => null}\n />\n </Wrapper>\n );\n};\n\nexport default AutoComplete;\n"],"mappings":";;;;;;AA4BA,IAAM,gBAA2B,EAC/B,cAAc,CAAC,GACf,oBACA,oBACA,aACA,cACA,gBACA,cACA,qBAAqB,OACrB,WAAW,YACA;CACX,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,CAAC,YAAY,iBAAiB,SAAS,EAAE;CAE/C,MAAM,uBAAuB,OAA6B,OAAe,WAAmB;EAC1F,IAAI,WAAW,SAAS;GACtB,MAAM,eAAe;GACrB,mBAAmB,EAAE,MAAM,CAAC;GAC5B,cAAc,KAAK;EACrB,OAAO,IAAI,WAAW,SAAS;GAC7B,mBAAmB,KAAK;GACxB,cAAc,EAAE;EAClB;CACF;CAEA,MAAM,iBAAiB,UAAU;EAC/B,mBAAmB,KAAK;EACxB,cAAc,EAAE;CAClB;CAGA,OACE,oBAAC,SAAD,EAAA,UACE,oBAAC,cAAD;EAEE,aAAa;EACb,eAAe;EACf,gBAAgB,SAAS,UAAW,MAAM,WAAW,KAAK,IAAI,UAAU,CAAC;EACzE,WAAW;EACK;EAChB,IAAG;EACS;EACZ,SAAS;EACT,aAAa,EAAE,sBAAsB;EAErC,eAAe,WAAW,EAAE,oBAAoB,IAAI,EAAE,+BAA+B;EACrF,UAAU;EACV,SAAS;EACT,eAAe;EACf,SAAS,WAAW,CAAC,IAAI;EACZ;EACC;EACd,kBAAkB;CACnB,CAAA,EACM,CAAA;AAEb"}
|
|
@@ -10,9 +10,9 @@ const require_styles = require("./styles.js");
|
|
|
10
10
|
require("../../index.js");
|
|
11
11
|
let react = require("react");
|
|
12
12
|
react = require_runtime.__toESM(react);
|
|
13
|
+
let react_i18next = require("react-i18next");
|
|
13
14
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
14
15
|
let lodash_es = require("lodash-es");
|
|
15
|
-
let react_i18next = require("react-i18next");
|
|
16
16
|
let react_router = require("react-router");
|
|
17
17
|
let _mui_icons_material_Search = require("@mui/icons-material/Search");
|
|
18
18
|
_mui_icons_material_Search = require_runtime.__toESM(_mui_icons_material_Search);
|
|
@@ -24,7 +24,7 @@ var CONSTANTS = {
|
|
|
24
24
|
var Search = () => {
|
|
25
25
|
const { t } = (0, react_i18next.useTranslation)();
|
|
26
26
|
const navigate = (0, react_router.useNavigate)();
|
|
27
|
-
const { searchResults, isLoading, doSearch } = require_SearchProvider.useSearch();
|
|
27
|
+
const { searchResults, isLoading, isError, doSearch, resetSearch } = require_SearchProvider.useSearch();
|
|
28
28
|
const abortControllerRef = (0, react.useRef)(null);
|
|
29
29
|
const cancelAllSearchRequests = (0, react.useCallback)(() => {
|
|
30
30
|
if (abortControllerRef.current) {
|
|
@@ -45,11 +45,13 @@ var Search = () => {
|
|
|
45
45
|
}, [navigate]);
|
|
46
46
|
const doSearchRef = (0, react.useRef)(doSearch);
|
|
47
47
|
doSearchRef.current = doSearch;
|
|
48
|
+
const [isDebouncing, setIsDebouncing] = (0, react.useState)(false);
|
|
48
49
|
/**
|
|
49
50
|
* Stable fetch function that reads the latest doSearch from a ref,
|
|
50
51
|
* avoiding dependency changes that would break the debounce.
|
|
51
52
|
*/
|
|
52
53
|
const handleFetchPackages = (0, react.useCallback)(async ({ value }) => {
|
|
54
|
+
setIsDebouncing(false);
|
|
53
55
|
if (value?.trim() !== "") {
|
|
54
56
|
cancelAllSearchRequests();
|
|
55
57
|
const controller = new AbortController();
|
|
@@ -66,6 +68,11 @@ var Search = () => {
|
|
|
66
68
|
}
|
|
67
69
|
}, [cancelAllSearchRequests]);
|
|
68
70
|
const debouncedFetch = (0, react.useMemo)(() => (0, lodash_es.debounce)(handleFetchPackages, CONSTANTS.API_DELAY), [handleFetchPackages]);
|
|
71
|
+
const handleSuggestionsFetch = (0, react.useCallback)(({ value }) => {
|
|
72
|
+
resetSearch?.();
|
|
73
|
+
if (value?.trim() !== "") setIsDebouncing(true);
|
|
74
|
+
debouncedFetch({ value });
|
|
75
|
+
}, [resetSearch, debouncedFetch]);
|
|
69
76
|
(0, react.useEffect)(() => {
|
|
70
77
|
return () => {
|
|
71
78
|
debouncedFetch.cancel?.();
|
|
@@ -105,14 +112,15 @@ var Search = () => {
|
|
|
105
112
|
};
|
|
106
113
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AutoComplete.default, {
|
|
107
114
|
getOptionLabel,
|
|
115
|
+
hasError: isError,
|
|
108
116
|
onCleanSuggestions: handleOnBlur,
|
|
109
117
|
onSelectItem: handleClickSearch,
|
|
110
|
-
onSuggestionsFetch:
|
|
118
|
+
onSuggestionsFetch: handleSuggestionsFetch,
|
|
111
119
|
placeholder: t("search.packages"),
|
|
112
120
|
renderInput,
|
|
113
121
|
renderOption,
|
|
114
122
|
suggestions: searchResults,
|
|
115
|
-
suggestionsLoading: isLoading
|
|
123
|
+
suggestionsLoading: isLoading || isDebouncing
|
|
116
124
|
});
|
|
117
125
|
};
|
|
118
126
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Search.js","names":[],"sources":["../../../src/components/Search/Search.tsx"],"sourcesContent":["import SearchMui from '@mui/icons-material/Search';\nimport { debounce } from 'lodash-es';\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useNavigate } from 'react-router';\n\nimport { useSearch } from '../../';\nimport { Route } from '../../utils';\nimport AutoComplete from './AutoComplete';\nimport SearchItem from './SearchItem';\nimport { StyledInputAdornment, StyledTextField } from './styles';\nimport { normalizeSearchOption } from './utils';\n\nconst CONSTANTS = {\n API_DELAY: 300,\n ABORT_ERROR: 'AbortError',\n};\n\nconst Search: React.FC = () => {\n const { t } = useTranslation();\n const navigate = useNavigate();\n const { searchResults, isLoading, doSearch } = useSearch();\n\n const abortControllerRef = useRef<AbortController | null>(null);\n\n const cancelAllSearchRequests = useCallback(() => {\n if (abortControllerRef.current) {\n abortControllerRef.current.abort();\n abortControllerRef.current = null;\n }\n }, []);\n\n const handleOnBlur = useCallback(\n (event: React.SyntheticEvent) => {\n event.stopPropagation();\n cancelAllSearchRequests();\n },\n [cancelAllSearchRequests]\n );\n\n const handleClickSearch = useCallback(\n (event: React.SyntheticEvent, value: any, reason: string): void => {\n event.stopPropagation();\n if (reason === 'selectOption') {\n const { name } = normalizeSearchOption(value);\n if (name) {\n navigate(`${Route.DETAIL}${name}`);\n }\n }\n },\n [navigate]\n );\n\n // Use a ref to always access the latest doSearch without re-creating the debounced function\n const doSearchRef = useRef(doSearch);\n doSearchRef.current = doSearch;\n\n /**\n * Stable fetch function that reads the latest doSearch from a ref,\n * avoiding dependency changes that would break the debounce.\n */\n const handleFetchPackages = useCallback(\n async ({ value }: { value: string }) => {\n if (value?.trim() !== '') {\n // Abort any previous pending request before starting a new one\n cancelAllSearchRequests();\n\n // Create a new controller for the current request\n const controller = new AbortController();\n abortControllerRef.current = controller;\n\n try {\n await doSearchRef.current?.({\n text: value,\n signal: controller.signal,\n });\n } catch (err: any) {\n if (err.name === CONSTANTS.ABORT_ERROR) {\n console.warn('Search request aborted');\n } else {\n console.error('Search error:', err);\n }\n }\n }\n },\n [cancelAllSearchRequests]\n );\n\n // Memoize the debounced function so a single instance is reused across renders,\n // ensuring the debounce timer works correctly instead of creating a new timer per render.\n const debouncedFetch = useMemo(\n () => debounce(handleFetchPackages, CONSTANTS.API_DELAY),\n [handleFetchPackages]\n );\n\n useEffect(() => {\n return () => {\n debouncedFetch.cancel?.();\n cancelAllSearchRequests();\n };\n }, [debouncedFetch, cancelAllSearchRequests]);\n\n const renderOption = (props, option) => {\n const { key, ...otherProps } = props;\n const { name, version, description, isPrivate, isCached, isRemote } =\n normalizeSearchOption(option);\n return (\n <SearchItem\n key={key}\n {...otherProps}\n description={description}\n isCached={isCached}\n isPrivate={isPrivate}\n isRemote={isRemote}\n name={name}\n version={version}\n />\n );\n };\n\n const renderInput = (params) => {\n return (\n <StyledTextField\n {...params}\n InputProps={{\n ...params.InputProps,\n startAdornment: (\n <StyledInputAdornment position=\"start\">\n <SearchMui />\n </StyledInputAdornment>\n ),\n }}\n label=\"\"\n placeholder={t('search.packages')}\n variant=\"standard\"\n />\n );\n };\n\n const getOptionLabel = (option) => {\n return normalizeSearchOption(option).name;\n };\n\n return (\n <AutoComplete\n getOptionLabel={getOptionLabel}\n onCleanSuggestions={handleOnBlur}\n onSelectItem={handleClickSearch}\n onSuggestionsFetch={
|
|
1
|
+
{"version":3,"file":"Search.js","names":[],"sources":["../../../src/components/Search/Search.tsx"],"sourcesContent":["import SearchMui from '@mui/icons-material/Search';\nimport { debounce } from 'lodash-es';\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useNavigate } from 'react-router';\n\nimport { useSearch } from '../../';\nimport { Route } from '../../utils';\nimport AutoComplete from './AutoComplete';\nimport SearchItem from './SearchItem';\nimport { StyledInputAdornment, StyledTextField } from './styles';\nimport { normalizeSearchOption } from './utils';\n\nconst CONSTANTS = {\n API_DELAY: 300,\n ABORT_ERROR: 'AbortError',\n};\n\nconst Search: React.FC = () => {\n const { t } = useTranslation();\n const navigate = useNavigate();\n const { searchResults, isLoading, isError, doSearch, resetSearch } = useSearch();\n\n const abortControllerRef = useRef<AbortController | null>(null);\n\n const cancelAllSearchRequests = useCallback(() => {\n if (abortControllerRef.current) {\n abortControllerRef.current.abort();\n abortControllerRef.current = null;\n }\n }, []);\n\n const handleOnBlur = useCallback(\n (event: React.SyntheticEvent) => {\n event.stopPropagation();\n cancelAllSearchRequests();\n },\n [cancelAllSearchRequests]\n );\n\n const handleClickSearch = useCallback(\n (event: React.SyntheticEvent, value: any, reason: string): void => {\n event.stopPropagation();\n if (reason === 'selectOption') {\n const { name } = normalizeSearchOption(value);\n if (name) {\n navigate(`${Route.DETAIL}${name}`);\n }\n }\n },\n [navigate]\n );\n\n // Use a ref to always access the latest doSearch without re-creating the debounced function\n const doSearchRef = useRef(doSearch);\n doSearchRef.current = doSearch;\n\n // shows the dropdown as loading during the debounce window; without it the\n // immediate reset below reads as \"no results found\" on every keystroke\n const [isDebouncing, setIsDebouncing] = useState(false);\n\n /**\n * Stable fetch function that reads the latest doSearch from a ref,\n * avoiding dependency changes that would break the debounce.\n */\n const handleFetchPackages = useCallback(\n async ({ value }: { value: string }) => {\n setIsDebouncing(false);\n if (value?.trim() !== '') {\n // Abort any previous pending request before starting a new one\n cancelAllSearchRequests();\n\n // Create a new controller for the current request\n const controller = new AbortController();\n abortControllerRef.current = controller;\n\n try {\n await doSearchRef.current?.({\n text: value,\n signal: controller.signal,\n });\n } catch (err: any) {\n if (err.name === CONSTANTS.ABORT_ERROR) {\n console.warn('Search request aborted');\n } else {\n console.error('Search error:', err);\n }\n }\n }\n },\n [cancelAllSearchRequests]\n );\n\n // Memoize the debounced function so a single instance is reused across renders,\n // ensuring the debounce timer works correctly instead of creating a new timer per render.\n const debouncedFetch = useMemo(\n () => debounce(handleFetchPackages, CONSTANTS.API_DELAY),\n [handleFetchPackages]\n );\n\n // clear the previous query's results right away so the dropdown never lists\n // stale suggestions under the new input while the debounce timer runs\n const handleSuggestionsFetch = useCallback(\n ({ value }: { value: string }) => {\n resetSearch?.();\n if (value?.trim() !== '') {\n setIsDebouncing(true);\n }\n debouncedFetch({ value });\n },\n [resetSearch, debouncedFetch]\n );\n\n useEffect(() => {\n return () => {\n debouncedFetch.cancel?.();\n cancelAllSearchRequests();\n };\n }, [debouncedFetch, cancelAllSearchRequests]);\n\n const renderOption = (props, option) => {\n const { key, ...otherProps } = props;\n const { name, version, description, isPrivate, isCached, isRemote } =\n normalizeSearchOption(option);\n return (\n <SearchItem\n key={key}\n {...otherProps}\n description={description}\n isCached={isCached}\n isPrivate={isPrivate}\n isRemote={isRemote}\n name={name}\n version={version}\n />\n );\n };\n\n const renderInput = (params) => {\n return (\n <StyledTextField\n {...params}\n InputProps={{\n ...params.InputProps,\n startAdornment: (\n <StyledInputAdornment position=\"start\">\n <SearchMui />\n </StyledInputAdornment>\n ),\n }}\n label=\"\"\n placeholder={t('search.packages')}\n variant=\"standard\"\n />\n );\n };\n\n const getOptionLabel = (option) => {\n return normalizeSearchOption(option).name;\n };\n\n return (\n <AutoComplete\n getOptionLabel={getOptionLabel}\n hasError={isError}\n onCleanSuggestions={handleOnBlur}\n onSelectItem={handleClickSearch}\n onSuggestionsFetch={handleSuggestionsFetch}\n placeholder={t('search.packages')}\n renderInput={renderInput}\n renderOption={renderOption}\n suggestions={searchResults}\n suggestionsLoading={isLoading || isDebouncing}\n />\n );\n};\n\nexport default Search;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAaA,IAAM,YAAY;CAChB,WAAW;CACX,aAAa;AACf;AAEA,IAAM,eAAyB;CAC7B,MAAM,EAAE,OAAA,GAAM,cAAA,eAAA,CAAe;CAC7B,MAAM,YAAA,GAAW,aAAA,YAAA,CAAY;CAC7B,MAAM,EAAE,eAAe,WAAW,SAAS,UAAU,gBAAgB,uBAAA,UAAU;CAE/E,MAAM,sBAAA,GAAqB,MAAA,OAAA,CAA+B,IAAI;CAE9D,MAAM,2BAAA,GAA0B,MAAA,YAAA,OAAkB;EAChD,IAAI,mBAAmB,SAAS;GAC9B,mBAAmB,QAAQ,MAAM;GACjC,mBAAmB,UAAU;EAC/B;CACF,GAAG,CAAC,CAAC;CAEL,MAAM,gBAAA,GAAe,MAAA,YAAA,EAClB,UAAgC;EAC/B,MAAM,gBAAgB;EACtB,wBAAwB;CAC1B,GACA,CAAC,uBAAuB,CAC1B;CAEA,MAAM,qBAAA,GAAoB,MAAA,YAAA,EACvB,OAA6B,OAAY,WAAyB;EACjE,MAAM,gBAAgB;EACtB,IAAI,WAAW,gBAAgB;GAC7B,MAAM,EAAE,SAAS,cAAA,sBAAsB,KAAK;GAC5C,IAAI,MACF,SAAS,GAAG,eAAA,MAAM,SAAS,MAAM;EAErC;CACF,GACA,CAAC,QAAQ,CACX;CAGA,MAAM,eAAA,GAAc,MAAA,OAAA,CAAO,QAAQ;CACnC,YAAY,UAAU;CAItB,MAAM,CAAC,cAAc,oBAAA,GAAmB,MAAA,SAAA,CAAS,KAAK;;;;;CAMtD,MAAM,uBAAA,GAAsB,MAAA,YAAA,CAC1B,OAAO,EAAE,YAA+B;EACtC,gBAAgB,KAAK;EACrB,IAAI,OAAO,KAAK,MAAM,IAAI;GAExB,wBAAwB;GAGxB,MAAM,aAAa,IAAI,gBAAgB;GACvC,mBAAmB,UAAU;GAE7B,IAAI;IACF,MAAM,YAAY,UAAU;KAC1B,MAAM;KACN,QAAQ,WAAW;IACrB,CAAC;GACH,SAAS,KAAU;IACjB,IAAI,IAAI,SAAS,UAAU,aACzB,QAAQ,KAAK,wBAAwB;SAErC,QAAQ,MAAM,iBAAiB,GAAG;GAEtC;EACF;CACF,GACA,CAAC,uBAAuB,CAC1B;CAIA,MAAM,kBAAA,GAAiB,MAAA,QAAA,QAAA,GACf,UAAA,SAAA,CAAS,qBAAqB,UAAU,SAAS,GACvD,CAAC,mBAAmB,CACtB;CAIA,MAAM,0BAAA,GAAyB,MAAA,YAAA,EAC5B,EAAE,YAA+B;EAChC,cAAc;EACd,IAAI,OAAO,KAAK,MAAM,IACpB,gBAAgB,IAAI;EAEtB,eAAe,EAAE,MAAM,CAAC;CAC1B,GACA,CAAC,aAAa,cAAc,CAC9B;CAEA,CAAA,GAAA,MAAA,UAAA,OAAgB;EACd,aAAa;GACX,eAAe,SAAS;GACxB,wBAAwB;EAC1B;CACF,GAAG,CAAC,gBAAgB,uBAAuB,CAAC;CAE5C,MAAM,gBAAgB,OAAO,WAAW;EACtC,MAAM,EAAE,KAAK,GAAG,eAAe;EAC/B,MAAM,EAAE,MAAM,SAAS,aAAa,WAAW,UAAU,aACvD,cAAA,sBAAsB,MAAM;EAC9B,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,mBAAA,SAAD;GAEE,GAAI;GACS;GACH;GACC;GACD;GACJ;GACG;EACV,GARM,GAQN;CAEL;CAEA,MAAM,eAAe,WAAW;EAC9B,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,eAAA,iBAAD;GACE,GAAI;GACJ,YAAY;IACV,GAAG,OAAO;IACV,gBACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,eAAA,sBAAD;KAAsB,UAAS;KAC7B,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,2BAAA,SAAD,CAAY,CAAA;IACQ,CAAA;GAE1B;GACA,OAAM;GACN,aAAa,EAAE,iBAAiB;GAChC,SAAQ;EACT,CAAA;CAEL;CAEA,MAAM,kBAAkB,WAAW;EACjC,OAAO,cAAA,sBAAsB,MAAM,CAAC,CAAC;CACvC;CAEA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,qBAAA,SAAD;EACkB;EAChB,UAAU;EACV,oBAAoB;EACpB,cAAc;EACd,oBAAoB;EACpB,aAAa,EAAE,iBAAiB;EACnB;EACC;EACd,aAAa;EACb,oBAAoB,aAAa;CAClC,CAAA;AAEL"}
|
|
@@ -7,10 +7,10 @@ import { normalizeSearchOption } from "./utils.mjs";
|
|
|
7
7
|
import SearchItem from "./SearchItem.mjs";
|
|
8
8
|
import { StyledInputAdornment, StyledTextField } from "./styles.mjs";
|
|
9
9
|
import "../../index.mjs";
|
|
10
|
-
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
10
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
11
|
+
import { useTranslation } from "react-i18next";
|
|
11
12
|
import { jsx } from "react/jsx-runtime";
|
|
12
13
|
import { debounce } from "lodash-es";
|
|
13
|
-
import { useTranslation } from "react-i18next";
|
|
14
14
|
import { useNavigate } from "react-router";
|
|
15
15
|
import SearchMui from "@mui/icons-material/Search";
|
|
16
16
|
//#region src/components/Search/Search.tsx
|
|
@@ -21,7 +21,7 @@ var CONSTANTS = {
|
|
|
21
21
|
var Search = () => {
|
|
22
22
|
const { t } = useTranslation();
|
|
23
23
|
const navigate = useNavigate();
|
|
24
|
-
const { searchResults, isLoading, doSearch } = useSearch();
|
|
24
|
+
const { searchResults, isLoading, isError, doSearch, resetSearch } = useSearch();
|
|
25
25
|
const abortControllerRef = useRef(null);
|
|
26
26
|
const cancelAllSearchRequests = useCallback(() => {
|
|
27
27
|
if (abortControllerRef.current) {
|
|
@@ -42,11 +42,13 @@ var Search = () => {
|
|
|
42
42
|
}, [navigate]);
|
|
43
43
|
const doSearchRef = useRef(doSearch);
|
|
44
44
|
doSearchRef.current = doSearch;
|
|
45
|
+
const [isDebouncing, setIsDebouncing] = useState(false);
|
|
45
46
|
/**
|
|
46
47
|
* Stable fetch function that reads the latest doSearch from a ref,
|
|
47
48
|
* avoiding dependency changes that would break the debounce.
|
|
48
49
|
*/
|
|
49
50
|
const handleFetchPackages = useCallback(async ({ value }) => {
|
|
51
|
+
setIsDebouncing(false);
|
|
50
52
|
if (value?.trim() !== "") {
|
|
51
53
|
cancelAllSearchRequests();
|
|
52
54
|
const controller = new AbortController();
|
|
@@ -63,6 +65,11 @@ var Search = () => {
|
|
|
63
65
|
}
|
|
64
66
|
}, [cancelAllSearchRequests]);
|
|
65
67
|
const debouncedFetch = useMemo(() => debounce(handleFetchPackages, CONSTANTS.API_DELAY), [handleFetchPackages]);
|
|
68
|
+
const handleSuggestionsFetch = useCallback(({ value }) => {
|
|
69
|
+
resetSearch?.();
|
|
70
|
+
if (value?.trim() !== "") setIsDebouncing(true);
|
|
71
|
+
debouncedFetch({ value });
|
|
72
|
+
}, [resetSearch, debouncedFetch]);
|
|
66
73
|
useEffect(() => {
|
|
67
74
|
return () => {
|
|
68
75
|
debouncedFetch.cancel?.();
|
|
@@ -102,14 +109,15 @@ var Search = () => {
|
|
|
102
109
|
};
|
|
103
110
|
return /* @__PURE__ */ jsx(AutoComplete, {
|
|
104
111
|
getOptionLabel,
|
|
112
|
+
hasError: isError,
|
|
105
113
|
onCleanSuggestions: handleOnBlur,
|
|
106
114
|
onSelectItem: handleClickSearch,
|
|
107
|
-
onSuggestionsFetch:
|
|
115
|
+
onSuggestionsFetch: handleSuggestionsFetch,
|
|
108
116
|
placeholder: t("search.packages"),
|
|
109
117
|
renderInput,
|
|
110
118
|
renderOption,
|
|
111
119
|
suggestions: searchResults,
|
|
112
|
-
suggestionsLoading: isLoading
|
|
120
|
+
suggestionsLoading: isLoading || isDebouncing
|
|
113
121
|
});
|
|
114
122
|
};
|
|
115
123
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Search.mjs","names":[],"sources":["../../../src/components/Search/Search.tsx"],"sourcesContent":["import SearchMui from '@mui/icons-material/Search';\nimport { debounce } from 'lodash-es';\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useNavigate } from 'react-router';\n\nimport { useSearch } from '../../';\nimport { Route } from '../../utils';\nimport AutoComplete from './AutoComplete';\nimport SearchItem from './SearchItem';\nimport { StyledInputAdornment, StyledTextField } from './styles';\nimport { normalizeSearchOption } from './utils';\n\nconst CONSTANTS = {\n API_DELAY: 300,\n ABORT_ERROR: 'AbortError',\n};\n\nconst Search: React.FC = () => {\n const { t } = useTranslation();\n const navigate = useNavigate();\n const { searchResults, isLoading, doSearch } = useSearch();\n\n const abortControllerRef = useRef<AbortController | null>(null);\n\n const cancelAllSearchRequests = useCallback(() => {\n if (abortControllerRef.current) {\n abortControllerRef.current.abort();\n abortControllerRef.current = null;\n }\n }, []);\n\n const handleOnBlur = useCallback(\n (event: React.SyntheticEvent) => {\n event.stopPropagation();\n cancelAllSearchRequests();\n },\n [cancelAllSearchRequests]\n );\n\n const handleClickSearch = useCallback(\n (event: React.SyntheticEvent, value: any, reason: string): void => {\n event.stopPropagation();\n if (reason === 'selectOption') {\n const { name } = normalizeSearchOption(value);\n if (name) {\n navigate(`${Route.DETAIL}${name}`);\n }\n }\n },\n [navigate]\n );\n\n // Use a ref to always access the latest doSearch without re-creating the debounced function\n const doSearchRef = useRef(doSearch);\n doSearchRef.current = doSearch;\n\n /**\n * Stable fetch function that reads the latest doSearch from a ref,\n * avoiding dependency changes that would break the debounce.\n */\n const handleFetchPackages = useCallback(\n async ({ value }: { value: string }) => {\n if (value?.trim() !== '') {\n // Abort any previous pending request before starting a new one\n cancelAllSearchRequests();\n\n // Create a new controller for the current request\n const controller = new AbortController();\n abortControllerRef.current = controller;\n\n try {\n await doSearchRef.current?.({\n text: value,\n signal: controller.signal,\n });\n } catch (err: any) {\n if (err.name === CONSTANTS.ABORT_ERROR) {\n console.warn('Search request aborted');\n } else {\n console.error('Search error:', err);\n }\n }\n }\n },\n [cancelAllSearchRequests]\n );\n\n // Memoize the debounced function so a single instance is reused across renders,\n // ensuring the debounce timer works correctly instead of creating a new timer per render.\n const debouncedFetch = useMemo(\n () => debounce(handleFetchPackages, CONSTANTS.API_DELAY),\n [handleFetchPackages]\n );\n\n useEffect(() => {\n return () => {\n debouncedFetch.cancel?.();\n cancelAllSearchRequests();\n };\n }, [debouncedFetch, cancelAllSearchRequests]);\n\n const renderOption = (props, option) => {\n const { key, ...otherProps } = props;\n const { name, version, description, isPrivate, isCached, isRemote } =\n normalizeSearchOption(option);\n return (\n <SearchItem\n key={key}\n {...otherProps}\n description={description}\n isCached={isCached}\n isPrivate={isPrivate}\n isRemote={isRemote}\n name={name}\n version={version}\n />\n );\n };\n\n const renderInput = (params) => {\n return (\n <StyledTextField\n {...params}\n InputProps={{\n ...params.InputProps,\n startAdornment: (\n <StyledInputAdornment position=\"start\">\n <SearchMui />\n </StyledInputAdornment>\n ),\n }}\n label=\"\"\n placeholder={t('search.packages')}\n variant=\"standard\"\n />\n );\n };\n\n const getOptionLabel = (option) => {\n return normalizeSearchOption(option).name;\n };\n\n return (\n <AutoComplete\n getOptionLabel={getOptionLabel}\n onCleanSuggestions={handleOnBlur}\n onSelectItem={handleClickSearch}\n onSuggestionsFetch={
|
|
1
|
+
{"version":3,"file":"Search.mjs","names":[],"sources":["../../../src/components/Search/Search.tsx"],"sourcesContent":["import SearchMui from '@mui/icons-material/Search';\nimport { debounce } from 'lodash-es';\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useNavigate } from 'react-router';\n\nimport { useSearch } from '../../';\nimport { Route } from '../../utils';\nimport AutoComplete from './AutoComplete';\nimport SearchItem from './SearchItem';\nimport { StyledInputAdornment, StyledTextField } from './styles';\nimport { normalizeSearchOption } from './utils';\n\nconst CONSTANTS = {\n API_DELAY: 300,\n ABORT_ERROR: 'AbortError',\n};\n\nconst Search: React.FC = () => {\n const { t } = useTranslation();\n const navigate = useNavigate();\n const { searchResults, isLoading, isError, doSearch, resetSearch } = useSearch();\n\n const abortControllerRef = useRef<AbortController | null>(null);\n\n const cancelAllSearchRequests = useCallback(() => {\n if (abortControllerRef.current) {\n abortControllerRef.current.abort();\n abortControllerRef.current = null;\n }\n }, []);\n\n const handleOnBlur = useCallback(\n (event: React.SyntheticEvent) => {\n event.stopPropagation();\n cancelAllSearchRequests();\n },\n [cancelAllSearchRequests]\n );\n\n const handleClickSearch = useCallback(\n (event: React.SyntheticEvent, value: any, reason: string): void => {\n event.stopPropagation();\n if (reason === 'selectOption') {\n const { name } = normalizeSearchOption(value);\n if (name) {\n navigate(`${Route.DETAIL}${name}`);\n }\n }\n },\n [navigate]\n );\n\n // Use a ref to always access the latest doSearch without re-creating the debounced function\n const doSearchRef = useRef(doSearch);\n doSearchRef.current = doSearch;\n\n // shows the dropdown as loading during the debounce window; without it the\n // immediate reset below reads as \"no results found\" on every keystroke\n const [isDebouncing, setIsDebouncing] = useState(false);\n\n /**\n * Stable fetch function that reads the latest doSearch from a ref,\n * avoiding dependency changes that would break the debounce.\n */\n const handleFetchPackages = useCallback(\n async ({ value }: { value: string }) => {\n setIsDebouncing(false);\n if (value?.trim() !== '') {\n // Abort any previous pending request before starting a new one\n cancelAllSearchRequests();\n\n // Create a new controller for the current request\n const controller = new AbortController();\n abortControllerRef.current = controller;\n\n try {\n await doSearchRef.current?.({\n text: value,\n signal: controller.signal,\n });\n } catch (err: any) {\n if (err.name === CONSTANTS.ABORT_ERROR) {\n console.warn('Search request aborted');\n } else {\n console.error('Search error:', err);\n }\n }\n }\n },\n [cancelAllSearchRequests]\n );\n\n // Memoize the debounced function so a single instance is reused across renders,\n // ensuring the debounce timer works correctly instead of creating a new timer per render.\n const debouncedFetch = useMemo(\n () => debounce(handleFetchPackages, CONSTANTS.API_DELAY),\n [handleFetchPackages]\n );\n\n // clear the previous query's results right away so the dropdown never lists\n // stale suggestions under the new input while the debounce timer runs\n const handleSuggestionsFetch = useCallback(\n ({ value }: { value: string }) => {\n resetSearch?.();\n if (value?.trim() !== '') {\n setIsDebouncing(true);\n }\n debouncedFetch({ value });\n },\n [resetSearch, debouncedFetch]\n );\n\n useEffect(() => {\n return () => {\n debouncedFetch.cancel?.();\n cancelAllSearchRequests();\n };\n }, [debouncedFetch, cancelAllSearchRequests]);\n\n const renderOption = (props, option) => {\n const { key, ...otherProps } = props;\n const { name, version, description, isPrivate, isCached, isRemote } =\n normalizeSearchOption(option);\n return (\n <SearchItem\n key={key}\n {...otherProps}\n description={description}\n isCached={isCached}\n isPrivate={isPrivate}\n isRemote={isRemote}\n name={name}\n version={version}\n />\n );\n };\n\n const renderInput = (params) => {\n return (\n <StyledTextField\n {...params}\n InputProps={{\n ...params.InputProps,\n startAdornment: (\n <StyledInputAdornment position=\"start\">\n <SearchMui />\n </StyledInputAdornment>\n ),\n }}\n label=\"\"\n placeholder={t('search.packages')}\n variant=\"standard\"\n />\n );\n };\n\n const getOptionLabel = (option) => {\n return normalizeSearchOption(option).name;\n };\n\n return (\n <AutoComplete\n getOptionLabel={getOptionLabel}\n hasError={isError}\n onCleanSuggestions={handleOnBlur}\n onSelectItem={handleClickSearch}\n onSuggestionsFetch={handleSuggestionsFetch}\n placeholder={t('search.packages')}\n renderInput={renderInput}\n renderOption={renderOption}\n suggestions={searchResults}\n suggestionsLoading={isLoading || isDebouncing}\n />\n );\n};\n\nexport default Search;\n"],"mappings":";;;;;;;;;;;;;;;;AAaA,IAAM,YAAY;CAChB,WAAW;CACX,aAAa;AACf;AAEA,IAAM,eAAyB;CAC7B,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,WAAW,YAAY;CAC7B,MAAM,EAAE,eAAe,WAAW,SAAS,UAAU,gBAAgB,UAAU;CAE/E,MAAM,qBAAqB,OAA+B,IAAI;CAE9D,MAAM,0BAA0B,kBAAkB;EAChD,IAAI,mBAAmB,SAAS;GAC9B,mBAAmB,QAAQ,MAAM;GACjC,mBAAmB,UAAU;EAC/B;CACF,GAAG,CAAC,CAAC;CAEL,MAAM,eAAe,aAClB,UAAgC;EAC/B,MAAM,gBAAgB;EACtB,wBAAwB;CAC1B,GACA,CAAC,uBAAuB,CAC1B;CAEA,MAAM,oBAAoB,aACvB,OAA6B,OAAY,WAAyB;EACjE,MAAM,gBAAgB;EACtB,IAAI,WAAW,gBAAgB;GAC7B,MAAM,EAAE,SAAS,sBAAsB,KAAK;GAC5C,IAAI,MACF,SAAS,GAAG,QAAM,SAAS,MAAM;EAErC;CACF,GACA,CAAC,QAAQ,CACX;CAGA,MAAM,cAAc,OAAO,QAAQ;CACnC,YAAY,UAAU;CAItB,MAAM,CAAC,cAAc,mBAAmB,SAAS,KAAK;;;;;CAMtD,MAAM,sBAAsB,YAC1B,OAAO,EAAE,YAA+B;EACtC,gBAAgB,KAAK;EACrB,IAAI,OAAO,KAAK,MAAM,IAAI;GAExB,wBAAwB;GAGxB,MAAM,aAAa,IAAI,gBAAgB;GACvC,mBAAmB,UAAU;GAE7B,IAAI;IACF,MAAM,YAAY,UAAU;KAC1B,MAAM;KACN,QAAQ,WAAW;IACrB,CAAC;GACH,SAAS,KAAU;IACjB,IAAI,IAAI,SAAS,UAAU,aACzB,QAAQ,KAAK,wBAAwB;SAErC,QAAQ,MAAM,iBAAiB,GAAG;GAEtC;EACF;CACF,GACA,CAAC,uBAAuB,CAC1B;CAIA,MAAM,iBAAiB,cACf,SAAS,qBAAqB,UAAU,SAAS,GACvD,CAAC,mBAAmB,CACtB;CAIA,MAAM,yBAAyB,aAC5B,EAAE,YAA+B;EAChC,cAAc;EACd,IAAI,OAAO,KAAK,MAAM,IACpB,gBAAgB,IAAI;EAEtB,eAAe,EAAE,MAAM,CAAC;CAC1B,GACA,CAAC,aAAa,cAAc,CAC9B;CAEA,gBAAgB;EACd,aAAa;GACX,eAAe,SAAS;GACxB,wBAAwB;EAC1B;CACF,GAAG,CAAC,gBAAgB,uBAAuB,CAAC;CAE5C,MAAM,gBAAgB,OAAO,WAAW;EACtC,MAAM,EAAE,KAAK,GAAG,eAAe;EAC/B,MAAM,EAAE,MAAM,SAAS,aAAa,WAAW,UAAU,aACvD,sBAAsB,MAAM;EAC9B,OACE,oBAAC,YAAD;GAEE,GAAI;GACS;GACH;GACC;GACD;GACJ;GACG;EACV,GARM,GAQN;CAEL;CAEA,MAAM,eAAe,WAAW;EAC9B,OACE,oBAAC,iBAAD;GACE,GAAI;GACJ,YAAY;IACV,GAAG,OAAO;IACV,gBACE,oBAAC,sBAAD;KAAsB,UAAS;KAC7B,UAAA,oBAAC,WAAD,CAAY,CAAA;IACQ,CAAA;GAE1B;GACA,OAAM;GACN,aAAa,EAAE,iBAAiB;GAChC,SAAQ;EACT,CAAA;CAEL;CAEA,MAAM,kBAAkB,WAAW;EACjC,OAAO,sBAAsB,MAAM,CAAC,CAAC;CACvC;CAEA,OACE,oBAAC,cAAD;EACkB;EAChB,UAAU;EACV,oBAAoB;EACpB,cAAc;EACd,oBAAoB;EACpB,aAAa,EAAE,iBAAiB;EACnB;EACC;EACd,aAAa;EACb,oBAAoB,aAAa;CAClC,CAAA;AAEL"}
|
|
@@ -6,10 +6,10 @@ let _emotion_styled = require("@emotion/styled");
|
|
|
6
6
|
_emotion_styled = require_runtime.__toESM(_emotion_styled);
|
|
7
7
|
let react = require("react");
|
|
8
8
|
react = require_runtime.__toESM(react);
|
|
9
|
+
let react_i18next = require("react-i18next");
|
|
9
10
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
11
|
let _mui_material_Stack = require("@mui/material/Stack");
|
|
11
12
|
_mui_material_Stack = require_runtime.__toESM(_mui_material_Stack);
|
|
12
|
-
let react_i18next = require("react-i18next");
|
|
13
13
|
let _mui_material_Chip = require("@mui/material/Chip");
|
|
14
14
|
_mui_material_Chip = require_runtime.__toESM(_mui_material_Chip);
|
|
15
15
|
let _mui_icons_material_Cached = require("@mui/icons-material/Cached");
|
|
@@ -3,9 +3,9 @@ import { cleanDescription } from "./utils.mjs";
|
|
|
3
3
|
import "../../index.mjs";
|
|
4
4
|
import styled from "@emotion/styled";
|
|
5
5
|
import "react";
|
|
6
|
+
import { useTranslation } from "react-i18next";
|
|
6
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
8
|
import Stack from "@mui/material/Stack";
|
|
8
|
-
import { useTranslation } from "react-i18next";
|
|
9
9
|
import Chip from "@mui/material/Chip";
|
|
10
10
|
import Cached from "@mui/icons-material/Cached";
|
|
11
11
|
import HttpsIcon from "@mui/icons-material/Https";
|
|
@@ -7,8 +7,8 @@ let _mui_material_IconButton = require("@mui/material/IconButton");
|
|
|
7
7
|
_mui_material_IconButton = require_runtime.__toESM(_mui_material_IconButton);
|
|
8
8
|
let react = require("react");
|
|
9
9
|
react = require_runtime.__toESM(react);
|
|
10
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
10
|
let react_i18next = require("react-i18next");
|
|
11
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
12
12
|
let _mui_icons_material_Check = require("@mui/icons-material/Check");
|
|
13
13
|
_mui_icons_material_Check = require_runtime.__toESM(_mui_icons_material_Check);
|
|
14
14
|
let _mui_icons_material_Settings = require("@mui/icons-material/Settings");
|
|
@@ -4,8 +4,8 @@ import "../../providers/PersistenceSettingProvider/index.mjs";
|
|
|
4
4
|
import "../../providers/index.mjs";
|
|
5
5
|
import IconButton from "@mui/material/IconButton";
|
|
6
6
|
import React from "react";
|
|
7
|
-
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
7
|
import { useTranslation } from "react-i18next";
|
|
8
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import Check from "@mui/icons-material/Check";
|
|
10
10
|
import Settings from "@mui/icons-material/Settings";
|
|
11
11
|
import ListItemIcon from "@mui/material/ListItemIcon";
|
|
@@ -10,10 +10,10 @@ let _emotion_styled = require("@emotion/styled");
|
|
|
10
10
|
_emotion_styled = require_runtime.__toESM(_emotion_styled);
|
|
11
11
|
let react = require("react");
|
|
12
12
|
react = require_runtime.__toESM(react);
|
|
13
|
+
let react_i18next = require("react-i18next");
|
|
13
14
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
14
15
|
let _mui_material_Box = require("@mui/material/Box");
|
|
15
16
|
_mui_material_Box = require_runtime.__toESM(_mui_material_Box);
|
|
16
|
-
let react_i18next = require("react-i18next");
|
|
17
17
|
//#region src/components/SideBarTitle/SideBarTitle.tsx
|
|
18
18
|
var Icon = _emotion_styled.default.div(({ theme }) => ({ marginLeft: theme.spacing(1) }));
|
|
19
19
|
var ModuleJS = ({ module }) => {
|
|
@@ -36,7 +36,7 @@ var DetailSidebarTitle = ({ description, packageName, version, isLatest, hasType
|
|
|
36
36
|
] }) }) }),
|
|
37
37
|
description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: description }),
|
|
38
38
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledBoxVersion, {
|
|
39
|
-
title: require_utils.formatDate(time),
|
|
39
|
+
title: time ? require_utils.formatDate(time) : void 0,
|
|
40
40
|
children: [isLatest ? t("sidebar.detail.latest-version", { version }) : t("sidebar.detail.version", { version }), time ? " - " + t("sidebar.detail.published") + " " + require_utils.formatDateDistance(time) : t("versions.not-available")]
|
|
41
41
|
})
|
|
42
42
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideBarTitle.js","names":[],"sources":["../../../src/components/SideBarTitle/SideBarTitle.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport Box from '@mui/material/Box';\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport type { Theme } from '../../Theme';\nimport Heading from '../Heading';\nimport { CommonJS, ES6Modules, TypeScript } from '../Icons';\nimport { formatDate, formatDateDistance } from './utils';\n\nexport type ModuleType = 'commonjs' | 'module';\n\ninterface Props {\n packageName: string;\n description?: string;\n version: string;\n isLatest: boolean;\n hasTypes?: boolean;\n moduleTypes: ModuleType[];\n time: string;\n}\n\nconst Icon = styled.div<{ theme?: Theme }>(({ theme }) => ({\n marginLeft: theme.spacing(1),\n}));\n\nconst ModuleJS: React.FC<{ module: ModuleType | void }> = ({ module }) => {\n if (module === 'commonjs') {\n return (\n <Icon>\n <CommonJS />\n </Icon>\n );\n } else if (module === 'module') {\n return (\n <Icon>\n <ES6Modules />\n </Icon>\n );\n } else {\n return null;\n }\n};\n\nconst DetailSidebarTitle: React.FC<Props> = ({\n description,\n packageName,\n version,\n isLatest,\n hasTypes,\n moduleTypes,\n time,\n}) => {\n const { t } = useTranslation();\n return (\n <Box className={'detail-info'} display=\"flex\" flexDirection=\"column\" marginBottom=\"8px\">\n <StyledHeading>\n <TitleWrapper>\n <>\n {packageName}\n {hasTypes && (\n <Icon>\n <TypeScript />\n </Icon>\n )}\n {moduleTypes.map((module, index) => (\n <ModuleJS key={index} module={module} />\n ))}\n </>\n </TitleWrapper>\n </StyledHeading>\n {description && <div>{description}</div>}\n <StyledBoxVersion title={formatDate(time)}>\n {isLatest\n ? t('sidebar.detail.latest-version', { version })\n : t('sidebar.detail.version', { version })}\n {time\n ? ' - ' + t('sidebar.detail.published') + ' ' + formatDateDistance(time)\n : t('versions.not-available')}\n </StyledBoxVersion>\n </Box>\n );\n};\n\nexport default DetailSidebarTitle;\n\nconst TitleWrapper = styled.div({\n display: 'flex',\n alignItems: 'center',\n});\n\nconst StyledHeading = styled(Heading)({\n fontSize: '1rem',\n fontWeight: 700,\n});\n\nconst StyledBoxVersion = styled(Box)<{ theme?: Theme }>(({ theme }) => ({\n color: theme.palette.text.secondary,\n fontSize: theme.fontSize.sm,\n}));\n"],"mappings":";;;;;;;;;;;;;;;;;AAsBA,IAAM,OAAO,gBAAA,QAAO,KAAwB,EAAE,aAAa,EACzD,YAAY,MAAM,QAAQ,CAAC,EAC7B,EAAE;AAEF,IAAM,YAAqD,EAAE,aAAa;CACxE,IAAI,WAAW,YACb,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,iBAAA,UAAD,CAAW,CAAA,EACP,CAAA;MAEH,IAAI,WAAW,UACpB,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,kBAAA,YAAD,CAAa,CAAA,EACT,CAAA;MAGR,OAAO;AAEX;AAEA,IAAM,sBAAuC,EAC3C,aACA,aACA,SACA,UACA,UACA,aACA,WACI;CACJ,MAAM,EAAE,OAAA,GAAM,cAAA,eAAA,CAAe;CAC7B,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,kBAAA,SAAD;EAAK,WAAW;EAAe,SAAQ;EAAO,eAAc;EAAS,cAAa;EAAlF,UAAA;GACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,eAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,cAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,KAAA,CAAA,kBAAA,UAAA,EAAA,UAAA;IACG;IACA,YACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,mBAAA,YAAD,CAAa,CAAA,EACT,CAAA;IAEP,YAAY,KAAK,QAAQ,UACxB,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD,EAA8B,OAAS,GAAxB,KAAwB,CACxC;GACD,EAAA,CAAA,EACU,CAAA,EACD,CAAA;GACd,eAAe,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD,EAAA,UAAM,YAAiB,CAAA;GACvC,iBAAA,GAAA,kBAAA,KAAA,CAAC,kBAAD;IAAkB,OAAO,cAAA,WAAW,IAAI;
|
|
1
|
+
{"version":3,"file":"SideBarTitle.js","names":[],"sources":["../../../src/components/SideBarTitle/SideBarTitle.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport Box from '@mui/material/Box';\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport type { Theme } from '../../Theme';\nimport Heading from '../Heading';\nimport { CommonJS, ES6Modules, TypeScript } from '../Icons';\nimport { formatDate, formatDateDistance } from './utils';\n\nexport type ModuleType = 'commonjs' | 'module';\n\ninterface Props {\n packageName: string;\n description?: string;\n version: string;\n isLatest: boolean;\n hasTypes?: boolean;\n moduleTypes: ModuleType[];\n time: string;\n}\n\nconst Icon = styled.div<{ theme?: Theme }>(({ theme }) => ({\n marginLeft: theme.spacing(1),\n}));\n\nconst ModuleJS: React.FC<{ module: ModuleType | void }> = ({ module }) => {\n if (module === 'commonjs') {\n return (\n <Icon>\n <CommonJS />\n </Icon>\n );\n } else if (module === 'module') {\n return (\n <Icon>\n <ES6Modules />\n </Icon>\n );\n } else {\n return null;\n }\n};\n\nconst DetailSidebarTitle: React.FC<Props> = ({\n description,\n packageName,\n version,\n isLatest,\n hasTypes,\n moduleTypes,\n time,\n}) => {\n const { t } = useTranslation();\n return (\n <Box className={'detail-info'} display=\"flex\" flexDirection=\"column\" marginBottom=\"8px\">\n <StyledHeading>\n <TitleWrapper>\n <>\n {packageName}\n {hasTypes && (\n <Icon>\n <TypeScript />\n </Icon>\n )}\n {moduleTypes.map((module, index) => (\n <ModuleJS key={index} module={module} />\n ))}\n </>\n </TitleWrapper>\n </StyledHeading>\n {description && <div>{description}</div>}\n <StyledBoxVersion title={time ? formatDate(time) : undefined}>\n {isLatest\n ? t('sidebar.detail.latest-version', { version })\n : t('sidebar.detail.version', { version })}\n {time\n ? ' - ' + t('sidebar.detail.published') + ' ' + formatDateDistance(time)\n : t('versions.not-available')}\n </StyledBoxVersion>\n </Box>\n );\n};\n\nexport default DetailSidebarTitle;\n\nconst TitleWrapper = styled.div({\n display: 'flex',\n alignItems: 'center',\n});\n\nconst StyledHeading = styled(Heading)({\n fontSize: '1rem',\n fontWeight: 700,\n});\n\nconst StyledBoxVersion = styled(Box)<{ theme?: Theme }>(({ theme }) => ({\n color: theme.palette.text.secondary,\n fontSize: theme.fontSize.sm,\n}));\n"],"mappings":";;;;;;;;;;;;;;;;;AAsBA,IAAM,OAAO,gBAAA,QAAO,KAAwB,EAAE,aAAa,EACzD,YAAY,MAAM,QAAQ,CAAC,EAC7B,EAAE;AAEF,IAAM,YAAqD,EAAE,aAAa;CACxE,IAAI,WAAW,YACb,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,iBAAA,UAAD,CAAW,CAAA,EACP,CAAA;MAEH,IAAI,WAAW,UACpB,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,kBAAA,YAAD,CAAa,CAAA,EACT,CAAA;MAGR,OAAO;AAEX;AAEA,IAAM,sBAAuC,EAC3C,aACA,aACA,SACA,UACA,UACA,aACA,WACI;CACJ,MAAM,EAAE,OAAA,GAAM,cAAA,eAAA,CAAe;CAC7B,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,kBAAA,SAAD;EAAK,WAAW;EAAe,SAAQ;EAAO,eAAc;EAAS,cAAa;EAAlF,UAAA;GACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,eAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,cAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,KAAA,CAAA,kBAAA,UAAA,EAAA,UAAA;IACG;IACA,YACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,mBAAA,YAAD,CAAa,CAAA,EACT,CAAA;IAEP,YAAY,KAAK,QAAQ,UACxB,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD,EAA8B,OAAS,GAAxB,KAAwB,CACxC;GACD,EAAA,CAAA,EACU,CAAA,EACD,CAAA;GACd,eAAe,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD,EAAA,UAAM,YAAiB,CAAA;GACvC,iBAAA,GAAA,kBAAA,KAAA,CAAC,kBAAD;IAAkB,OAAO,OAAO,cAAA,WAAW,IAAI,IAAI,KAAA;IAAnD,UAAA,CACG,WACG,EAAE,iCAAiC,EAAE,QAAQ,CAAC,IAC9C,EAAE,0BAA0B,EAAE,QAAQ,CAAC,GAC1C,OACG,QAAQ,EAAE,0BAA0B,IAAI,MAAM,cAAA,mBAAmB,IAAI,IACrE,EAAE,wBAAwB,CACd;;EACf;;AAET;AAIA,IAAM,eAAe,gBAAA,QAAO,IAAI;CAC9B,SAAS;CACT,YAAY;AACd,CAAC;AAED,IAAM,iBAAA,GAAgB,gBAAA,QAAA,CAAO,gBAAA,OAAO,CAAC,CAAC;CACpC,UAAU;CACV,YAAY;AACd,CAAC;AAED,IAAM,oBAAA,GAAmB,gBAAA,QAAA,CAAO,kBAAA,OAAG,CAAC,EAAqB,EAAE,aAAa;CACtE,OAAO,MAAM,QAAQ,KAAK;CAC1B,UAAU,MAAM,SAAS;AAC3B,EAAE"}
|
|
@@ -7,9 +7,9 @@ import "../Heading/index.mjs";
|
|
|
7
7
|
import { formatDate, formatDateDistance } from "./utils.mjs";
|
|
8
8
|
import styled from "@emotion/styled";
|
|
9
9
|
import "react";
|
|
10
|
+
import { useTranslation } from "react-i18next";
|
|
10
11
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
12
|
import Box from "@mui/material/Box";
|
|
12
|
-
import { useTranslation } from "react-i18next";
|
|
13
13
|
//#region src/components/SideBarTitle/SideBarTitle.tsx
|
|
14
14
|
var Icon = styled.div(({ theme }) => ({ marginLeft: theme.spacing(1) }));
|
|
15
15
|
var ModuleJS = ({ module }) => {
|
|
@@ -32,7 +32,7 @@ var DetailSidebarTitle = ({ description, packageName, version, isLatest, hasType
|
|
|
32
32
|
] }) }) }),
|
|
33
33
|
description && /* @__PURE__ */ jsx("div", { children: description }),
|
|
34
34
|
/* @__PURE__ */ jsxs(StyledBoxVersion, {
|
|
35
|
-
title: formatDate(time),
|
|
35
|
+
title: time ? formatDate(time) : void 0,
|
|
36
36
|
children: [isLatest ? t("sidebar.detail.latest-version", { version }) : t("sidebar.detail.version", { version }), time ? " - " + t("sidebar.detail.published") + " " + formatDateDistance(time) : t("versions.not-available")]
|
|
37
37
|
})
|
|
38
38
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideBarTitle.mjs","names":[],"sources":["../../../src/components/SideBarTitle/SideBarTitle.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport Box from '@mui/material/Box';\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport type { Theme } from '../../Theme';\nimport Heading from '../Heading';\nimport { CommonJS, ES6Modules, TypeScript } from '../Icons';\nimport { formatDate, formatDateDistance } from './utils';\n\nexport type ModuleType = 'commonjs' | 'module';\n\ninterface Props {\n packageName: string;\n description?: string;\n version: string;\n isLatest: boolean;\n hasTypes?: boolean;\n moduleTypes: ModuleType[];\n time: string;\n}\n\nconst Icon = styled.div<{ theme?: Theme }>(({ theme }) => ({\n marginLeft: theme.spacing(1),\n}));\n\nconst ModuleJS: React.FC<{ module: ModuleType | void }> = ({ module }) => {\n if (module === 'commonjs') {\n return (\n <Icon>\n <CommonJS />\n </Icon>\n );\n } else if (module === 'module') {\n return (\n <Icon>\n <ES6Modules />\n </Icon>\n );\n } else {\n return null;\n }\n};\n\nconst DetailSidebarTitle: React.FC<Props> = ({\n description,\n packageName,\n version,\n isLatest,\n hasTypes,\n moduleTypes,\n time,\n}) => {\n const { t } = useTranslation();\n return (\n <Box className={'detail-info'} display=\"flex\" flexDirection=\"column\" marginBottom=\"8px\">\n <StyledHeading>\n <TitleWrapper>\n <>\n {packageName}\n {hasTypes && (\n <Icon>\n <TypeScript />\n </Icon>\n )}\n {moduleTypes.map((module, index) => (\n <ModuleJS key={index} module={module} />\n ))}\n </>\n </TitleWrapper>\n </StyledHeading>\n {description && <div>{description}</div>}\n <StyledBoxVersion title={formatDate(time)}>\n {isLatest\n ? t('sidebar.detail.latest-version', { version })\n : t('sidebar.detail.version', { version })}\n {time\n ? ' - ' + t('sidebar.detail.published') + ' ' + formatDateDistance(time)\n : t('versions.not-available')}\n </StyledBoxVersion>\n </Box>\n );\n};\n\nexport default DetailSidebarTitle;\n\nconst TitleWrapper = styled.div({\n display: 'flex',\n alignItems: 'center',\n});\n\nconst StyledHeading = styled(Heading)({\n fontSize: '1rem',\n fontWeight: 700,\n});\n\nconst StyledBoxVersion = styled(Box)<{ theme?: Theme }>(({ theme }) => ({\n color: theme.palette.text.secondary,\n fontSize: theme.fontSize.sm,\n}));\n"],"mappings":";;;;;;;;;;;;;AAsBA,IAAM,OAAO,OAAO,KAAwB,EAAE,aAAa,EACzD,YAAY,MAAM,QAAQ,CAAC,EAC7B,EAAE;AAEF,IAAM,YAAqD,EAAE,aAAa;CACxE,IAAI,WAAW,YACb,OACE,oBAAC,MAAD,EAAA,UACE,oBAAC,UAAD,CAAW,CAAA,EACP,CAAA;MAEH,IAAI,WAAW,UACpB,OACE,oBAAC,MAAD,EAAA,UACE,oBAAC,YAAD,CAAa,CAAA,EACT,CAAA;MAGR,OAAO;AAEX;AAEA,IAAM,sBAAuC,EAC3C,aACA,aACA,SACA,UACA,UACA,aACA,WACI;CACJ,MAAM,EAAE,MAAM,eAAe;CAC7B,OACE,qBAAC,KAAD;EAAK,WAAW;EAAe,SAAQ;EAAO,eAAc;EAAS,cAAa;EAAlF,UAAA;GACE,oBAAC,eAAD,EAAA,UACE,oBAAC,cAAD,EAAA,UACE,qBAAA,YAAA,EAAA,UAAA;IACG;IACA,YACC,oBAAC,MAAD,EAAA,UACE,oBAAC,YAAD,CAAa,CAAA,EACT,CAAA;IAEP,YAAY,KAAK,QAAQ,UACxB,oBAAC,UAAD,EAA8B,OAAS,GAAxB,KAAwB,CACxC;GACD,EAAA,CAAA,EACU,CAAA,EACD,CAAA;GACd,eAAe,oBAAC,OAAD,EAAA,UAAM,YAAiB,CAAA;GACvC,qBAAC,kBAAD;IAAkB,OAAO,WAAW,IAAI;
|
|
1
|
+
{"version":3,"file":"SideBarTitle.mjs","names":[],"sources":["../../../src/components/SideBarTitle/SideBarTitle.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport Box from '@mui/material/Box';\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport type { Theme } from '../../Theme';\nimport Heading from '../Heading';\nimport { CommonJS, ES6Modules, TypeScript } from '../Icons';\nimport { formatDate, formatDateDistance } from './utils';\n\nexport type ModuleType = 'commonjs' | 'module';\n\ninterface Props {\n packageName: string;\n description?: string;\n version: string;\n isLatest: boolean;\n hasTypes?: boolean;\n moduleTypes: ModuleType[];\n time: string;\n}\n\nconst Icon = styled.div<{ theme?: Theme }>(({ theme }) => ({\n marginLeft: theme.spacing(1),\n}));\n\nconst ModuleJS: React.FC<{ module: ModuleType | void }> = ({ module }) => {\n if (module === 'commonjs') {\n return (\n <Icon>\n <CommonJS />\n </Icon>\n );\n } else if (module === 'module') {\n return (\n <Icon>\n <ES6Modules />\n </Icon>\n );\n } else {\n return null;\n }\n};\n\nconst DetailSidebarTitle: React.FC<Props> = ({\n description,\n packageName,\n version,\n isLatest,\n hasTypes,\n moduleTypes,\n time,\n}) => {\n const { t } = useTranslation();\n return (\n <Box className={'detail-info'} display=\"flex\" flexDirection=\"column\" marginBottom=\"8px\">\n <StyledHeading>\n <TitleWrapper>\n <>\n {packageName}\n {hasTypes && (\n <Icon>\n <TypeScript />\n </Icon>\n )}\n {moduleTypes.map((module, index) => (\n <ModuleJS key={index} module={module} />\n ))}\n </>\n </TitleWrapper>\n </StyledHeading>\n {description && <div>{description}</div>}\n <StyledBoxVersion title={time ? formatDate(time) : undefined}>\n {isLatest\n ? t('sidebar.detail.latest-version', { version })\n : t('sidebar.detail.version', { version })}\n {time\n ? ' - ' + t('sidebar.detail.published') + ' ' + formatDateDistance(time)\n : t('versions.not-available')}\n </StyledBoxVersion>\n </Box>\n );\n};\n\nexport default DetailSidebarTitle;\n\nconst TitleWrapper = styled.div({\n display: 'flex',\n alignItems: 'center',\n});\n\nconst StyledHeading = styled(Heading)({\n fontSize: '1rem',\n fontWeight: 700,\n});\n\nconst StyledBoxVersion = styled(Box)<{ theme?: Theme }>(({ theme }) => ({\n color: theme.palette.text.secondary,\n fontSize: theme.fontSize.sm,\n}));\n"],"mappings":";;;;;;;;;;;;;AAsBA,IAAM,OAAO,OAAO,KAAwB,EAAE,aAAa,EACzD,YAAY,MAAM,QAAQ,CAAC,EAC7B,EAAE;AAEF,IAAM,YAAqD,EAAE,aAAa;CACxE,IAAI,WAAW,YACb,OACE,oBAAC,MAAD,EAAA,UACE,oBAAC,UAAD,CAAW,CAAA,EACP,CAAA;MAEH,IAAI,WAAW,UACpB,OACE,oBAAC,MAAD,EAAA,UACE,oBAAC,YAAD,CAAa,CAAA,EACT,CAAA;MAGR,OAAO;AAEX;AAEA,IAAM,sBAAuC,EAC3C,aACA,aACA,SACA,UACA,UACA,aACA,WACI;CACJ,MAAM,EAAE,MAAM,eAAe;CAC7B,OACE,qBAAC,KAAD;EAAK,WAAW;EAAe,SAAQ;EAAO,eAAc;EAAS,cAAa;EAAlF,UAAA;GACE,oBAAC,eAAD,EAAA,UACE,oBAAC,cAAD,EAAA,UACE,qBAAA,YAAA,EAAA,UAAA;IACG;IACA,YACC,oBAAC,MAAD,EAAA,UACE,oBAAC,YAAD,CAAa,CAAA,EACT,CAAA;IAEP,YAAY,KAAK,QAAQ,UACxB,oBAAC,UAAD,EAA8B,OAAS,GAAxB,KAAwB,CACxC;GACD,EAAA,CAAA,EACU,CAAA,EACD,CAAA;GACd,eAAe,oBAAC,OAAD,EAAA,UAAM,YAAiB,CAAA;GACvC,qBAAC,kBAAD;IAAkB,OAAO,OAAO,WAAW,IAAI,IAAI,KAAA;IAAnD,UAAA,CACG,WACG,EAAE,iCAAiC,EAAE,QAAQ,CAAC,IAC9C,EAAE,0BAA0B,EAAE,QAAQ,CAAC,GAC1C,OACG,QAAQ,EAAE,0BAA0B,IAAI,MAAM,mBAAmB,IAAI,IACrE,EAAE,wBAAwB,CACd;;EACf;;AAET;AAIA,IAAM,eAAe,OAAO,IAAI;CAC9B,SAAS;CACT,YAAY;AACd,CAAC;AAED,IAAM,gBAAgB,OAAO,OAAO,CAAC,CAAC;CACpC,UAAU;CACV,YAAY;AACd,CAAC;AAED,IAAM,mBAAmB,OAAO,GAAG,CAAC,EAAqB,EAAE,aAAa;CACtE,OAAO,MAAM,QAAQ,KAAK;CAC1B,UAAU,MAAM,SAAS;AAC3B,EAAE"}
|
|
@@ -7,10 +7,10 @@ const require_UplinkLink = require("./UplinkLink.js");
|
|
|
7
7
|
const require_styles = require("./styles.js");
|
|
8
8
|
let react = require("react");
|
|
9
9
|
react = require_runtime.__toESM(react);
|
|
10
|
+
let react_i18next = require("react-i18next");
|
|
10
11
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
12
|
let _mui_material_Box = require("@mui/material/Box");
|
|
12
13
|
_mui_material_Box = require_runtime.__toESM(_mui_material_Box);
|
|
13
|
-
let react_i18next = require("react-i18next");
|
|
14
14
|
let _mui_material_List = require("@mui/material/List");
|
|
15
15
|
_mui_material_List = require_runtime.__toESM(_mui_material_List);
|
|
16
16
|
let _mui_material_ListItem = require("@mui/material/ListItem");
|
|
@@ -5,9 +5,9 @@ import "../NoItems/index.mjs";
|
|
|
5
5
|
import UpLinkLink from "./UplinkLink.mjs";
|
|
6
6
|
import { ListItemText, Spacer, StyledText } from "./styles.mjs";
|
|
7
7
|
import "react";
|
|
8
|
+
import { useTranslation } from "react-i18next";
|
|
8
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
10
|
import Box from "@mui/material/Box";
|
|
10
|
-
import { useTranslation } from "react-i18next";
|
|
11
11
|
import List from "@mui/material/List";
|
|
12
12
|
import ListItem from "@mui/material/ListItem";
|
|
13
13
|
import Card from "@mui/material/Card";
|
|
@@ -9,8 +9,8 @@ require("../Link/index.js");
|
|
|
9
9
|
const require_styles = require("./styles.js");
|
|
10
10
|
let react = require("react");
|
|
11
11
|
react = require_runtime.__toESM(react);
|
|
12
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
13
12
|
let react_i18next = require("react-i18next");
|
|
13
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
14
14
|
let _mui_material_List = require("@mui/material/List");
|
|
15
15
|
_mui_material_List = require_runtime.__toESM(_mui_material_List);
|
|
16
16
|
let _mui_material_ListItem = require("@mui/material/ListItem");
|
|
@@ -60,7 +60,7 @@ var VersionsHistoryList = ({ versions, packageName, time }) => {
|
|
|
60
60
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_styles.ListItemText, {
|
|
61
61
|
"data-testid": `version-list-text`,
|
|
62
62
|
primary: time[version] ? require_utils.formatDateDistance(time[version]) : t("versions.not-available"),
|
|
63
|
-
slotProps: { primary: { title: require_utils.formatDate(time[version]) } }
|
|
63
|
+
slotProps: { primary: { title: time[version] ? require_utils.formatDate(time[version]) : void 0 } }
|
|
64
64
|
})
|
|
65
65
|
]
|
|
66
66
|
}, version))
|