@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.
- package/CHANGELOG.md +23 -0
- package/build/components/ActionBar/ActionBar.js +6 -2
- package/build/components/ActionBar/ActionBarAction.js +15 -7
- package/build/components/Author/Author.js +15 -7
- package/build/components/Author/styles.js +7 -23
- package/build/components/CopyClipboard/CopyToClipBoard.js +11 -10
- package/build/components/Deprecated/Deprecated.js +11 -19
- package/build/components/Engines/Engines.js +7 -7
- package/build/components/Install/Install.js +7 -4
- package/build/components/Install/InstallListItem.js +25 -37
- package/build/components/Package/Package.js +14 -6
- package/build/components/RawViewer/RawViewer.js +0 -1
- package/build/components/Readme/Readme.js +11 -26
- package/build/components/Readme/Readme.js.map +1 -1
- package/build/components/Readme/ReadmeDark.js +46 -0
- package/build/components/Readme/ReadmeLight.js +46 -0
- package/build/components/Readme/github-markdown-dark.css +1015 -0
- package/build/components/Readme/github-markdown-light.css +1014 -0
- package/build/components/SettingsMenu/SettingsMenu.js +16 -3
- package/build/components/SideBarTittle/SideBarTittle.js +5 -4
- package/build/components/Versions/HistoryList.js +32 -4
- package/build/components/Versions/Versions.js +16 -2
- package/build/components/Versions/__partials__/data.json +1 -0
- package/build/components/Versions/__partials__/deprecated-versions.json +175 -0
- package/build/providers/AppConfigurationProvider/AppConfigurationProvider.js +1 -0
- package/build/providers/PersistenceSettingProvider/PersistenceSettingProvider.js +2 -1
- package/build/src/__mocks__/react-markdown.d.ts +2 -2
- package/build/src/components/Author/styles.d.ts +0 -4
- package/build/src/components/CopyClipboard/CopyToClipBoard.d.ts +1 -1
- package/build/src/components/Deprecated/Deprecated.d.ts +0 -1
- package/build/src/components/Heading/Heading.d.ts +1 -1
- package/build/src/components/Icons/DevsIcons/CommonJS.d.ts +2 -2
- package/build/src/components/Icons/DevsIcons/ES6Module.d.ts +2 -2
- package/build/src/components/Icons/DevsIcons/Git.d.ts +2 -2
- package/build/src/components/Icons/DevsIcons/NodeJS.d.ts +2 -2
- package/build/src/components/Icons/DevsIcons/TypeScript.d.ts +2 -2
- package/build/src/components/Icons/Earth.d.ts +2 -2
- package/build/src/components/Icons/FileBinary.d.ts +2 -2
- package/build/src/components/Icons/Law.d.ts +2 -2
- package/build/src/components/Icons/License.d.ts +2 -2
- package/build/src/components/Icons/Managers/Npm.d.ts +2 -2
- package/build/src/components/Icons/Managers/Pnpm.d.ts +2 -2
- package/build/src/components/Icons/Managers/Yarn.d.ts +2 -2
- package/build/src/components/Icons/SvgIcon.d.ts +1 -1
- package/build/src/components/Icons/Time.d.ts +2 -2
- package/build/src/components/Icons/Version.d.ts +2 -2
- package/build/src/components/Install/InstallListItem.d.ts +2 -0
- package/build/src/components/Link/Link.d.ts +1 -1
- package/build/src/components/LoginDialog/LoginDialog.stories.d.ts +2 -2
- package/build/src/components/LoginDialog/LoginDialogForm.d.ts +1 -1
- package/build/src/components/LoginDialog/LoginDialogFormError.d.ts +1 -1
- package/build/src/components/MenuItem/MenuItem.d.ts +1 -1
- package/build/src/components/Readme/Readme.d.ts +0 -1
- package/build/src/components/Readme/ReadmeDark.d.ts +5 -0
- package/build/src/components/Readme/ReadmeLight.d.ts +5 -0
- package/build/src/components/Search/AutoComplete/styles.d.ts +1 -1
- package/build/src/components/Search/Search.stories.d.ts +2 -2
- package/build/src/components/Search/styles.d.ts +1 -1
- package/build/src/components/TextField/TextField.d.ts +1 -1
- package/build/src/components/Versions/HistoryList.d.ts +1 -0
- package/build/src/sections/Footer/Footer.d.ts +2 -2
- package/build/src/sections/Header/LanguageSwitch.d.ts +2 -2
- package/build/src/sections/Header/styles.d.ts +1 -1
- package/build/src/types/packageMeta.d.ts +1 -0
- package/build/src/utils/loadable.d.ts +2 -2
- package/build/store/models/download.js +0 -1
- package/package.json +13 -11
- package/src/components/ActionBar/ActionBar.stories.tsx +1 -1
- package/src/components/ActionBar/ActionBar.test.tsx +17 -10
- package/src/components/ActionBar/ActionBar.tsx +16 -12
- package/src/components/ActionBar/ActionBarAction.tsx +15 -10
- package/src/components/Author/Author.tsx +13 -4
- package/src/components/Author/styles.ts +0 -6
- package/src/components/CopyClipboard/CopyToClipBoard.tsx +4 -3
- package/src/components/Deprecated/Deprecated.tsx +6 -19
- package/src/components/Engines/Engines.tsx +5 -5
- package/src/components/Install/Install.test.tsx +29 -37
- package/src/components/Install/Install.tsx +15 -4
- package/src/components/Install/InstallListItem.tsx +46 -30
- package/src/components/Package/Package.tsx +10 -1
- package/src/components/RawViewer/RawViewer.tsx +1 -6
- package/src/components/Readme/Readme.tsx +10 -21
- package/src/components/Readme/ReadmeDark.tsx +32 -0
- package/src/components/Readme/ReadmeLight.tsx +32 -0
- package/src/components/Readme/github-markdown-dark.css +1015 -0
- package/src/components/Readme/github-markdown-light.css +1014 -0
- package/src/components/SettingsMenu/SettingsMenu.tsx +23 -4
- package/src/components/SideBarTittle/SideBarTittle.tsx +1 -0
- package/src/components/Versions/HistoryList.tsx +29 -1
- package/src/components/Versions/Versions.test.tsx +16 -1
- package/src/components/Versions/Versions.tsx +17 -1
- package/src/components/Versions/__partials__/data.json +1 -0
- package/src/components/Versions/__partials__/deprecated-versions.json +175 -0
- package/src/providers/AppConfigurationProvider/AppConfigurationProvider.tsx +1 -0
- package/src/providers/PersistenceSettingProvider/PersistenceSettingProvider.tsx +2 -0
- package/src/store/models/download.ts +0 -1
- 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<
|
|
5
|
+
declare const Link: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
6
6
|
export default Link;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
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<
|
|
8
|
+
declare const MenuItem: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<MenuItemRef>>;
|
|
9
9
|
export default MenuItem;
|
|
@@ -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<(((
|
|
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
|
-
|
|
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<(((
|
|
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<(
|
|
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;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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<
|
|
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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdaccio/ui-components",
|
|
3
|
-
"version": "3.0.0-next.
|
|
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
|
|
16
|
-
"@mui/material": "5.13
|
|
17
|
-
"@mui/styles": "5.13
|
|
18
|
-
"@mui/system": "5.13
|
|
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.
|
|
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": "
|
|
61
|
-
"@testing-library/jest-dom": "
|
|
62
|
-
"@testing-library/react": "
|
|
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.
|
|
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.
|
|
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 {
|
|
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
|
-
|
|
31
|
-
expect(
|
|
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
|
-
|
|
49
|
-
expect(
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
69
|
-
<
|
|
70
|
-
|
|
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,
|
|
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
|
-
|
|
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 && <
|
|
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:
|
|
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
|
|
2
|
-
import
|
|
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
|
-
<
|
|
26
|
-
|
|
27
|
-
</
|
|
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
|
-
<
|
|
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.
|
|
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.
|
|
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.
|
|
88
|
+
title={t('sidebar.engines.pnpm-version')}
|
|
89
89
|
/>
|
|
90
90
|
) : null}
|
|
91
91
|
</Grid>
|