@verdaccio/ui-components 3.0.0-next.1 → 3.0.0-next.2

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 (97) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/build/components/ActionBar/ActionBar.js +6 -2
  3. package/build/components/ActionBar/ActionBarAction.js +15 -7
  4. package/build/components/Author/Author.js +15 -7
  5. package/build/components/Author/styles.js +7 -23
  6. package/build/components/CopyClipboard/CopyToClipBoard.js +11 -10
  7. package/build/components/Deprecated/Deprecated.js +11 -19
  8. package/build/components/Engines/Engines.js +7 -7
  9. package/build/components/Install/Install.js +7 -4
  10. package/build/components/Install/InstallListItem.js +25 -37
  11. package/build/components/Package/Package.js +14 -6
  12. package/build/components/RawViewer/RawViewer.js +0 -1
  13. package/build/components/Readme/Readme.js +11 -26
  14. package/build/components/Readme/Readme.js.map +1 -1
  15. package/build/components/Readme/ReadmeDark.js +46 -0
  16. package/build/components/Readme/ReadmeLight.js +46 -0
  17. package/build/components/Readme/github-markdown-dark.css +1015 -0
  18. package/build/components/Readme/github-markdown-light.css +1014 -0
  19. package/build/components/SettingsMenu/SettingsMenu.js +16 -3
  20. package/build/components/SideBarTittle/SideBarTittle.js +5 -4
  21. package/build/components/Versions/HistoryList.js +32 -4
  22. package/build/components/Versions/Versions.js +16 -2
  23. package/build/components/Versions/__partials__/data.json +1 -0
  24. package/build/components/Versions/__partials__/deprecated-versions.json +175 -0
  25. package/build/providers/AppConfigurationProvider/AppConfigurationProvider.js +1 -0
  26. package/build/providers/PersistenceSettingProvider/PersistenceSettingProvider.js +2 -1
  27. package/build/src/__mocks__/react-markdown.d.ts +2 -2
  28. package/build/src/components/Author/styles.d.ts +0 -4
  29. package/build/src/components/CopyClipboard/CopyToClipBoard.d.ts +1 -1
  30. package/build/src/components/Deprecated/Deprecated.d.ts +0 -1
  31. package/build/src/components/Heading/Heading.d.ts +1 -1
  32. package/build/src/components/Icons/DevsIcons/CommonJS.d.ts +2 -2
  33. package/build/src/components/Icons/DevsIcons/ES6Module.d.ts +2 -2
  34. package/build/src/components/Icons/DevsIcons/Git.d.ts +2 -2
  35. package/build/src/components/Icons/DevsIcons/NodeJS.d.ts +2 -2
  36. package/build/src/components/Icons/DevsIcons/TypeScript.d.ts +2 -2
  37. package/build/src/components/Icons/Earth.d.ts +2 -2
  38. package/build/src/components/Icons/FileBinary.d.ts +2 -2
  39. package/build/src/components/Icons/Law.d.ts +2 -2
  40. package/build/src/components/Icons/License.d.ts +2 -2
  41. package/build/src/components/Icons/Managers/Npm.d.ts +2 -2
  42. package/build/src/components/Icons/Managers/Pnpm.d.ts +2 -2
  43. package/build/src/components/Icons/Managers/Yarn.d.ts +2 -2
  44. package/build/src/components/Icons/SvgIcon.d.ts +1 -1
  45. package/build/src/components/Icons/Time.d.ts +2 -2
  46. package/build/src/components/Icons/Version.d.ts +2 -2
  47. package/build/src/components/Install/InstallListItem.d.ts +2 -0
  48. package/build/src/components/Link/Link.d.ts +1 -1
  49. package/build/src/components/LoginDialog/LoginDialog.stories.d.ts +2 -2
  50. package/build/src/components/LoginDialog/LoginDialogForm.d.ts +1 -1
  51. package/build/src/components/LoginDialog/LoginDialogFormError.d.ts +1 -1
  52. package/build/src/components/MenuItem/MenuItem.d.ts +1 -1
  53. package/build/src/components/Readme/Readme.d.ts +0 -1
  54. package/build/src/components/Readme/ReadmeDark.d.ts +5 -0
  55. package/build/src/components/Readme/ReadmeLight.d.ts +5 -0
  56. package/build/src/components/Search/AutoComplete/styles.d.ts +1 -1
  57. package/build/src/components/Search/Search.stories.d.ts +2 -2
  58. package/build/src/components/Search/styles.d.ts +1 -1
  59. package/build/src/components/TextField/TextField.d.ts +1 -1
  60. package/build/src/components/Versions/HistoryList.d.ts +1 -0
  61. package/build/src/sections/Footer/Footer.d.ts +2 -2
  62. package/build/src/sections/Header/LanguageSwitch.d.ts +2 -2
  63. package/build/src/sections/Header/styles.d.ts +1 -1
  64. package/build/src/types/packageMeta.d.ts +1 -0
  65. package/build/src/utils/loadable.d.ts +2 -2
  66. package/build/store/models/download.js +0 -1
  67. package/package.json +13 -11
  68. package/src/components/ActionBar/ActionBar.stories.tsx +1 -1
  69. package/src/components/ActionBar/ActionBar.test.tsx +17 -10
  70. package/src/components/ActionBar/ActionBar.tsx +16 -12
  71. package/src/components/ActionBar/ActionBarAction.tsx +15 -10
  72. package/src/components/Author/Author.tsx +13 -4
  73. package/src/components/Author/styles.ts +0 -6
  74. package/src/components/CopyClipboard/CopyToClipBoard.tsx +4 -3
  75. package/src/components/Deprecated/Deprecated.tsx +6 -19
  76. package/src/components/Engines/Engines.tsx +5 -5
  77. package/src/components/Install/Install.test.tsx +29 -37
  78. package/src/components/Install/Install.tsx +15 -4
  79. package/src/components/Install/InstallListItem.tsx +46 -30
  80. package/src/components/Package/Package.tsx +10 -1
  81. package/src/components/RawViewer/RawViewer.tsx +1 -6
  82. package/src/components/Readme/Readme.tsx +10 -21
  83. package/src/components/Readme/ReadmeDark.tsx +32 -0
  84. package/src/components/Readme/ReadmeLight.tsx +32 -0
  85. package/src/components/Readme/github-markdown-dark.css +1015 -0
  86. package/src/components/Readme/github-markdown-light.css +1014 -0
  87. package/src/components/SettingsMenu/SettingsMenu.tsx +23 -4
  88. package/src/components/SideBarTittle/SideBarTittle.tsx +1 -0
  89. package/src/components/Versions/HistoryList.tsx +29 -1
  90. package/src/components/Versions/Versions.test.tsx +16 -1
  91. package/src/components/Versions/Versions.tsx +17 -1
  92. package/src/components/Versions/__partials__/data.json +1 -0
  93. package/src/components/Versions/__partials__/deprecated-versions.json +175 -0
  94. package/src/providers/AppConfigurationProvider/AppConfigurationProvider.tsx +1 -0
  95. package/src/providers/PersistenceSettingProvider/PersistenceSettingProvider.tsx +2 -0
  96. package/src/store/models/download.ts +0 -1
  97. package/src/types/packageMeta.ts +1 -0
@@ -2,5 +2,5 @@ import React from 'react';
2
2
  export declare const CustomRouterLink: import("@emotion/styled").StyledComponent<import("react-router-dom").LinkProps<unknown> & React.RefAttributes<HTMLAnchorElement> & {
3
3
  theme?: import("@emotion/react").Theme | undefined;
4
4
  }, {}, {}>;
5
- declare const Link: React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<HTMLAnchorElement>>;
5
+ declare const Link: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
6
6
  export default Link;
@@ -1,10 +1,10 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  declare const _default: {
3
3
  title: string;
4
4
  };
5
5
  export default _default;
6
6
  export declare const OpenLoginDialog: {
7
- render: (args: any) => JSX.Element;
7
+ render: (args: any) => React.JSX.Element;
8
8
  argTypes: {
9
9
  open: boolean;
10
10
  };
@@ -8,5 +8,5 @@ interface Props {
8
8
  onSubmit: (formValues: FormValues) => void;
9
9
  error?: LoginError;
10
10
  }
11
- declare const LoginDialogForm: React.MemoExoticComponent<({ onSubmit, error }: Props) => JSX.Element>;
11
+ declare const LoginDialogForm: React.MemoExoticComponent<({ onSubmit, error }: Props) => React.JSX.Element>;
12
12
  export default LoginDialogForm;
@@ -7,5 +7,5 @@ export interface FormValues {
7
7
  interface Props {
8
8
  error: LoginError;
9
9
  }
10
- declare const LoginDialogFormError: React.MemoExoticComponent<({ error }: Props) => JSX.Element>;
10
+ declare const LoginDialogFormError: React.MemoExoticComponent<({ error }: Props) => React.JSX.Element>;
11
11
  export default LoginDialogFormError;
@@ -5,5 +5,5 @@ type MenuItemRef = HTMLElementTagNameMap[HTMLElementTagName];
5
5
  interface Props extends Omit<MenuItemProps, 'component'> {
6
6
  component?: HTMLElementTagName;
7
7
  }
8
- declare const MenuItem: React.ForwardRefExoticComponent<Pick<Props, keyof Props> & React.RefAttributes<MenuItemRef>>;
8
+ declare const MenuItem: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<MenuItemRef>>;
9
9
  export default MenuItem;
@@ -1,4 +1,3 @@
1
- import 'github-markdown-css';
2
1
  import 'highlight.js/styles/default.css';
3
2
  import React from 'react';
4
3
  import { Props } from './types';
@@ -0,0 +1,5 @@
1
+ import 'highlight.js/styles/default.css';
2
+ import React from 'react';
3
+ import { Props } from './types';
4
+ declare const Readme: React.FC<Props>;
5
+ export default Readme;
@@ -0,0 +1,5 @@
1
+ import 'highlight.js/styles/default.css';
2
+ import React from 'react';
3
+ import { Props } from './types';
4
+ declare const Readme: React.FC<Props>;
5
+ export default Readme;
@@ -6,7 +6,7 @@ export declare const Wrapper: import("@emotion/styled").StyledComponent<{
6
6
  theme?: import("@emotion/react").Theme | undefined;
7
7
  as?: import("react").ElementType<any> | undefined;
8
8
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
9
- export declare const StyledTextField: import("@emotion/styled").StyledComponent<(((Pick<import("@mui/material").OutlinedTextFieldProps, keyof import("@mui/material").OutlinedTextFieldProps> | Pick<import("@mui/material").FilledTextFieldProps, keyof import("@mui/material").FilledTextFieldProps> | Pick<import("@mui/material").StandardTextFieldProps, keyof import("@mui/material").StandardTextFieldProps>) & import("react").RefAttributes<HTMLDivElement>) & {
9
+ export declare const StyledTextField: import("@emotion/styled").StyledComponent<(((Omit<import("@mui/material").OutlinedTextFieldProps, "ref"> | Omit<import("@mui/material").FilledTextFieldProps, "ref"> | Omit<import("@mui/material").StandardTextFieldProps, "ref">) & import("react").RefAttributes<HTMLDivElement>) & {
10
10
  theme?: import("@emotion/react").Theme | undefined;
11
11
  }) & {
12
12
  theme?: import("@mui/material").Theme | undefined;
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  declare const _default: {
3
3
  title: string;
4
4
  };
5
5
  export default _default;
6
6
  export declare const SearchByQuery: {
7
- render: (args: any) => JSX.Element;
7
+ render: (args: any) => React.JSX.Element;
8
8
  };
@@ -2,7 +2,7 @@
2
2
  export interface InputFieldProps {
3
3
  color: string;
4
4
  }
5
- export declare const StyledTextField: import("@emotion/styled").StyledComponent<(((Pick<import("@mui/material").OutlinedTextFieldProps, keyof import("@mui/material").OutlinedTextFieldProps> | Pick<import("@mui/material").FilledTextFieldProps, keyof import("@mui/material").FilledTextFieldProps> | Pick<import("@mui/material").StandardTextFieldProps, keyof import("@mui/material").StandardTextFieldProps>) & import("react").RefAttributes<HTMLDivElement>) & {
5
+ export declare const StyledTextField: import("@emotion/styled").StyledComponent<(((Omit<import("@mui/material").OutlinedTextFieldProps, "ref"> | Omit<import("@mui/material").FilledTextFieldProps, "ref"> | Omit<import("@mui/material").StandardTextFieldProps, "ref">) & import("react").RefAttributes<HTMLDivElement>) & {
6
6
  theme?: import("@emotion/react").Theme | undefined;
7
7
  }) & {
8
8
  theme?: import("@mui/material").Theme | undefined;
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
- declare const TextField: React.ForwardRefExoticComponent<(Pick<import("@mui/material/TextField").OutlinedTextFieldProps, keyof import("@mui/material/TextField").OutlinedTextFieldProps> | Pick<import("@mui/material/TextField").FilledTextFieldProps, keyof import("@mui/material/TextField").FilledTextFieldProps> | Pick<import("@mui/material/TextField").StandardTextFieldProps, keyof import("@mui/material/TextField").StandardTextFieldProps>) & React.RefAttributes<HTMLDivElement>>;
2
+ declare const TextField: React.ForwardRefExoticComponent<(Omit<import("@mui/material/TextField").OutlinedTextFieldProps, "ref"> | Omit<import("@mui/material/TextField").FilledTextFieldProps, "ref"> | Omit<import("@mui/material/TextField").StandardTextFieldProps, "ref">) & React.RefAttributes<HTMLDivElement>>;
3
3
  export default TextField;
@@ -5,5 +5,6 @@ interface Props {
5
5
  packageName: string;
6
6
  time: Time;
7
7
  }
8
+ export declare function filterDeprecated(versions: Versions): {};
8
9
  declare const VersionsHistoryList: React.FC<Props>;
9
10
  export default VersionsHistoryList;
@@ -1,3 +1,3 @@
1
- /// <reference types="react" />
2
- declare const Footer: () => JSX.Element;
1
+ import React from 'react';
2
+ declare const Footer: () => React.JSX.Element;
3
3
  export default Footer;
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  export declare const CardSelected: import("@emotion/styled").StyledComponent<any, {}, {}>;
3
3
  export declare const CardUnSelected: import("@emotion/styled").StyledComponent<any, {}, {}>;
4
- declare const LanguageSwitch: () => JSX.Element;
4
+ declare const LanguageSwitch: () => React.JSX.Element;
5
5
  export default LanguageSwitch;
@@ -27,7 +27,7 @@ export declare const SearchWrapper: import("@emotion/styled").StyledComponent<{
27
27
  as?: import("react").ElementType<any> | undefined;
28
28
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
29
29
  export declare const NavBar: import("@emotion/styled").StyledComponent<any, {}, {}>;
30
- export declare const StyledLink: import("@emotion/styled").StyledComponent<Pick<any, string | number | symbol> & import("react").RefAttributes<HTMLAnchorElement> & {
30
+ export declare const StyledLink: import("@emotion/styled").StyledComponent<Omit<any, "ref"> & import("react").RefAttributes<HTMLAnchorElement> & {
31
31
  theme?: import("@emotion/react").Theme | undefined;
32
32
  } & {
33
33
  theme?: import("@mui/material").Theme | undefined;
@@ -71,6 +71,7 @@ export interface Version {
71
71
  license?: string;
72
72
  main?: string;
73
73
  keywords?: string[];
74
+ deprecated?: string;
74
75
  }
75
76
  export interface Author {
76
77
  name?: string;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  /**
3
3
  * With the combination of a bundler, enable to code split a package.
4
4
  *
@@ -8,5 +8,5 @@
8
8
  ```
9
9
  @category HOC
10
10
  */
11
- declare const _default: (importCallback: any) => (props: any) => JSX.Element;
11
+ declare const _default: (importCallback: any) => (props: any) => React.JSX.Element;
12
12
  export default _default;
@@ -19,7 +19,6 @@ const download = (0, _core.createModel)()({
19
19
  async getTarball({
20
20
  link
21
21
  }) {
22
- // const basePath = state.configuration.config.base;
23
22
  try {
24
23
  const fileStream = await _api.default.request(link, 'GET', {
25
24
  headers: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdaccio/ui-components",
3
- "version": "3.0.0-next.1",
3
+ "version": "3.0.0-next.2",
4
4
  "description": "theme ui component",
5
5
  "author": "Juan Picado <juanpicado19@gmail.com>",
6
6
  "license": "MIT",
@@ -12,19 +12,19 @@
12
12
  "@emotion/styled": "^11.10.6",
13
13
  "@fontsource/material-icons": "^4.5.4",
14
14
  "@fontsource/roboto": "^4.5.8",
15
- "@mui/icons-material": "5.13.7",
16
- "@mui/material": "5.13.7",
17
- "@mui/styles": "5.13.7",
18
- "@mui/system": "5.13.7",
15
+ "@mui/icons-material": "5.14.13",
16
+ "@mui/material": "5.14.13",
17
+ "@mui/styles": "5.14.13",
18
+ "@mui/system": "5.14.13",
19
19
  "@rematch/core": "2.2.0",
20
20
  "@rematch/loading": "2.1.2",
21
21
  "@rematch/persist": "2.1.2",
22
22
  "country-flag-icons": "1.5.5",
23
23
  "dayjs": "1.11.7",
24
24
  "dompurify": "2.4.5",
25
- "github-markdown-css": "5.2.0",
26
25
  "highlight.js": "11.7.0",
27
26
  "history": "4.10.1",
27
+ "classnames": "2.3.2",
28
28
  "i18next": "20.6.1",
29
29
  "js-base64": "3.7.5",
30
30
  "localstorage-memory": "1.0.3",
@@ -46,7 +46,7 @@
46
46
  "validator": "13.9.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@babel/core": "^7.20.7",
49
+ "@babel/core": "^7.23.0",
50
50
  "@emotion/babel-plugin": "11.10.6",
51
51
  "@emotion/jest": "11.10.5",
52
52
  "@storybook/addon-actions": "^6.5.15",
@@ -57,15 +57,16 @@
57
57
  "@storybook/manager-webpack5": "^6.5.15",
58
58
  "@storybook/react": "^6.5.15",
59
59
  "@storybook/testing-library": "^0.0.13",
60
- "@testing-library/dom": "8.19.1",
61
- "@testing-library/jest-dom": "5.16.5",
62
- "@testing-library/react": "13.4.0",
60
+ "@testing-library/dom": "9.3.3",
61
+ "@testing-library/jest-dom": "6.1.3",
62
+ "@testing-library/react": "14.0.0",
63
63
  "@types/hast": "^2.0.0",
64
64
  "@types/react-router": "^5.1.20",
65
65
  "@types/unist": "^2.0.0",
66
- "@verdaccio/types": "12.0.0-next.0",
66
+ "@verdaccio/types": "12.0.0-next.1",
67
67
  "babel-loader": "^8.3.0",
68
68
  "mockdate": "3.0.5",
69
+ "typescript": "4.9.4",
69
70
  "msw": "0.49.3"
70
71
  },
71
72
  "msw": {
@@ -78,6 +79,7 @@
78
79
  "type-check": "tsc --noEmit -p tsconfig.build.json",
79
80
  "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json",
80
81
  "build:js": "babel src/ --out-dir build/ --copy-files --no-copy-ignored --extensions \".ts,.tsx\" --source-maps --ignore \"src/**/*.stories.tsx\" --ignore \"src/**/*.test.tsx\" --ignore \"src/**/*.test.ts\"",
82
+ "watch": "babel src/ --out-dir build/ --watch --copy-files --no-copy-ignored --extensions \".ts,.tsx\" --source-maps --ignore \"src/**/*.stories.tsx\" --ignore \"src/**/*.test.tsx\" --ignore \"src/**/*.test.ts\"",
81
83
  "build": "pnpm run build:js && pnpm run build:types",
82
84
  "start": "start-storybook -p 6006 -s ./public",
83
85
  "build-storybook": "build-storybook"
@@ -20,7 +20,7 @@ const packageMeta = {
20
20
  dist: {
21
21
  fileCount: 0,
22
22
  unpackedSize: 0,
23
- tarball: 'https://registry.verdaccio.org/storybook/-/storybook-0.2.0.tgz',
23
+ tarball: 'https://registry.npmjs.org/verdaccio/-/verdaccio-5.26.0.tgz',
24
24
  },
25
25
  homepage: 'https://verdaccio.org',
26
26
  bugs: {
@@ -1,7 +1,13 @@
1
1
  import React from 'react';
2
2
 
3
3
  import { store } from '../../store/store';
4
- import { cleanup, fireEvent, renderWithStore, screen } from '../../test/test-react-testing-library';
4
+ import {
5
+ cleanup,
6
+ fireEvent,
7
+ renderWithStore,
8
+ screen,
9
+ waitFor,
10
+ } from '../../test/test-react-testing-library';
5
11
  import ActionBar from './ActionBar';
6
12
 
7
13
  const defaultPackageMeta = {
@@ -27,8 +33,10 @@ describe('<ActionBar /> component', () => {
27
33
  });
28
34
 
29
35
  test('should render the component in default state', () => {
30
- const { container } = renderWithStore(<ActionBar packageMeta={defaultPackageMeta} />, store);
31
- expect(container.firstChild).toMatchSnapshot();
36
+ renderWithStore(<ActionBar packageMeta={defaultPackageMeta} />, store);
37
+ expect(screen.getByTestId('download-tarball-btn')).toBeInTheDocument();
38
+ expect(screen.getByTestId('BugReportIcon')).toBeInTheDocument();
39
+ expect(screen.getByTestId('HomeIcon')).toBeInTheDocument();
32
40
  });
33
41
 
34
42
  test('when there is no action bar data', () => {
@@ -45,8 +53,10 @@ describe('<ActionBar /> component', () => {
45
53
  },
46
54
  };
47
55
 
48
- const { container } = renderWithStore(<ActionBar packageMeta={packageMeta} />, store);
49
- expect(container.firstChild).toMatchSnapshot();
56
+ renderWithStore(<ActionBar packageMeta={packageMeta} />, store);
57
+ expect(screen.queryByTestId('download-tarball-btn')).not.toBeInTheDocument();
58
+ expect(screen.queryByTestId('BugReportIcon')).not.toBeInTheDocument();
59
+ expect(screen.queryByTestId('HomeIcon')).not.toBeInTheDocument();
50
60
  });
51
61
 
52
62
  test('when there is a button to download a tarball', () => {
@@ -59,11 +69,10 @@ describe('<ActionBar /> component', () => {
59
69
  expect(screen.getByLabelText('action-bar-action.raw')).toBeTruthy();
60
70
  });
61
71
 
62
- test('when click button to raw manifest open a dialog with viewver', () => {
72
+ test('when click button to raw manifest open a dialog with viewer', async () => {
63
73
  renderWithStore(<ActionBar packageMeta={defaultPackageMeta} showRaw={true} />, store);
64
74
  fireEvent.click(screen.getByLabelText('action-bar-action.raw'));
65
- // TODO: fix this part
66
- // expect(screen.getByTestId('raw-viewver-dialog')).toBeInTheDocument();
75
+ await waitFor(() => expect(screen.getByTestId('rawViewer--dialog')).toBeInTheDocument());
67
76
  });
68
77
 
69
78
  test('should not display download tarball button', () => {
@@ -78,8 +87,6 @@ describe('<ActionBar /> component', () => {
78
87
 
79
88
  test('when there is a button to open an issue', () => {
80
89
  renderWithStore(<ActionBar packageMeta={defaultPackageMeta} />, store);
81
- // TODO: should be visible by text
82
- // expect(screen.getByLabelText('action-bar-action.open-an-issue')).toBeTruthy();
83
90
  expect(screen.getByTestId('BugReportIcon')).toBeInTheDocument();
84
91
  });
85
92
  });
@@ -1,4 +1,6 @@
1
+ /* eslint-disable verdaccio/jsx-spread */
1
2
  import Box from '@mui/material/Box';
3
+ import Stack from '@mui/material/Stack';
2
4
  import React, { useState } from 'react';
3
5
 
4
6
  import { url } from '../../utils';
@@ -40,18 +42,20 @@ const ActionBar: React.FC<Props> = ({ showRaw, showDownloadTarball = true, packa
40
42
 
41
43
  return (
42
44
  <Box alignItems="center" display="flex" marginBottom="14px">
43
- {actions.map((action) => (
44
- <ActionBarAction key={action.type} {...action} />
45
- ))}
46
- {isRawViewerOpen && (
47
- <RawViewer
48
- isOpen={isRawViewerOpen}
49
- onClose={() => {
50
- setIsRawViewerOpen(false);
51
- }}
52
- packageMeta={packageMeta}
53
- />
54
- )}
45
+ <Stack direction="row" spacing={1}>
46
+ {actions.map((action) => (
47
+ <ActionBarAction key={action.type} {...action} />
48
+ ))}
49
+ {isRawViewerOpen && (
50
+ <RawViewer
51
+ isOpen={isRawViewerOpen}
52
+ onClose={() => {
53
+ setIsRawViewerOpen(false);
54
+ }}
55
+ packageMeta={packageMeta}
56
+ />
57
+ )}
58
+ </Stack>
55
59
  </Box>
56
60
  );
57
61
  };
@@ -3,25 +3,21 @@ import BugReportIcon from '@mui/icons-material/BugReport';
3
3
  import DownloadIcon from '@mui/icons-material/CloudDownload';
4
4
  import HomeIcon from '@mui/icons-material/Home';
5
5
  import RawOnIcon from '@mui/icons-material/RawOn';
6
+ import CircularProgress from '@mui/material/CircularProgress';
6
7
  import FabMUI from '@mui/material/Fab';
7
8
  import Tooltip from '@mui/material/Tooltip';
8
9
  import React, { useCallback } from 'react';
9
10
  import { useTranslation } from 'react-i18next';
10
- import { useDispatch } from 'react-redux';
11
+ import { useDispatch, useSelector } from 'react-redux';
11
12
 
12
13
  import { Theme } from '../../Theme';
13
- import { Dispatch } from '../../store/store';
14
+ import { Dispatch, RootState } from '../../store/store';
14
15
  import { Link } from '../Link';
15
16
 
16
17
  export const Fab = styled(FabMUI)<{ theme?: Theme }>(({ theme }) => ({
17
18
  backgroundColor:
18
19
  theme?.palette.mode === 'light' ? theme?.palette.primary.main : theme?.palette.cyanBlue,
19
20
  color: theme?.palette.white,
20
- marginRight: 10,
21
- ':hover': {
22
- color: theme?.palette.mode === 'light' ? theme?.palette.primary.main : theme?.palette.cyanBlue,
23
- background: theme?.palette.white,
24
- },
25
21
  }));
26
22
 
27
23
  type ActionType = 'VISIT_HOMEPAGE' | 'OPEN_AN_ISSUE' | 'DOWNLOAD_TARBALL' | 'RAW_DATA';
@@ -36,6 +32,7 @@ export interface ActionBarActionProps {
36
32
  const ActionBarAction: React.FC<ActionBarActionProps> = ({ type, link, action }) => {
37
33
  const { t } = useTranslation();
38
34
  const dispatch = useDispatch<Dispatch>();
35
+ const isLoading = useSelector((state: RootState) => state?.loading?.models.download);
39
36
 
40
37
  const handleDownload = useCallback(async () => {
41
38
  dispatch.download.getTarball({ link });
@@ -65,9 +62,17 @@ const ActionBarAction: React.FC<ActionBarActionProps> = ({ type, link, action })
65
62
  case 'DOWNLOAD_TARBALL':
66
63
  return (
67
64
  <Tooltip title={t('action-bar-action.download-tarball') as string}>
68
- <Fab data-testid="download-tarball-btn" onClick={handleDownload} size="small">
69
- <DownloadIcon />
70
- </Fab>
65
+ {isLoading ? (
66
+ <CircularProgress sx={{ marginX: 0 }}>
67
+ <Fab data-testid="download-tarball-btn" onClick={handleDownload} size="small">
68
+ <DownloadIcon />
69
+ </Fab>
70
+ </CircularProgress>
71
+ ) : (
72
+ <Fab data-testid="download-tarball-btn" onClick={handleDownload} size="small">
73
+ <DownloadIcon />
74
+ </Fab>
75
+ )}
71
76
  </Tooltip>
72
77
  );
73
78
  case 'RAW_DATA':
@@ -1,11 +1,13 @@
1
+ import { Typography } from '@mui/material';
1
2
  import Avatar from '@mui/material/Avatar';
2
3
  import List from '@mui/material/List';
4
+ import { useTheme } from '@mui/styles';
3
5
  import i18next from 'i18next';
4
6
  import React, { FC } from 'react';
5
7
  import { useTranslation } from 'react-i18next';
6
8
 
7
9
  import { url } from '../../utils';
8
- import { AuthorListItem, AuthorListItemText, StyledText } from './styles';
10
+ import { AuthorListItem, StyledText } from './styles';
9
11
 
10
12
  export function getAuthorName(authorName?: string): string {
11
13
  if (!authorName) {
@@ -26,6 +28,8 @@ export function getAuthorName(authorName?: string): string {
26
28
  const Author: FC<{ packageMeta }> = ({ packageMeta }) => {
27
29
  const { t } = useTranslation();
28
30
 
31
+ const theme = useTheme();
32
+
29
33
  if (!packageMeta) {
30
34
  return null;
31
35
  }
@@ -37,8 +41,13 @@ const Author: FC<{ packageMeta }> = ({ packageMeta }) => {
37
41
  }
38
42
 
39
43
  const { email, name } = author;
40
-
41
- const avatarComponent = <Avatar alt={author.name} src={author.avatar} />;
44
+ const avatarComponent = (
45
+ <Avatar
46
+ alt={author.name}
47
+ src={author.avatar}
48
+ sx={{ width: 40, height: 40, marginRight: theme.spacing(1) }}
49
+ />
50
+ );
42
51
 
43
52
  return (
44
53
  <List subheader={<StyledText variant={'subtitle1'}>{t('sidebar.author.title')}</StyledText>}>
@@ -50,7 +59,7 @@ const Author: FC<{ packageMeta }> = ({ packageMeta }) => {
50
59
  {avatarComponent}
51
60
  </a>
52
61
  )}
53
- {name && <AuthorListItemText primary={getAuthorName(name)} />}
62
+ {name && <Typography variant="subtitle2">{getAuthorName(name)}</Typography>}
54
63
  </AuthorListItem>
55
64
  </List>
56
65
  );
@@ -1,7 +1,6 @@
1
1
  import styled from '@emotion/styled';
2
2
  import { Typography } from '@mui/material';
3
3
  import ListItem from '@mui/material/ListItem';
4
- import ListItemText from '@mui/material/ListItemText';
5
4
 
6
5
  import { Theme } from '../../Theme';
7
6
 
@@ -15,8 +14,3 @@ export const AuthorListItem = styled(ListItem)({
15
14
  backgroundColor: 'transparent',
16
15
  },
17
16
  });
18
-
19
- export const AuthorListItemText = styled(ListItemText)({
20
- padding: '0 10px',
21
- margin: 0,
22
- });
@@ -4,6 +4,7 @@ import IconButton from '@mui/material/IconButton';
4
4
  import Tooltip from '@mui/material/Tooltip';
5
5
  import React from 'react';
6
6
 
7
+ import { Theme } from '../../Theme';
7
8
  import { copyToClipBoardUtility } from './utils';
8
9
 
9
10
  interface Props {
@@ -19,14 +20,14 @@ const Wrapper = styled('div')({
19
20
  justifyContent: 'space-between',
20
21
  });
21
22
 
22
- const Content = styled('span')({
23
+ const Content = styled('span')<{ theme?: Theme }>(({ theme }) => ({
23
24
  display: 'inline-block',
24
25
  overflow: 'hidden',
25
26
  textOverflow: 'ellipsis',
26
27
  height: 'auto',
27
28
  whiteSpace: 'break-spaces',
28
- fontSize: '1rem',
29
- });
29
+ fontSize: theme?.fontSize.sm,
30
+ }));
30
31
 
31
32
  function CopyToClipBoard({ text, children, dataTestId, title, ...props }: Props) {
32
33
  return (
@@ -1,30 +1,17 @@
1
- import Card from '@mui/material/Card';
2
- import CardContent from '@mui/material/CardContent';
3
- import { styled } from '@mui/system';
1
+ import Alert from '@mui/material/Alert';
2
+ import { useTheme } from '@mui/styles';
4
3
  import React from 'react';
5
4
 
6
- import { Theme } from '../../Theme';
7
-
8
- export const CardStyled = styled(Card)<{ theme?: Theme }>(({ theme }) => {
9
- return {
10
- marginTop: theme?.spacing(1),
11
- marginBottom: theme?.spacing(0.5),
12
- backgroundColor: theme?.palette?.error.light,
13
- opacity: '0.9',
14
- color: theme?.palette?.error.contrastText,
15
- fontWeight: 'bold',
16
- };
17
- });
18
-
19
5
  export type Props = {
20
6
  message: string;
21
7
  };
22
8
 
23
9
  const Deprecated: React.FC<Props> = ({ message }) => {
10
+ const theme = useTheme();
24
11
  return (
25
- <CardStyled>
26
- <CardContent>{message}</CardContent>
27
- </CardStyled>
12
+ <Alert severity="warning" sx={{ marginTop: theme.spacing(1), marginBottom: theme.spacing(1) }}>
13
+ {message}
14
+ </Alert>
28
15
  );
29
16
  };
30
17
 
@@ -1,7 +1,7 @@
1
+ import { Typography } from '@mui/material';
1
2
  import Avatar from '@mui/material/Avatar';
2
3
  import Grid from '@mui/material/Grid';
3
4
  import List from '@mui/material/List';
4
- import ListItemText from '@mui/material/ListItemText';
5
5
  import React, { FC } from 'react';
6
6
  import { useTranslation } from 'react-i18next';
7
7
 
@@ -24,7 +24,7 @@ const EngineItem: FC<EngineItemProps> = ({ title, element, engineText }) => (
24
24
  <List subheader={<StyledText variant={'subtitle1'}>{title}</StyledText>}>
25
25
  <EngineListItem>
26
26
  <Avatar sx={{ bgcolor: '#FFF' }}>{element}</Avatar>
27
- <ListItemText primary={engineText} />
27
+ <Typography variant="subtitle2">{engineText}</Typography>
28
28
  </EngineListItem>
29
29
  </List>
30
30
  </Grid>
@@ -68,7 +68,7 @@ const Engine: React.FC<Props> = ({ packageMeta }) => {
68
68
  {engines.npm ? (
69
69
  <EngineItem
70
70
  element={<Npm />}
71
- engineText={engines.node}
71
+ engineText={engines.npm}
72
72
  title={t('sidebar.engines.npm-version')}
73
73
  />
74
74
  ) : null}
@@ -77,7 +77,7 @@ const Engine: React.FC<Props> = ({ packageMeta }) => {
77
77
  <EngineItem
78
78
  element={<Yarn />}
79
79
  engineText={engines.yarn}
80
- title={t('sidebar.engines.npm-version')}
80
+ title={t('sidebar.engines.yarn-version')}
81
81
  />
82
82
  ) : null}
83
83
 
@@ -85,7 +85,7 @@ const Engine: React.FC<Props> = ({ packageMeta }) => {
85
85
  <EngineItem
86
86
  element={<Pnpm />}
87
87
  engineText={engines.pnpm}
88
- title={t('sidebar.engines.npm-version')}
88
+ title={t('sidebar.engines.pnpm-version')}
89
89
  />
90
90
  ) : null}
91
91
  </Grid>