@verdaccio/ui-theme 6.0.0-6-next.12 → 6.0.0-6-next.13

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.
Files changed (246) hide show
  1. package/.babelrc +1 -1
  2. package/.eslintrc +0 -15
  3. package/CHANGELOG.md +6 -0
  4. package/jest/setup-env.ts +4 -1
  5. package/jest/unit/components/__mocks__/token.ts +0 -1
  6. package/jest/unit/components/store/login.ts +1 -0
  7. package/package.json +34 -37
  8. package/src/App/App.test.tsx +4 -6
  9. package/src/App/App.tsx +3 -5
  10. package/src/App/AppRoute.tsx +1 -1
  11. package/src/App/Footer/Footer.test.tsx +0 -1
  12. package/src/App/Footer/Footer.tsx +3 -3
  13. package/src/App/Footer/__snapshots__/Footer.test.tsx.snap +25 -9
  14. package/src/App/Footer/styles.ts +2 -3
  15. package/src/App/Header/Header.test.tsx +3 -5
  16. package/src/App/Header/Header.tsx +3 -5
  17. package/src/App/Header/HeaderGreetings.tsx +0 -1
  18. package/src/App/Header/HeaderLeft.tsx +0 -1
  19. package/src/App/Header/HeaderMenu.tsx +3 -3
  20. package/src/App/Header/HeaderRight.tsx +1 -2
  21. package/src/App/Header/HeaderToolTip.tsx +0 -1
  22. package/src/App/Header/HeaderToolTipIcon.tsx +10 -10
  23. package/src/App/Header/LanguageSwitch.tsx +4 -5
  24. package/src/App/Header/LoginDialog/LoginDialog.test.tsx +4 -7
  25. package/src/App/Header/LoginDialog/LoginDialog.tsx +2 -4
  26. package/src/App/Header/LoginDialog/LoginDialogCloseButton.tsx +1 -2
  27. package/src/App/Header/LoginDialog/LoginDialogForm.tsx +0 -1
  28. package/src/App/Header/LoginDialog/LoginDialogFormError.tsx +1 -2
  29. package/src/App/Header/LoginDialog/LoginDialogHeader.tsx +4 -4
  30. package/src/App/Header/RegistryInfoContent/RegistryInfoContent.test.tsx +1 -2
  31. package/src/App/Header/RegistryInfoContent/RegistryInfoContent.tsx +9 -10
  32. package/src/App/Header/RegistryInfoDialog/RegistryInfoDialog.tsx +1 -2
  33. package/src/App/Header/RegistryInfoDialog/styles.ts +0 -1
  34. package/src/App/Header/Search/Search.test.tsx +32 -41
  35. package/src/App/Header/Search/Search.tsx +15 -58
  36. package/src/App/Header/Search/__snapshots__/Search.test.tsx.snap +392 -28
  37. package/src/App/Header/styles.ts +2 -3
  38. package/src/App/utils/loadable.tsx +2 -1
  39. package/src/components/ActionBar/ActionBar.test.tsx +5 -13
  40. package/src/components/ActionBar/ActionBar.tsx +0 -2
  41. package/src/components/ActionBar/ActionBarAction.tsx +6 -7
  42. package/src/components/ActionBar/__snapshots__/ActionBar.test.tsx.snap +198 -53
  43. package/src/components/AppBar.tsx +1 -1
  44. package/src/components/Author/Author.test.tsx +1 -3
  45. package/src/components/Author/Author.tsx +2 -4
  46. package/src/components/Author/__snapshots__/Author.test.tsx.snap +804 -48
  47. package/src/components/Author/styles.ts +0 -1
  48. package/src/components/AutoComplete/AutoComplete.tsx +85 -163
  49. package/src/components/AutoComplete/AutoCompleteV2.tsx +7 -9
  50. package/src/components/AutoComplete/styles.tsx +0 -15
  51. package/src/components/Avatar.tsx +1 -1
  52. package/src/components/Box.tsx +1 -1
  53. package/src/components/Button.tsx +1 -1
  54. package/src/components/Card.tsx +1 -1
  55. package/src/components/CardActions.tsx +1 -1
  56. package/src/components/CardContent.tsx +1 -1
  57. package/src/components/Chip.tsx +1 -1
  58. package/src/components/CircularProgress.tsx +2 -2
  59. package/src/components/CopyToClipBoard.tsx +2 -3
  60. package/src/components/Dialog.tsx +1 -1
  61. package/src/components/DialogActions.tsx +2 -2
  62. package/src/components/DialogContent.tsx +2 -2
  63. package/src/components/DialogTitle.tsx +1 -1
  64. package/src/components/Divider.tsx +1 -1
  65. package/src/components/FloatingActionButton.tsx +1 -1
  66. package/src/components/FormControl.tsx +1 -1
  67. package/src/components/FormHelperText.tsx +2 -2
  68. package/src/components/Grid.tsx +1 -1
  69. package/src/components/Heading.tsx +1 -1
  70. package/src/components/IconButton.tsx +1 -1
  71. package/src/components/Input.tsx +1 -1
  72. package/src/components/InputAdornment/InputAdornment.tsx +2 -2
  73. package/src/components/InputLabel.tsx +1 -1
  74. package/src/components/Label/Label.test.tsx +0 -1
  75. package/src/components/Label/Label.tsx +1 -2
  76. package/src/components/List.tsx +1 -1
  77. package/src/components/ListItem.tsx +1 -1
  78. package/src/components/ListItemText.tsx +1 -4
  79. package/src/components/Loading/Loading.test.tsx +0 -1
  80. package/src/components/Loading/Loading.tsx +1 -2
  81. package/src/components/Loading/Spinner/Spinner.test.tsx +1 -2
  82. package/src/components/Loading/Spinner/Spinner.tsx +1 -2
  83. package/src/components/Loading/Spinner/__snapshots__/Spinner.test.tsx.snap +114 -16
  84. package/src/components/Loading/__snapshots__/Loading.test.tsx.snap +63 -11
  85. package/src/components/Loading/styles.ts +1 -2
  86. package/src/components/Logo/Logo.test.tsx +0 -1
  87. package/src/components/Logo/Logo.tsx +1 -2
  88. package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +2 -0
  89. package/src/components/Menu.tsx +1 -1
  90. package/src/components/MenuItem.tsx +1 -1
  91. package/src/components/NotFound/NotFound.tsx +1 -3
  92. package/src/components/NotFound/Notfound.test.tsx +1 -2
  93. package/src/components/NotFound/__snapshots__/Notfound.test.tsx.snap +138 -11
  94. package/src/components/NotFound/styles.ts +0 -1
  95. package/src/components/Paper.tsx +1 -1
  96. package/src/components/SnackbarContent.tsx +1 -1
  97. package/src/components/SvgIcon.tsx +1 -1
  98. package/src/components/Tab.tsx +1 -1
  99. package/src/components/Tabs.tsx +1 -1
  100. package/src/components/Text/Text.tsx +1 -1
  101. package/src/components/Text/TextConfig.ts +1 -1
  102. package/src/components/TextField/TextField.test.tsx +0 -1
  103. package/src/components/TextField/TextField.tsx +2 -2
  104. package/src/components/TextField/__snapshots__/TextField.test.tsx.snap +216 -3
  105. package/src/components/Toolbar.tsx +1 -1
  106. package/src/components/Tooltip.tsx +1 -1
  107. package/src/design-tokens/ResetStyles.tsx +1 -1
  108. package/src/design-tokens/StyleBaseline.tsx +2 -2
  109. package/src/design-tokens/ThemeProvider.tsx +15 -12
  110. package/src/design-tokens/theme.ts +28 -26
  111. package/src/design-tokens/useTheme.ts +1 -1
  112. package/src/{design-tokens → hooks}/useLocalStorage.ts +0 -0
  113. package/src/{design-tokens → hooks}/useOnClickOutside.ts +0 -0
  114. package/src/i18n/__mocks__/loadTranslationFile.ts +5 -0
  115. package/src/i18n/config.ts +1 -15
  116. package/src/i18n/download_translations/es-ES/ui.json +17 -17
  117. package/src/i18n/download_translations/it-IT/ui.json +77 -77
  118. package/src/i18n/download_translations/tr-TR/ui.json +6 -6
  119. package/src/i18n/download_translations/vi-VN/ui.json +2 -2
  120. package/src/i18n/loadTranslationFile.ts +14 -0
  121. package/src/index.tsx +2 -1
  122. package/src/pages/Version/DetailContainer/Dependencies/Dependencies.test.tsx +0 -2
  123. package/src/pages/Version/DetailContainer/Dependencies/Dependencies.tsx +1 -3
  124. package/src/pages/Version/DetailContainer/Dependencies/styles.ts +0 -1
  125. package/src/pages/Version/DetailContainer/Deprecated/Deprecated.test.tsx +1 -3
  126. package/src/pages/Version/DetailContainer/Deprecated/Deprecated.tsx +2 -3
  127. package/src/pages/Version/DetailContainer/DetailContainer.test.tsx +0 -1
  128. package/src/pages/Version/DetailContainer/DetailContainer.tsx +1 -3
  129. package/src/pages/Version/DetailContainer/DetailContainerContent.tsx +0 -1
  130. package/src/pages/Version/DetailContainer/DetailContainerContentReadme.tsx +0 -1
  131. package/src/pages/Version/DetailContainer/DetailContainerTabs.tsx +0 -1
  132. package/src/pages/Version/DetailContainer/NoItems/NoItems.tsx +0 -1
  133. package/src/pages/Version/DetailContainer/NoItems/Noitems.test.tsx +0 -1
  134. package/src/pages/Version/DetailContainer/NoItems/__snapshots__/Noitems.test.tsx.snap +10 -1
  135. package/src/pages/Version/DetailContainer/Readme/Readme.spec.tsx +1 -2
  136. package/src/pages/Version/DetailContainer/Readme/Readme.tsx +1 -2
  137. package/src/pages/Version/DetailContainer/UpLinks/UpLinks.test.tsx +1 -3
  138. package/src/pages/Version/DetailContainer/UpLinks/UpLinks.tsx +1 -3
  139. package/src/pages/Version/DetailContainer/UpLinks/__snapshots__/UpLinks.test.tsx.snap +184 -26
  140. package/src/pages/Version/DetailContainer/UpLinks/styles.ts +2 -3
  141. package/src/pages/Version/DetailContainer/Versions/Versions.test.tsx +2 -4
  142. package/src/pages/Version/DetailContainer/Versions/Versions.tsx +1 -2
  143. package/src/pages/Version/DetailContainer/Versions/VersionsHistoryList.tsx +2 -4
  144. package/src/pages/Version/DetailContainer/Versions/VersionsTagList.tsx +1 -3
  145. package/src/pages/Version/DetailContainer/Versions/styles.ts +2 -3
  146. package/src/pages/Version/DetailContainer/__snapshots__/DetailContainer.test.tsx.snap +168 -34
  147. package/src/pages/Version/DetailSidebar/DetailSidebar.tsx +0 -2
  148. package/src/pages/Version/DetailSidebar/DetailSidebarFundButton.test.tsx +0 -2
  149. package/src/pages/Version/DetailSidebar/DetailSidebarFundButton.tsx +1 -2
  150. package/src/pages/Version/DetailSidebar/DetailSidebarTitle.tsx +0 -1
  151. package/src/pages/Version/DetailSidebar/Developers/Developers.test.tsx +3 -5
  152. package/src/pages/Version/DetailSidebar/Developers/Developers.tsx +3 -5
  153. package/src/pages/Version/DetailSidebar/Developers/DevelopersTitle.tsx +0 -1
  154. package/src/pages/Version/DetailSidebar/Developers/__snapshots__/Developers.test.tsx.snap +328 -40
  155. package/src/pages/Version/DetailSidebar/Developers/styles.ts +0 -1
  156. package/src/pages/Version/DetailSidebar/Dist/Dist.test.tsx +1 -3
  157. package/src/pages/Version/DetailSidebar/Dist/Dist.tsx +1 -3
  158. package/src/pages/Version/DetailSidebar/Dist/__snapshots__/Dist.test.tsx.snap +1436 -74
  159. package/src/pages/Version/DetailSidebar/Dist/styles.ts +2 -1
  160. package/src/pages/Version/DetailSidebar/Engines/Engines.test.tsx +1 -3
  161. package/src/pages/Version/DetailSidebar/Engines/Engines.tsx +1 -3
  162. package/src/pages/Version/DetailSidebar/Engines/styles.ts +0 -1
  163. package/src/pages/Version/DetailSidebar/Install/Install.test.tsx +1 -3
  164. package/src/pages/Version/DetailSidebar/Install/Install.tsx +0 -2
  165. package/src/pages/Version/DetailSidebar/Install/InstallListItem.tsx +0 -1
  166. package/src/pages/Version/DetailSidebar/Repository/Repository.test.tsx +1 -3
  167. package/src/pages/Version/DetailSidebar/Repository/Repository.tsx +1 -3
  168. package/src/pages/Version/Version.test.tsx +1 -3
  169. package/src/pages/Version/Version.tsx +1 -3
  170. package/src/pages/Version/VersionContextProvider.tsx +0 -1
  171. package/src/pages/Version/VersionLayout.tsx +1 -1
  172. package/src/pages/Version/context.ts +1 -1
  173. package/src/pages/home/Home.tsx +0 -2
  174. package/src/pages/home/PackageList/Help/Help.test.tsx +0 -1
  175. package/src/pages/home/PackageList/Help/Help.tsx +0 -1
  176. package/src/pages/home/PackageList/Help/__snapshots__/Help.test.tsx.snap +295 -56
  177. package/src/pages/home/PackageList/Help/styles.ts +0 -1
  178. package/src/pages/home/PackageList/Package/Package.test.tsx +1 -3
  179. package/src/pages/home/PackageList/Package/Package.tsx +14 -19
  180. package/src/pages/home/PackageList/Package/Tag/Tag.test.tsx +0 -1
  181. package/src/pages/home/PackageList/Package/styles.ts +5 -6
  182. package/src/pages/home/PackageList/PackageList.tsx +0 -1
  183. package/src/pages/home/PackageList/Packagelist.test.tsx +1 -3
  184. package/src/providers/API/api.ts +1 -1
  185. package/src/providers/config/AppConfigurationProvider.tsx +3 -3
  186. package/src/store/models/configuration.ts +2 -3
  187. package/src/store/models/download.ts +1 -2
  188. package/src/store/models/index.ts +1 -0
  189. package/src/store/models/login.ts +4 -2
  190. package/src/store/models/manifest.ts +2 -2
  191. package/src/store/models/packages.ts +2 -2
  192. package/src/store/models/search.ts +5 -5
  193. package/src/store/store.ts +2 -2
  194. package/src/utils/login.test.ts +2 -3
  195. package/src/utils/package.test.ts +2 -3
  196. package/src/utils/package.ts +2 -1
  197. package/src/utils/sec-utils.ts +1 -1
  198. package/src/utils/test-react-testing-library.tsx +11 -7
  199. package/src/utils/url.test.ts +1 -1
  200. package/src/utils/url.ts +1 -0
  201. package/static/Dependencies.15768a14646212b71166.js +2 -0
  202. package/static/Dependencies.15768a14646212b71166.js.LICENSE.txt +78 -0
  203. package/static/Dist.15768a14646212b71166.js +2 -0
  204. package/static/Dist.15768a14646212b71166.js.LICENSE.txt +60 -0
  205. package/static/Engines.15768a14646212b71166.js +2 -0
  206. package/static/Engines.15768a14646212b71166.js.LICENSE.txt +66 -0
  207. package/static/Home.15768a14646212b71166.js +2 -0
  208. package/static/Home.15768a14646212b71166.js.LICENSE.txt +222 -0
  209. package/static/Install.15768a14646212b71166.js +2 -0
  210. package/static/Install.15768a14646212b71166.js.LICENSE.txt +66 -0
  211. package/static/NotFound.15768a14646212b71166.js +2 -0
  212. package/static/NotFound.15768a14646212b71166.js.LICENSE.txt +40 -0
  213. package/static/Provider.15768a14646212b71166.js +2 -0
  214. package/static/Provider.15768a14646212b71166.js.LICENSE.txt +32 -0
  215. package/static/Repository.15768a14646212b71166.js +2 -0
  216. package/static/Repository.15768a14646212b71166.js.LICENSE.txt +50 -0
  217. package/static/UpLinks.15768a14646212b71166.js +2 -0
  218. package/static/UpLinks.15768a14646212b71166.js.LICENSE.txt +56 -0
  219. package/static/Version.15768a14646212b71166.js +2 -0
  220. package/static/Version.15768a14646212b71166.js.LICENSE.txt +380 -0
  221. package/static/Versions.15768a14646212b71166.js +2 -0
  222. package/static/Versions.15768a14646212b71166.js.LICENSE.txt +64 -0
  223. package/static/index.html +1 -1
  224. package/static/main.15768a14646212b71166.js +2 -0
  225. package/static/{main.87dd0a7ff6e306a24166.js.LICENSE.txt → main.15768a14646212b71166.js.LICENSE.txt} +63 -663
  226. package/static/manifest.json +17 -3
  227. package/static/runtime.15768a14646212b71166.js +2 -0
  228. package/static/{runtime.87dd0a7ff6e306a24166.js.LICENSE.txt → runtime.15768a14646212b71166.js.LICENSE.txt} +2 -2
  229. package/static/vendors-node_modules_pnpm_mui_icons-material_5_0_5_d1eeebd4022867ee03864a00e16c7901_node_modu-123400.15768a14646212b71166.js +2 -0
  230. package/static/vendors-node_modules_pnpm_mui_icons-material_5_0_5_d1eeebd4022867ee03864a00e16c7901_node_modu-123400.15768a14646212b71166.js.LICENSE.txt +148 -0
  231. package/static/vendors-node_modules_pnpm_mui_icons-material_5_0_5_d1eeebd4022867ee03864a00e16c7901_node_modu-d2b578.15768a14646212b71166.js +2 -0
  232. package/static/vendors-node_modules_pnpm_mui_icons-material_5_0_5_d1eeebd4022867ee03864a00e16c7901_node_modu-d2b578.15768a14646212b71166.js.LICENSE.txt +218 -0
  233. package/static/vendors-node_modules_pnpm_mui_material_5_0_6_033766d34292bd5d464212fd95cb4b6d_node_modules_mu-1fb115.15768a14646212b71166.js +2 -0
  234. package/static/vendors-node_modules_pnpm_mui_material_5_0_6_033766d34292bd5d464212fd95cb4b6d_node_modules_mu-1fb115.15768a14646212b71166.js.LICENSE.txt +316 -0
  235. package/static/vendors.15768a14646212b71166.js +103 -0
  236. package/static/{vendors.87dd0a7ff6e306a24166.js.LICENSE.txt → vendors.15768a14646212b71166.js.LICENSE.txt} +1261 -1035
  237. package/tools/dev.server.js +0 -1
  238. package/tools/webpack.dev.config.babel.js +1 -3
  239. package/tsconfig.json +0 -2
  240. package/types/index.ts +1 -0
  241. package/src/App/Header/Search/SearchAdornment.tsx +0 -18
  242. package/src/design-tokens/emotion.ts +0 -5
  243. package/src/lib/constants.ts +0 -9
  244. package/static/main.87dd0a7ff6e306a24166.js +0 -2
  245. package/static/runtime.87dd0a7ff6e306a24166.js +0 -2
  246. package/static/vendors.87dd0a7ff6e306a24166.js +0 -2
@@ -1,14 +1,12 @@
1
1
  import i18next from 'i18next';
2
2
  import isEmpty from 'lodash/isEmpty';
3
- import React, { useEffect, useCallback } from 'react';
3
+ import React, { useCallback, useEffect } from 'react';
4
4
  import { useDispatch, useSelector } from 'react-redux';
5
-
6
5
  import Dialog from 'verdaccio-ui/components/Dialog';
7
6
  import DialogContent from 'verdaccio-ui/components/DialogContent';
8
7
 
9
8
  import { LoginBody } from '../../../store/models/login';
10
9
  import { Dispatch, RootState } from '../../../store/store';
11
-
12
10
  import LoginDialogCloseButton from './LoginDialogCloseButton';
13
11
  import LoginDialogForm, { FormValues } from './LoginDialogForm';
14
12
  import LoginDialogHeader from './LoginDialogHeader';
@@ -70,7 +68,7 @@ const LoginDialog: React.FC<Props> = ({ onClose, open = false }) => {
70
68
  onClose={onClose}
71
69
  open={open}>
72
70
  <LoginDialogCloseButton onClose={onClose} />
73
- <DialogContent>
71
+ <DialogContent data-testid="dialogContentLogin">
74
72
  <LoginDialogHeader />
75
73
  <LoginDialogForm error={loginStore.error} onSubmit={handleDoLogin} />
76
74
  </DialogContent>
@@ -1,8 +1,7 @@
1
1
  import styled from '@emotion/styled';
2
- import CloseIcon from '@material-ui/icons/Close';
2
+ import CloseIcon from '@mui/icons-material/Close';
3
3
  import React from 'react';
4
4
  import { useTranslation } from 'react-i18next';
5
-
6
5
  import DialogTitle from 'verdaccio-ui/components/DialogTitle';
7
6
  import IconButton from 'verdaccio-ui/components/IconButton';
8
7
  import { Theme } from 'verdaccio-ui/design-tokens/theme';
@@ -3,7 +3,6 @@ import styled from '@emotion/styled';
3
3
  import React, { memo } from 'react';
4
4
  import { useForm } from 'react-hook-form';
5
5
  import { useTranslation } from 'react-i18next';
6
-
7
6
  import Button from 'verdaccio-ui/components/Button';
8
7
  import TextField from 'verdaccio-ui/components/TextField';
9
8
  import { Theme } from 'verdaccio-ui/design-tokens/theme';
@@ -1,7 +1,6 @@
1
1
  import styled from '@emotion/styled';
2
- import Error from '@material-ui/icons/Error';
2
+ import Error from '@mui/icons-material/Error';
3
3
  import React, { memo } from 'react';
4
-
5
4
  import Box from 'verdaccio-ui/components/Box';
6
5
  import SnackbarContent from 'verdaccio-ui/components/SnackbarContent';
7
6
  import { Theme } from 'verdaccio-ui/design-tokens/theme';
@@ -1,14 +1,14 @@
1
1
  import styled from '@emotion/styled';
2
- import CloseIcon from '@material-ui/icons/Close';
3
- import LockOutlined from '@material-ui/icons/LockOutlined';
2
+ import CloseIcon from '@mui/icons-material/Close';
3
+ import LockOutlined from '@mui/icons-material/LockOutlined';
4
4
  import React from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
-
7
6
  import Avatar from 'verdaccio-ui/components/Avatar';
8
7
  import Box from 'verdaccio-ui/components/Box';
9
8
  import Heading from 'verdaccio-ui/components/Heading';
10
9
  import IconButton from 'verdaccio-ui/components/IconButton';
11
10
  import { Theme } from 'verdaccio-ui/design-tokens/theme';
11
+
12
12
  interface Props {
13
13
  onClose?: () => void;
14
14
  }
@@ -36,7 +36,7 @@ export default LoginDialogHeader;
36
36
  const StyledAvatar = styled(Avatar)<{ theme?: Theme }>(({ theme }) => ({
37
37
  margin: theme?.spacing(1),
38
38
  backgroundColor:
39
- theme?.palette.type === 'light' ? theme?.palette.primary.main : theme?.palette.cyanBlue,
39
+ theme?.palette.mode === 'light' ? theme?.palette.primary.main : theme?.palette.cyanBlue,
40
40
  color: theme?.palette.white,
41
41
  }));
42
42
 
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
-
3
- import { screen, render, cleanup } from 'verdaccio-ui/utils/test-react-testing-library';
2
+ import { cleanup, render, screen } from 'verdaccio-ui/utils/test-react-testing-library';
4
3
 
5
4
  import RegistryInfoContent from './RegistryInfoContent';
6
5
 
@@ -1,21 +1,20 @@
1
1
  import styled from '@emotion/styled';
2
- import Accordion from '@material-ui/core/Accordion';
3
- import AccordionDetails from '@material-ui/core/AccordionDetails';
4
- import AccordionSummary from '@material-ui/core/AccordionSummary';
5
- import Box from '@material-ui/core/Box';
6
- import Link from '@material-ui/core/Link';
7
- import { makeStyles } from '@material-ui/core/styles';
8
- import Typography from '@material-ui/core/Typography';
9
- import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
2
+ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
3
+ import Accordion from '@mui/material/Accordion';
4
+ import AccordionDetails from '@mui/material/AccordionDetails';
5
+ import AccordionSummary from '@mui/material/AccordionSummary';
6
+ import Box from '@mui/material/Box';
7
+ import Link from '@mui/material/Link';
8
+ import Typography from '@mui/material/Typography';
9
+ import makeStyles from '@mui/styles/makeStyles';
10
10
  import React, { FC } from 'react';
11
11
  import { useTranslation } from 'react-i18next';
12
-
13
12
  import CopyToClipBoard from 'verdaccio-ui/components/CopyToClipBoard';
14
13
  import { useConfig } from 'verdaccio-ui/providers/config';
15
14
  import {
16
- getCLISetRegistry,
17
15
  getCLIChangePassword,
18
16
  getCLISetConfigRegistry,
17
+ getCLISetRegistry,
19
18
  } from 'verdaccio-ui/utils/cli-utils';
20
19
  import { NODE_MANAGER } from 'verdaccio-ui/utils/constants';
21
20
 
@@ -1,11 +1,10 @@
1
1
  import React from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
-
4
3
  import Button from 'verdaccio-ui/components/Button';
5
4
  import Dialog from 'verdaccio-ui/components/Dialog';
6
5
  import DialogActions from 'verdaccio-ui/components/DialogActions';
7
6
 
8
- import { Title, Content } from './styles';
7
+ import { Content, Title } from './styles';
9
8
  import { Props } from './types';
10
9
 
11
10
  const RegistryInfoDialog: React.FC<Props> = ({ open = false, children, onClose }) => {
@@ -1,5 +1,4 @@
1
1
  import styled from '@emotion/styled';
2
-
3
2
  import DialogContent from 'verdaccio-ui/components/DialogContent';
4
3
  import DialogTitle from 'verdaccio-ui/components/DialogTitle';
5
4
  import { Theme } from 'verdaccio-ui/design-tokens/theme';
@@ -1,10 +1,15 @@
1
1
  import React from 'react';
2
2
  import { BrowserRouter as Router } from 'react-router-dom';
3
-
4
3
  import api from 'verdaccio-ui/providers/API/api';
5
- import { renderWithStore, fireEvent, waitFor } from 'verdaccio-ui/utils/test-react-testing-library';
4
+ import {
5
+ fireEvent,
6
+ renderWithStore,
7
+ screen,
8
+ waitFor,
9
+ } from 'verdaccio-ui/utils/test-react-testing-library';
6
10
 
7
11
  import { store } from '../../../store/store';
12
+ import Search from './Search';
8
13
 
9
14
  jest.mock('lodash/debounce', () =>
10
15
  jest.fn((fn) => {
@@ -13,8 +18,6 @@ jest.mock('lodash/debounce', () =>
13
18
  })
14
19
  );
15
20
 
16
- import Search from './Search';
17
-
18
21
  /* eslint-disable verdaccio/jsx-spread */
19
22
  const ComponentToBeRendered: React.FC = () => (
20
23
  <Router>
@@ -62,12 +65,12 @@ describe('<Search /> component', () => {
62
65
 
63
66
  const suggestionsElements = await waitFor(() => getAllByText('verdaccio', { exact: true }));
64
67
 
65
- expect(suggestionsElements).toHaveLength(2);
68
+ expect(suggestionsElements).toHaveLength(1);
66
69
  expect(api.request).toHaveBeenCalledTimes(1);
67
70
  });
68
71
 
69
72
  test('onBlur: should cancel all search requests', async () => {
70
- const { getByPlaceholderText, getByRole, getAllByText } = renderWithStore(
73
+ const { getByPlaceholderText, getAllByText } = renderWithStore(
71
74
  <ComponentToBeRendered />,
72
75
  store
73
76
  );
@@ -79,53 +82,41 @@ describe('<Search /> component', () => {
79
82
  expect(autoCompleteInput).toHaveAttribute('value', 'verdaccio');
80
83
 
81
84
  const suggestionsElements = await waitFor(() => getAllByText('verdaccio', { exact: true }));
82
- expect(suggestionsElements).toHaveLength(2);
85
+ expect(suggestionsElements).toHaveLength(1);
83
86
  expect(api.request).toHaveBeenCalledTimes(1);
84
87
 
85
88
  fireEvent.blur(autoCompleteInput);
86
- const listBoxElement = await waitFor(() => getByRole('listbox'));
87
- expect(listBoxElement).toBeEmptyDOMElement();
89
+ const listBoxElement = screen.queryAllByRole('listbox');
90
+ expect(listBoxElement).toHaveLength(0);
88
91
  });
89
92
 
90
93
  test('handleSearch: cancel all search requests when there is no value in search component with type method', async () => {
91
- const { getByPlaceholderText, getByRole } = renderWithStore(<ComponentToBeRendered />, store);
94
+ const { getByPlaceholderText } = renderWithStore(<ComponentToBeRendered />, store);
92
95
 
93
96
  const autoCompleteInput = getByPlaceholderText('Search Packages');
94
97
  fireEvent.focus(autoCompleteInput);
95
98
  fireEvent.change(autoCompleteInput, { target: { value: ' ', method: 'type' } });
96
- expect(autoCompleteInput).toHaveAttribute('value', '');
97
- const listBoxElement = await waitFor(() => getByRole('listbox'));
98
- expect(listBoxElement.innerHTML).toEqual('');
99
+ expect(autoCompleteInput).toHaveAttribute('value', ' ');
100
+ const listBoxElement = screen.queryAllByRole('listbox');
101
+ expect(listBoxElement).toHaveLength(0);
99
102
  expect(api.request).toHaveBeenCalledTimes(0);
100
103
  });
101
104
 
102
105
  test('handleSearch: when method is not type method', async () => {
103
- const { getByPlaceholderText, getByRole } = renderWithStore(<ComponentToBeRendered />, store);
106
+ const { getByPlaceholderText } = renderWithStore(<ComponentToBeRendered />, store);
104
107
 
105
108
  const autoCompleteInput = getByPlaceholderText('Search Packages');
106
109
 
107
110
  fireEvent.focus(autoCompleteInput);
108
111
  fireEvent.change(autoCompleteInput, { target: { value: ' ', method: 'click' } });
109
- expect(autoCompleteInput).toHaveAttribute('value', '');
110
- const listBoxElement = await waitFor(() => getByRole('listbox'));
111
- expect(listBoxElement.innerHTML).toEqual('');
112
+ expect(autoCompleteInput).toHaveAttribute('value', ' ');
113
+ const listBoxElement = screen.queryAllByRole('listbox');
114
+ expect(listBoxElement).toHaveLength(0);
112
115
  expect(api.request).toHaveBeenCalledTimes(0);
113
116
  });
114
117
 
115
- test('handleSearch: loading is been displayed', async () => {
116
- const { getByPlaceholderText, getByText } = renderWithStore(<ComponentToBeRendered />, store);
117
- const autoCompleteInput = getByPlaceholderText('Search Packages');
118
-
119
- fireEvent.focus(autoCompleteInput);
120
- fireEvent.change(autoCompleteInput, { target: { value: 'verdaccio' } });
121
- expect(autoCompleteInput).toHaveAttribute('value', 'verdaccio');
122
-
123
- const loadingElement = await waitFor(() => getByText('Loading...'));
124
- expect(loadingElement).toBeTruthy();
125
- });
126
-
127
118
  test('handlePackagesClearRequested: should clear suggestions', async () => {
128
- const { getByPlaceholderText, getAllByText, getByRole } = renderWithStore(
119
+ const { getByPlaceholderText, getAllByText } = renderWithStore(
129
120
  <ComponentToBeRendered />,
130
121
  store
131
122
  );
@@ -136,17 +127,17 @@ describe('<Search /> component', () => {
136
127
  expect(autoCompleteInput).toHaveAttribute('value', 'verdaccio');
137
128
 
138
129
  const suggestionsElements = await waitFor(() => getAllByText('verdaccio', { exact: true }));
139
- expect(suggestionsElements).toHaveLength(2);
130
+ expect(suggestionsElements).toHaveLength(1);
140
131
 
141
132
  fireEvent.change(autoCompleteInput, { target: { value: ' ' } });
142
- const listBoxElement = await waitFor(() => getByRole('listbox'));
143
- expect(listBoxElement.innerHTML).toEqual('');
144
-
133
+ const listBoxElement = screen.queryAllByRole('listbox');
134
+ // // when the page redirects, the list box should be empty again
135
+ expect(listBoxElement).toHaveLength(0);
145
136
  expect(api.request).toHaveBeenCalledTimes(1);
146
137
  });
147
138
 
148
139
  test('handleClickSearch: should change the window location on click or return key', async () => {
149
- const { getByPlaceholderText, getAllByText, getByRole } = renderWithStore(
140
+ const { getByPlaceholderText, getAllByText } = renderWithStore(
150
141
  <ComponentToBeRendered />,
151
142
  store
152
143
  );
@@ -157,12 +148,12 @@ describe('<Search /> component', () => {
157
148
  expect(autoCompleteInput).toHaveAttribute('value', 'verdaccio');
158
149
 
159
150
  const suggestionsElements = await waitFor(() => getAllByText('verdaccio', { exact: true }));
160
- expect(suggestionsElements).toHaveLength(2);
161
-
151
+ // console.log('suggestionsElements', suggestionsElements);
152
+ expect(suggestionsElements).toHaveLength(1);
162
153
  // click on the second suggestion
163
- fireEvent.click(suggestionsElements[1]);
164
- const listBoxElement = await waitFor(() => getByRole('listbox'));
165
- // when the page redirects, the list box should be empty again
166
- expect(listBoxElement.innerHTML).toEqual('');
154
+ fireEvent.click(suggestionsElements[0]);
155
+ const listBoxElement = screen.queryAllByRole('listbox');
156
+ // // when the page redirects, the list box should be empty again
157
+ expect(listBoxElement).toHaveLength(0);
167
158
  });
168
159
  });
@@ -1,15 +1,13 @@
1
1
  import debounce from 'lodash/debounce';
2
- import React, { useState, FormEvent, useCallback } from 'react';
3
- import { SuggestionSelectedEventData } from 'react-autosuggest';
2
+ import React, { useCallback } from 'react';
4
3
  import { useTranslation } from 'react-i18next';
5
4
  import { useDispatch, useSelector } from 'react-redux';
6
5
  import { RouteComponentProps, withRouter } from 'react-router';
7
-
8
6
  import AutoComplete from 'verdaccio-ui/components/AutoComplete';
9
7
 
10
- import { Dispatch, RootState } from '../../../store/store';
8
+ import { SearchResultWeb } from '@verdaccio/types';
11
9
 
12
- import SearchAdornment from './SearchAdornment';
10
+ import { Dispatch, RootState } from '../../../store/store';
13
11
 
14
12
  const CONSTANTS = {
15
13
  API_DELAY: 300,
@@ -18,10 +16,7 @@ const CONSTANTS = {
18
16
 
19
17
  const Search: React.FC<RouteComponentProps> = ({ history }) => {
20
18
  const { t } = useTranslation();
21
- const [loaded, setLoaded] = useState(false);
22
- const [search, setSearch] = useState('');
23
- // const mountedRef = useRef(true);
24
- const { isError, suggestions } = useSelector((state: RootState) => state.search);
19
+ const { suggestions } = useSelector((state: RootState) => state.search);
25
20
  const isLoading = useSelector((state: RootState) => state?.loading?.models.search);
26
21
  const dispatch = useDispatch<Dispatch>();
27
22
  /**
@@ -29,6 +24,7 @@ const Search: React.FC<RouteComponentProps> = ({ history }) => {
29
24
  */
30
25
  const cancelAllSearchRequests = useCallback(() => {
31
26
  dispatch.search.clearRequestQueue();
27
+ dispatch.search.saveSearch({ suggestions: [] });
32
28
  }, [dispatch]);
33
29
 
34
30
  /**
@@ -36,7 +32,7 @@ const Search: React.FC<RouteComponentProps> = ({ history }) => {
36
32
  * and set the API state parameters to default boolean values.
37
33
  */
38
34
  const handleOnBlur = useCallback(
39
- (event: FormEvent<HTMLInputElement>) => {
35
+ (event: React.SyntheticEvent) => {
40
36
  // stops event bubbling
41
37
  event.stopPropagation();
42
38
  cancelAllSearchRequests();
@@ -44,51 +40,16 @@ const Search: React.FC<RouteComponentProps> = ({ history }) => {
44
40
  [cancelAllSearchRequests]
45
41
  );
46
42
 
47
- /**
48
- * onChange method for the input element.
49
- */
50
- const handleSearch = useCallback(
51
- (event: FormEvent<HTMLInputElement>, { newValue, method }) => {
52
- // stops event bubbling
53
- event.stopPropagation();
54
- if (method === 'type') {
55
- const value = newValue.trim();
56
- setSearch(value);
57
- setLoaded(false);
58
- /**
59
- * A use case where User keeps adding and removing value in input field,
60
- * so we cancel all the existing requests when input is empty.
61
- */
62
- if (value?.length === 0) {
63
- cancelAllSearchRequests();
64
- }
65
- }
66
- },
67
- [cancelAllSearchRequests]
68
- );
69
-
70
- /**
71
- * Cancel all the request from list and make request list empty.
72
- */
73
- const handlePackagesClearRequested = useCallback(() => {
74
- dispatch.search.saveSearch({ suggestions: [] });
75
- }, [dispatch]);
76
-
77
43
  /**
78
44
  * When an user select any package by clicking or pressing return key.
79
45
  */
80
46
  const handleClickSearch = useCallback(
81
- (
82
- event: FormEvent<HTMLInputElement>,
83
- { suggestionValue, method }: SuggestionSelectedEventData<unknown>
84
- ): void | undefined => {
47
+ (event: React.SyntheticEvent, value: SearchResultWeb, reason: string): void => {
85
48
  // stops event bubbling
86
49
  event.stopPropagation();
87
- switch (method) {
88
- case 'click':
89
- case 'enter':
90
- setSearch('');
91
- history.push(`/-/web/detail/${suggestionValue}`);
50
+ switch (reason) {
51
+ case 'selectOption':
52
+ history.push(`/-/web/detail/${value.name}`);
92
53
  break;
93
54
  }
94
55
  },
@@ -101,25 +62,21 @@ const Search: React.FC<RouteComponentProps> = ({ history }) => {
101
62
  */
102
63
  const handleFetchPackages = useCallback(
103
64
  ({ value }: { value: string }) => {
104
- dispatch.search.getSuggestions({ value });
65
+ if (value?.trim() !== '') {
66
+ dispatch.search.getSuggestions({ value });
67
+ }
105
68
  },
106
69
  [dispatch]
107
70
  );
108
71
 
109
72
  return (
110
73
  <AutoComplete
111
- onBlur={handleOnBlur}
112
- onChange={handleSearch}
113
- onCleanSuggestions={handlePackagesClearRequested}
114
- onClick={handleClickSearch}
74
+ onCleanSuggestions={handleOnBlur}
75
+ onSelectItem={handleClickSearch}
115
76
  onSuggestionsFetch={debounce(handleFetchPackages, CONSTANTS.API_DELAY)}
116
77
  placeholder={t('search.packages')}
117
- startAdornment={<SearchAdornment />}
118
78
  suggestions={suggestions}
119
- suggestionsError={isError}
120
- suggestionsLoaded={loaded}
121
79
  suggestionsLoading={isLoading}
122
- value={search}
123
80
  />
124
81
  );
125
82
  };