@verdaccio/ui-components 2.0.0-6-next.9 → 2.0.0-6-next.10
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/.babelrc +1 -9
- package/CHANGELOG.md +6 -0
- package/build/Theme/ResetStyles.js +34 -37
- package/build/Theme/StyleBaseline.js +4 -6
- package/build/Theme/ThemeProvider.js +24 -34
- package/build/Theme/colors.js +1 -1
- package/build/Theme/index.js +9 -10
- package/build/Theme/theme.js +26 -28
- package/build/__mocks__/react-markdown.js +6 -5
- package/build/__mocks__/remark-plugin.js +1 -1
- package/build/components/ActionBar/ActionBar.js +23 -36
- package/build/components/ActionBar/ActionBarAction.js +45 -56
- package/build/components/ActionBar/index.js +3 -3
- package/build/components/Author/Author.js +26 -21
- package/build/components/Author/index.js +3 -3
- package/build/components/Author/styles.js +5 -5
- package/build/components/CopyClipboard/CopyToClipBoard.js +21 -23
- package/build/components/CopyClipboard/index.js +4 -4
- package/build/components/CopyClipboard/utils.js +14 -16
- package/build/components/Dependencies/Dependencies.js +68 -66
- package/build/components/Dependencies/index.js +3 -3
- package/build/components/Dependencies/styles.js +9 -11
- package/build/components/Deprecated/Deprecated.js +10 -8
- package/build/components/Deprecated/index.js +3 -3
- package/build/components/Developers/Developers.js +27 -42
- package/build/components/Developers/Title.js +19 -18
- package/build/components/Developers/get-unique-developer-values.js +3 -13
- package/build/components/Developers/index.js +5 -6
- package/build/components/Developers/styles.js +7 -7
- package/build/components/Distribution/Dist.js +24 -22
- package/build/components/Distribution/index.js +3 -3
- package/build/components/Distribution/styles.js +7 -7
- package/build/components/Distribution/utilts.spec.js +4 -4
- package/build/components/Engines/Engines.js +37 -36
- package/build/components/Engines/index.js +3 -3
- package/build/components/Engines/styles.js +4 -4
- package/build/components/ErrorBoundary/ErrorBoundary.js +29 -50
- package/build/components/ErrorBoundary/index.js +3 -3
- package/build/components/FundButton/FundButton.js +28 -29
- package/build/components/FundButton/index.js +3 -3
- package/build/components/HeaderInfoDialog/HeaderInfoDialog.js +33 -45
- package/build/components/HeaderInfoDialog/index.js +3 -3
- package/build/components/Heading/Heading.js +10 -14
- package/build/components/Heading/index.js +3 -3
- package/build/components/Help/Help.js +22 -21
- package/build/components/Help/index.js +3 -3
- package/build/components/Help/styles.js +2 -2
- package/build/components/Icons/DevsIcons/CommonJS.js +9 -10
- package/build/components/Icons/DevsIcons/ES6Module.js +9 -10
- package/build/components/Icons/DevsIcons/Git.js +9 -10
- package/build/components/Icons/DevsIcons/NodeJS.js +9 -10
- package/build/components/Icons/DevsIcons/TypeScript.js +9 -10
- package/build/components/Icons/DevsIcons/index.js +5 -5
- package/build/components/Icons/Earth.js +11 -11
- package/build/components/Icons/FileBinary.js +4 -4
- package/build/components/Icons/Law.js +4 -4
- package/build/components/Icons/License.js +5 -5
- package/build/components/Icons/License.js.map +1 -1
- package/build/components/Icons/Managers/Npm.js +9 -10
- package/build/components/Icons/Managers/Pnpm.js +9 -10
- package/build/components/Icons/Managers/Yarn.js +9 -10
- package/build/components/Icons/Managers/index.js +3 -3
- package/build/components/Icons/SvgIcon.js +14 -22
- package/build/components/Icons/Time.js +6 -6
- package/build/components/Icons/Version.js +4 -4
- package/build/components/Icons/index.js +8 -8
- package/build/components/Install/Install.js +40 -26
- package/build/components/Install/InstallListItem.js +46 -37
- package/build/components/Install/index.js +3 -3
- package/build/components/Label/Label.js +13 -19
- package/build/components/Label/index.js +3 -3
- package/build/components/Link/Link.js +16 -15
- package/build/components/Link/index.js +3 -3
- package/build/components/Loading/Loading.js +10 -12
- package/build/components/Loading/Spinner/Spinner.js +27 -37
- package/build/components/Loading/Spinner/index.js +3 -3
- package/build/components/Loading/index.js +3 -3
- package/build/components/Loading/styles.js +11 -12
- package/build/components/LoginDialog/LoginDialog.js +44 -79
- package/build/components/LoginDialog/LoginDialogCloseButton.js +20 -19
- package/build/components/LoginDialog/LoginDialogForm.js +40 -39
- package/build/components/LoginDialog/LoginDialogFormError.js +26 -28
- package/build/components/LoginDialog/LoginDialogHeader.js +29 -29
- package/build/components/LoginDialog/index.js +3 -3
- package/build/components/Logo/Logo.js +35 -36
- package/build/components/Logo/index.js +3 -3
- package/build/components/MenuItem/MenuItem.js +8 -9
- package/build/components/MenuItem/index.js +3 -3
- package/build/components/NoItems/NoItems.js +10 -21
- package/build/components/NoItems/index.js +3 -3
- package/build/components/NotFound/NotFound.js +24 -25
- package/build/components/NotFound/index.js +3 -3
- package/build/components/Package/Package.js +108 -146
- package/build/components/Package/Tag/Tag.js +6 -7
- package/build/components/Package/Tag/index.js +3 -3
- package/build/components/Package/Tag/styles.js +2 -2
- package/build/components/Package/index.js +5 -6
- package/build/components/Package/styles.js +65 -70
- package/build/components/PackageList/PackageList.js +56 -52
- package/build/components/PackageList/index.js +3 -3
- package/build/components/RawViewer/RawViewer.js +23 -22
- package/build/components/RawViewer/index.js +3 -3
- package/build/components/Readme/Readme.js +21 -21
- package/build/components/Readme/Readme.js.map +1 -1
- package/build/components/Readme/Readme.spec.js +6 -6
- package/build/components/Readme/Readme.spec.js.map +1 -1
- package/build/components/Readme/index.js +3 -3
- package/build/components/Readme/utils.js +7 -8
- package/build/components/RegistryInfoDialog/RegistryInfoDialog.js +14 -14
- package/build/components/RegistryInfoDialog/index.js +3 -3
- package/build/components/RegistryInfoDialog/styles.js +17 -19
- package/build/components/Repository/Repository.js +37 -36
- package/build/components/Repository/index.js +3 -3
- package/build/components/Search/AutoComplete/AutoComplete.js +26 -35
- package/build/components/Search/AutoComplete/index.js +3 -3
- package/build/components/Search/AutoComplete/styles.js +15 -16
- package/build/components/Search/Search.js +54 -54
- package/build/components/Search/SearchItem.js +56 -64
- package/build/components/Search/index.js +3 -3
- package/build/components/Search/styles.js +16 -17
- package/build/components/SettingsMenu/SettingsMenu.js +68 -0
- package/build/components/SettingsMenu/index.js +14 -0
- package/build/components/SideBarTittle/SideBarTittle.js +33 -31
- package/build/components/SideBarTittle/index.js +3 -3
- package/build/components/SideBarTittle/utils.js +4 -4
- package/build/components/TextField/TextField.js +16 -24
- package/build/components/TextField/index.js +3 -3
- package/build/components/UpLinks/UpLinks.js +18 -16
- package/build/components/UpLinks/index.js +3 -3
- package/build/components/UpLinks/styles.js +20 -22
- package/build/components/Versions/HistoryList.js +25 -25
- package/build/components/Versions/TagList.js +19 -22
- package/build/components/Versions/Versions.js +21 -20
- package/build/components/Versions/index.js +3 -3
- package/build/components/Versions/styles.js +19 -21
- package/build/hooks/index.js +5 -5
- package/build/hooks/useLocalStorage.js +18 -27
- package/build/hooks/useOnClickOutside.js +5 -5
- package/build/index.js +104 -97
- package/build/layouts/Version/Version.js +8 -8
- package/build/layouts/Version/index.js +3 -3
- package/build/providers/AppConfigurationProvider/AppConfigurationProvider.js +18 -31
- package/build/providers/AppConfigurationProvider/index.js +5 -6
- package/build/providers/PersistenceSettingProvider/PersistenceSettingProvider.js +38 -0
- package/build/providers/PersistenceSettingProvider/index.js +21 -0
- package/build/providers/TranslatorProvider/TranslatorProvider.js +26 -49
- package/build/providers/TranslatorProvider/TranslatorProvider.spec.js +21 -19
- package/build/providers/TranslatorProvider/index.js +6 -7
- package/build/providers/VersionProvider/VersionProvider.js +32 -34
- package/build/providers/VersionProvider/index.js +5 -6
- package/build/providers/index.js +3 -3
- package/build/sections/Detail/ContainerContent.js +21 -32
- package/build/sections/Detail/Detail.js +18 -27
- package/build/sections/Detail/ReadmeSection.js +7 -6
- package/build/sections/Detail/Tabs.js +16 -14
- package/build/sections/Detail/index.js +3 -3
- package/build/sections/Footer/Footer.js +54 -56
- package/build/sections/Footer/index.js +3 -3
- package/build/sections/Footer/styles.js +41 -47
- package/build/sections/Header/Header.js +36 -70
- package/build/sections/Header/HeaderGreetings.js +10 -8
- package/build/sections/Header/HeaderLeft.js +11 -12
- package/build/sections/Header/HeaderMenu.js +18 -17
- package/build/sections/Header/HeaderRight.js +41 -51
- package/build/sections/Header/HeaderSettingsDialog.js +48 -58
- package/build/sections/Header/HeaderToolTip.js +10 -11
- package/build/sections/Header/HeaderToolTipIcon.js +19 -19
- package/build/sections/Header/LanguageSwitch.js +51 -56
- package/build/sections/Header/RegistryInfoContent/RegistryInfoContent.js +72 -71
- package/build/sections/Header/RegistryInfoContent/index.js +3 -3
- package/build/sections/Header/RegistryInfoContent/styles.js +13 -16
- package/build/sections/Header/RegistryInfoDialog/RegistryInfoDialog.js +14 -14
- package/build/sections/Header/RegistryInfoDialog/index.js +3 -3
- package/build/sections/Header/RegistryInfoDialog/styles.js +17 -19
- package/build/sections/Header/index.js +3 -3
- package/build/sections/Header/styles.js +35 -38
- package/build/sections/Home/Home.js +11 -14
- package/build/sections/Home/index.js +3 -3
- package/build/sections/SideBar/Sidebar.js +38 -54
- package/build/sections/SideBar/index.js +3 -3
- package/build/sections/index.js +5 -5
- package/build/src/components/ActionBar/ActionBar.stories.d.ts +11 -6
- package/build/src/components/Dependencies/Dependencies.stories.d.ts +8 -6
- package/build/src/components/FundButton/FundButton.stories.d.ts +7 -5
- package/build/src/components/Install/Install.stories.d.ts +9 -5
- package/build/src/components/NoItems/NoItems.d.ts +0 -1
- package/build/src/components/Repository/Repository.stories.d.ts +8 -6
- package/build/src/components/SettingsMenu/SettingsMenu.d.ts +6 -0
- package/build/src/components/SettingsMenu/index.d.ts +1 -0
- package/build/src/components/SideBarTittle/SideBarTittle.stories.d.ts +9 -0
- package/build/src/components/Versions/types.d.ts +0 -2
- package/build/src/index.d.ts +1 -0
- package/build/src/layouts/Version/Version.stories.d.ts +7 -6
- package/build/src/providers/PersistenceSettingProvider/PersistenceSettingProvider.d.ts +6 -0
- package/build/src/providers/PersistenceSettingProvider/index.d.ts +1 -0
- package/build/src/providers/VersionProvider/VersionProvider.d.ts +0 -2
- package/build/store/api.js +35 -52
- package/build/store/index.js +9 -9
- package/build/store/models/configuration.js +12 -32
- package/build/store/models/download.js +22 -44
- package/build/store/models/index.js +1 -1
- package/build/store/models/login.js +55 -77
- package/build/store/models/manifest.js +52 -76
- package/build/store/models/packages.js +22 -49
- package/build/store/models/search.js +59 -85
- package/build/store/storage.js +5 -5
- package/build/store/store.js +3 -3
- package/build/test/i18n-config.js +5 -5
- package/build/test/test-react-testing-library.js +19 -24
- package/build/utils/__partials__/packageMeta.js +1 -1
- package/build/utils/cli-utils.js +27 -20
- package/build/utils/index.js +10 -11
- package/build/utils/loadable.js +9 -12
- package/build/utils/routes.js +1 -1
- package/build/utils/url.js +9 -9
- package/build/utils/utils.js +18 -22
- package/package.json +5 -5
- package/src/components/ActionBar/ActionBar.stories.tsx +60 -46
- package/src/components/Author/Author.stories.tsx +1 -1
- package/src/components/CopyClipboard/CopyToClipBoard.stories.tsx +1 -1
- package/src/components/CopyClipboard/CopyToClipBoard.tsx +2 -2
- package/src/components/Dependencies/Dependencies.stories.tsx +151 -51
- package/src/components/Dependencies/Dependencies.tsx +61 -51
- package/src/components/Deprecated/Deprecated.stories.tsx +1 -1
- package/src/components/Developers/Developers.stories.tsx +1 -1
- package/src/components/Distribution/Dist.stories.tsx +1 -1
- package/src/components/Engines/Engines.stories.tsx +1 -1
- package/src/components/FundButton/FundButton.stories.tsx +48 -17
- package/src/components/Help/Help.stories.tsx +1 -1
- package/src/components/Icons/Icons.stories.tsx +1 -1
- package/src/components/Install/Install.stories.tsx +79 -26
- package/src/components/Install/Install.tsx +28 -14
- package/src/components/Install/InstallListItem.tsx +24 -8
- package/src/components/Loading/Loading.stories.tsx +1 -1
- package/src/components/LoginDialog/LoginDialog.stories.tsx +1 -1
- package/src/components/NoItems/NoItems.stories.tsx +1 -1
- package/src/components/NoItems/NoItems.tsx +5 -6
- package/src/components/Repository/Repository.stories.tsx +39 -12
- package/src/components/Repository/Repository.tsx +2 -4
- package/src/components/Search/Search.stories.tsx +1 -1
- package/src/components/SettingsMenu/SettingsMenu.tsx +67 -0
- package/src/components/SettingsMenu/index.ts +1 -0
- package/src/components/SideBarTittle/SideBarTittle.stories.tsx +68 -0
- package/src/components/UpLinks/Uplinks.stories.tsx +1 -1
- package/src/components/Versions/types.ts +0 -2
- package/src/index.ts +2 -0
- package/src/layouts/Version/Version.stories.tsx +35 -20
- package/src/providers/AppConfigurationProvider/AppConfigurationProvider.tsx +0 -1
- package/src/providers/PersistenceSettingProvider/PersistenceSettingProvider.tsx +57 -0
- package/src/providers/PersistenceSettingProvider/index.ts +1 -0
- package/src/providers/VersionProvider/VersionProvider.tsx +0 -2
- package/src/sections/Detail/Detail.stories.tsx +1 -1
- package/src/sections/Header/Header.stories.tsx +1 -1
- package/src/sections/Home/Home.stories.tsx +1 -1
- package/src/sections/SideBar/Sidebar.stories.tsx +1 -1
- package/src/sections/SideBar/Sidebar.test.tsx +0 -1
- package/src/test/test-react-testing-library.tsx +17 -12
- package/src/utils/url.test.ts +4 -0
- package/src/utils/url.ts +1 -1
|
@@ -1,25 +1,56 @@
|
|
|
1
1
|
import Box from '@mui/material/Box';
|
|
2
2
|
import Stack from '@mui/material/Stack';
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
4
|
import React from 'react';
|
|
4
5
|
|
|
5
6
|
import { default as FundButton } from '.';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
title: 'FundButton',
|
|
8
|
+
const meta: Meta<typeof FundButton> = {
|
|
9
|
+
title: 'Components/Sidebar/FundButton',
|
|
10
|
+
component: FundButton,
|
|
9
11
|
};
|
|
10
12
|
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
export default meta;
|
|
14
|
+
type Story = StoryObj<typeof FundButton>;
|
|
15
|
+
|
|
16
|
+
export const Primary: Story = {
|
|
17
|
+
name: 'Default',
|
|
18
|
+
render: () => {
|
|
19
|
+
return (
|
|
20
|
+
<Box sx={{ width: '100%' }}>
|
|
21
|
+
<Stack spacing={2}>
|
|
22
|
+
<FundButton
|
|
23
|
+
packageMeta={{
|
|
24
|
+
latest: {
|
|
25
|
+
funding: {
|
|
26
|
+
url: 'https://opencollective.com/verdaccio',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
}}
|
|
30
|
+
/>
|
|
31
|
+
</Stack>
|
|
32
|
+
</Box>
|
|
33
|
+
);
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const Bad: Story = {
|
|
38
|
+
name: 'Bad Link (empty)',
|
|
39
|
+
render: () => {
|
|
40
|
+
return (
|
|
41
|
+
<Box sx={{ width: '100%' }}>
|
|
42
|
+
<Stack spacing={2}>
|
|
43
|
+
<FundButton
|
|
44
|
+
packageMeta={{
|
|
45
|
+
latest: {
|
|
46
|
+
funding: {
|
|
47
|
+
url: 'bad_link',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
}}
|
|
51
|
+
/>
|
|
52
|
+
</Stack>
|
|
53
|
+
</Box>
|
|
54
|
+
);
|
|
55
|
+
},
|
|
56
|
+
};
|
|
@@ -1,34 +1,87 @@
|
|
|
1
|
+
/* eslint-disable react-hooks/rules-of-hooks */
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
1
3
|
import React from 'react';
|
|
2
4
|
|
|
3
5
|
import { default as Install } from '.';
|
|
4
6
|
import { useConfig } from '../../';
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
title: 'Install
|
|
8
|
+
const meta: Meta<typeof Install> = {
|
|
9
|
+
title: 'Components/Sidebar/Install',
|
|
10
|
+
component: Install,
|
|
8
11
|
};
|
|
9
12
|
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
13
|
+
export default meta;
|
|
14
|
+
type Story = StoryObj<typeof Install>;
|
|
15
|
+
|
|
16
|
+
const packageMeta = {
|
|
17
|
+
_uplinks: {},
|
|
18
|
+
latest: {
|
|
19
|
+
name: 'verdaccio-ui/local-storage',
|
|
20
|
+
version: '8.0.1-next.1',
|
|
21
|
+
dist: {
|
|
22
|
+
fileCount: 0,
|
|
23
|
+
unpackedSize: 0,
|
|
24
|
+
tarball: 'http://localhost:8080/bootstrap/-/bootstrap-4.3.1.tgz',
|
|
25
|
+
},
|
|
26
|
+
homepage: 'https://verdaccio.org',
|
|
27
|
+
bugs: {
|
|
28
|
+
url: 'https://github.com/verdaccio/monorepo/issues',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const Primary: Story = {
|
|
34
|
+
name: 'Default',
|
|
35
|
+
render: () => {
|
|
36
|
+
const { configOptions } = useConfig();
|
|
37
|
+
return (
|
|
38
|
+
<Install
|
|
39
|
+
configOptions={{ ...configOptions, pkgManagers: ['npm', 'yarn', 'pnpm'] }}
|
|
40
|
+
packageMeta={packageMeta}
|
|
41
|
+
packageName="jquery"
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const npmOnly: Story = {
|
|
48
|
+
name: 'Only NPM',
|
|
49
|
+
render: () => {
|
|
50
|
+
const { configOptions } = useConfig();
|
|
51
|
+
return (
|
|
52
|
+
<Install
|
|
53
|
+
configOptions={{ ...configOptions, pkgManagers: ['npm'] }}
|
|
54
|
+
packageMeta={packageMeta}
|
|
55
|
+
packageName="jquery"
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const yarnOnly: Story = {
|
|
62
|
+
name: 'Only Yarn',
|
|
63
|
+
render: () => {
|
|
64
|
+
const { configOptions } = useConfig();
|
|
65
|
+
return (
|
|
66
|
+
<Install
|
|
67
|
+
configOptions={{ ...configOptions, pkgManagers: ['yarn'] }}
|
|
68
|
+
packageMeta={packageMeta}
|
|
69
|
+
packageName="jquery"
|
|
70
|
+
/>
|
|
71
|
+
);
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const pnpmOnly: Story = {
|
|
76
|
+
name: 'Only Pnpm',
|
|
77
|
+
render: () => {
|
|
78
|
+
const { configOptions } = useConfig();
|
|
79
|
+
return (
|
|
80
|
+
<Install
|
|
81
|
+
configOptions={{ ...configOptions, pkgManagers: ['pnpm'] }}
|
|
82
|
+
packageMeta={packageMeta}
|
|
83
|
+
packageName="jquery"
|
|
84
|
+
/>
|
|
85
|
+
);
|
|
86
|
+
},
|
|
34
87
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
2
|
import { Typography } from '@mui/material';
|
|
3
|
+
import Grid from '@mui/material/Grid';
|
|
3
4
|
import List from '@mui/material/List';
|
|
5
|
+
import { useTheme } from '@mui/styles';
|
|
4
6
|
import React from 'react';
|
|
5
7
|
import { useTranslation } from 'react-i18next';
|
|
6
8
|
|
|
@@ -8,6 +10,7 @@ import { TemplateUIOptions } from '@verdaccio/types';
|
|
|
8
10
|
|
|
9
11
|
import { Theme } from '../../Theme';
|
|
10
12
|
import { PackageMetaInterface } from '../../types/packageMeta';
|
|
13
|
+
import { SettingsMenu } from '../SettingsMenu';
|
|
11
14
|
import InstallListItem, { DependencyManager } from './InstallListItem';
|
|
12
15
|
|
|
13
16
|
const StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({
|
|
@@ -23,30 +26,41 @@ export type Props = {
|
|
|
23
26
|
|
|
24
27
|
const Install: React.FC<Props> = ({ packageMeta, packageName, configOptions }) => {
|
|
25
28
|
const { t } = useTranslation();
|
|
29
|
+
const theme = useTheme();
|
|
26
30
|
|
|
27
31
|
if (!packageMeta || !packageName) {
|
|
28
32
|
return null;
|
|
29
33
|
}
|
|
34
|
+
|
|
30
35
|
const hasNpm = configOptions?.pkgManagers?.includes('npm');
|
|
31
36
|
const hasYarn = configOptions?.pkgManagers?.includes('yarn');
|
|
32
37
|
const hasPnpm = configOptions?.pkgManagers?.includes('pnpm') ?? true;
|
|
33
38
|
const hasPkgManagers = hasNpm || hasPnpm || hasYarn;
|
|
34
39
|
|
|
35
40
|
return hasPkgManagers ? (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
<>
|
|
42
|
+
<Grid
|
|
43
|
+
container={true}
|
|
44
|
+
justifyContent="flex-end"
|
|
45
|
+
sx={{ marginRight: theme.spacing(10), alingText: 'right' }}
|
|
46
|
+
>
|
|
47
|
+
<SettingsMenu packageName={packageName} />
|
|
48
|
+
</Grid>
|
|
49
|
+
<List
|
|
50
|
+
data-testid={'installList'}
|
|
51
|
+
subheader={<StyledText variant={'subtitle1'}>{t('sidebar.installation.title')}</StyledText>}
|
|
52
|
+
>
|
|
53
|
+
{hasNpm && (
|
|
54
|
+
<InstallListItem dependencyManager={DependencyManager.NPM} packageName={packageName} />
|
|
55
|
+
)}
|
|
56
|
+
{hasYarn && (
|
|
57
|
+
<InstallListItem dependencyManager={DependencyManager.YARN} packageName={packageName} />
|
|
58
|
+
)}
|
|
59
|
+
{hasPnpm && (
|
|
60
|
+
<InstallListItem dependencyManager={DependencyManager.PNPM} packageName={packageName} />
|
|
61
|
+
)}
|
|
62
|
+
</List>
|
|
63
|
+
</>
|
|
50
64
|
) : null;
|
|
51
65
|
};
|
|
52
66
|
|
|
@@ -5,6 +5,7 @@ import ListItemText from '@mui/material/ListItemText';
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
7
7
|
|
|
8
|
+
import { useSettings } from '../../providers/PersistenceSettingProvider';
|
|
8
9
|
import CopyToClipBoard from '../CopyClipboard';
|
|
9
10
|
import { Npm, Pnpm, Yarn } from '../Icons';
|
|
10
11
|
|
|
@@ -16,13 +17,13 @@ const InstallItem = styled(ListItem)({
|
|
|
16
17
|
});
|
|
17
18
|
|
|
18
19
|
const InstallListItemText = styled(ListItemText)({
|
|
19
|
-
padding: '0 10px',
|
|
20
|
+
padding: '0 0 0 10px',
|
|
20
21
|
margin: 0,
|
|
21
22
|
});
|
|
22
23
|
|
|
23
24
|
const PackageMangerAvatar = styled(Avatar)({
|
|
24
25
|
borderRadius: '0px',
|
|
25
|
-
padding:
|
|
26
|
+
padding: 0,
|
|
26
27
|
});
|
|
27
28
|
|
|
28
29
|
export enum DependencyManager {
|
|
@@ -38,6 +39,9 @@ interface Interface {
|
|
|
38
39
|
|
|
39
40
|
const InstallListItem: React.FC<Interface> = ({ packageName, dependencyManager }) => {
|
|
40
41
|
const { t } = useTranslation();
|
|
42
|
+
const { localSettings } = useSettings();
|
|
43
|
+
const isGlobal = localSettings[packageName]?.global ?? false;
|
|
44
|
+
const pkgName = isGlobal ? `-g ${packageName}` : packageName;
|
|
41
45
|
|
|
42
46
|
switch (dependencyManager) {
|
|
43
47
|
case DependencyManager.NPM:
|
|
@@ -50,8 +54,12 @@ const InstallListItem: React.FC<Interface> = ({ packageName, dependencyManager }
|
|
|
50
54
|
primary={
|
|
51
55
|
<CopyToClipBoard
|
|
52
56
|
dataTestId="installYarn"
|
|
53
|
-
text={t('sidebar.installation.install-using-npm-command', {
|
|
54
|
-
|
|
57
|
+
text={t('sidebar.installation.install-using-npm-command', {
|
|
58
|
+
packageName: pkgName,
|
|
59
|
+
})}
|
|
60
|
+
title={t('sidebar.installation.install-using-npm-command', {
|
|
61
|
+
packageName: pkgName,
|
|
62
|
+
})}
|
|
55
63
|
/>
|
|
56
64
|
}
|
|
57
65
|
secondary={t('sidebar.installation.install-using-npm')}
|
|
@@ -68,8 +76,12 @@ const InstallListItem: React.FC<Interface> = ({ packageName, dependencyManager }
|
|
|
68
76
|
primary={
|
|
69
77
|
<CopyToClipBoard
|
|
70
78
|
dataTestId="installYarn"
|
|
71
|
-
text={t('sidebar.installation.install-using-yarn-command', {
|
|
72
|
-
|
|
79
|
+
text={t('sidebar.installation.install-using-yarn-command', {
|
|
80
|
+
packageName: pkgName,
|
|
81
|
+
})}
|
|
82
|
+
title={t('sidebar.installation.install-using-yarn-command', {
|
|
83
|
+
packageName: pkgName,
|
|
84
|
+
})}
|
|
73
85
|
/>
|
|
74
86
|
}
|
|
75
87
|
secondary={t('sidebar.installation.install-using-yarn')}
|
|
@@ -86,8 +98,12 @@ const InstallListItem: React.FC<Interface> = ({ packageName, dependencyManager }
|
|
|
86
98
|
primary={
|
|
87
99
|
<CopyToClipBoard
|
|
88
100
|
dataTestId="installPnpm"
|
|
89
|
-
text={t('sidebar.installation.install-using-pnpm-command', {
|
|
90
|
-
|
|
101
|
+
text={t('sidebar.installation.install-using-pnpm-command', {
|
|
102
|
+
packageName: pkgName,
|
|
103
|
+
})}
|
|
104
|
+
title={t('sidebar.installation.install-using-pnpm-command', {
|
|
105
|
+
packageName: pkgName,
|
|
106
|
+
})}
|
|
91
107
|
/>
|
|
92
108
|
}
|
|
93
109
|
secondary={t('sidebar.installation.install-using-pnpm')}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
+
import Alert from '@mui/material/Alert';
|
|
1
2
|
import Typography from '@mui/material/Typography';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
|
|
4
5
|
interface Props {
|
|
5
6
|
text: string;
|
|
6
|
-
className?: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
const NoItems: React.FC<Props> = ({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
</Typography>
|
|
9
|
+
const NoItems: React.FC<Props> = ({ text, ...props }) => (
|
|
10
|
+
<Alert severity="info">
|
|
11
|
+
<Typography {...props}>{text}</Typography>
|
|
12
|
+
</Alert>
|
|
14
13
|
);
|
|
15
14
|
|
|
16
15
|
export default NoItems;
|
|
@@ -1,13 +1,39 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
|
|
3
4
|
import { default as Repository } from '.';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
title: 'Repository',
|
|
6
|
+
const meta: Meta<typeof Repository> = {
|
|
7
|
+
title: 'Components/Sidebar/Repository',
|
|
8
|
+
component: Repository,
|
|
7
9
|
};
|
|
10
|
+
export default meta;
|
|
11
|
+
type Story = StoryObj<typeof Repository>;
|
|
8
12
|
|
|
9
|
-
export const
|
|
10
|
-
|
|
13
|
+
export const Primary: Story = {
|
|
14
|
+
name: 'Git Repository',
|
|
15
|
+
render: () => {
|
|
16
|
+
return (
|
|
17
|
+
<Repository
|
|
18
|
+
packageMeta={{
|
|
19
|
+
_uplinks: {},
|
|
20
|
+
latest: {
|
|
21
|
+
name: 'verdaccio-ui/local-storage',
|
|
22
|
+
version: '8.0.1-next.1',
|
|
23
|
+
repository: {
|
|
24
|
+
type: 'git',
|
|
25
|
+
url: 'git://github.com/verdaccio/ui.git',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
}}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const HTTPS: Story = {
|
|
35
|
+
name: 'Https repo',
|
|
36
|
+
render: () => (
|
|
11
37
|
<Repository
|
|
12
38
|
packageMeta={{
|
|
13
39
|
_uplinks: {},
|
|
@@ -15,17 +41,18 @@ export const RepositoryGit: any = () => {
|
|
|
15
41
|
name: 'verdaccio-ui/local-storage',
|
|
16
42
|
version: '8.0.1-next.1',
|
|
17
43
|
repository: {
|
|
18
|
-
type: '
|
|
19
|
-
url: '
|
|
44
|
+
type: 'https',
|
|
45
|
+
url: 'https://github.com/verdaccio/ui.git',
|
|
20
46
|
},
|
|
21
47
|
},
|
|
22
48
|
}}
|
|
23
49
|
/>
|
|
24
|
-
)
|
|
50
|
+
),
|
|
25
51
|
};
|
|
26
52
|
|
|
27
|
-
export const
|
|
28
|
-
|
|
53
|
+
export const HTTP: Story = {
|
|
54
|
+
name: 'Http repo',
|
|
55
|
+
render: () => (
|
|
29
56
|
<Repository
|
|
30
57
|
packageMeta={{
|
|
31
58
|
_uplinks: {},
|
|
@@ -33,11 +60,11 @@ export const RepositoryHTTPS: any = () => {
|
|
|
33
60
|
name: 'verdaccio-ui/local-storage',
|
|
34
61
|
version: '8.0.1-next.1',
|
|
35
62
|
repository: {
|
|
36
|
-
type: '
|
|
37
|
-
url: '
|
|
63
|
+
type: 'http',
|
|
64
|
+
url: 'http://github.com/verdaccio/ui.git',
|
|
38
65
|
},
|
|
39
66
|
},
|
|
40
67
|
}}
|
|
41
68
|
/>
|
|
42
|
-
)
|
|
69
|
+
),
|
|
43
70
|
};
|
|
@@ -47,13 +47,11 @@ const RepositoryAvatar = styled(Avatar)({
|
|
|
47
47
|
|
|
48
48
|
const Repository: React.FC<{ packageMeta: any }> = ({ packageMeta }) => {
|
|
49
49
|
const { t } = useTranslation();
|
|
50
|
-
|
|
51
|
-
if (!
|
|
50
|
+
const url = packageMeta?.latest?.repository?.url;
|
|
51
|
+
if (!url || !urlUtils.isURL(url)) {
|
|
52
52
|
return null;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
const { url } = packageMeta.latest.repository;
|
|
56
|
-
|
|
57
55
|
const getCorrectRepositoryURL = (): string => {
|
|
58
56
|
if (!url.includes('git+')) {
|
|
59
57
|
return url;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import Check from '@mui/icons-material/Check';
|
|
2
|
+
import Settings from '@mui/icons-material/Settings';
|
|
3
|
+
import IconButton from '@mui/material/IconButton';
|
|
4
|
+
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
5
|
+
import Menu from '@mui/material/Menu';
|
|
6
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { useTranslation } from 'react-i18next';
|
|
9
|
+
|
|
10
|
+
import { useSettings } from '../../providers/PersistenceSettingProvider';
|
|
11
|
+
|
|
12
|
+
interface Props {
|
|
13
|
+
packageName: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const InstallListItem: React.FC<Props> = ({ packageName }) => {
|
|
17
|
+
const { t } = useTranslation();
|
|
18
|
+
const { localSettings, updateSettings } = useSettings();
|
|
19
|
+
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
|
|
20
|
+
const open = Boolean(anchorEl);
|
|
21
|
+
const handleOpenMenu = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
22
|
+
setAnchorEl(event.currentTarget);
|
|
23
|
+
};
|
|
24
|
+
const handleClick = () => {
|
|
25
|
+
const statusGlobal = !localSettings[packageName]?.global;
|
|
26
|
+
updateSettings({ [packageName]: { global: statusGlobal } });
|
|
27
|
+
setAnchorEl(null);
|
|
28
|
+
};
|
|
29
|
+
const handleClose = () => {
|
|
30
|
+
setAnchorEl(null);
|
|
31
|
+
};
|
|
32
|
+
return (
|
|
33
|
+
<>
|
|
34
|
+
<IconButton
|
|
35
|
+
aria-controls={open ? 'basic-menu' : undefined}
|
|
36
|
+
aria-expanded={open ? 'true' : undefined}
|
|
37
|
+
aria-haspopup="true"
|
|
38
|
+
id="basic-button"
|
|
39
|
+
onClick={handleOpenMenu}
|
|
40
|
+
size="small"
|
|
41
|
+
>
|
|
42
|
+
<Settings fontSize="small" />
|
|
43
|
+
</IconButton>
|
|
44
|
+
<Menu
|
|
45
|
+
MenuListProps={{
|
|
46
|
+
'aria-labelledby': 'basic-button',
|
|
47
|
+
}}
|
|
48
|
+
anchorEl={anchorEl}
|
|
49
|
+
id="basic-menu"
|
|
50
|
+
onClose={handleClose}
|
|
51
|
+
open={open}
|
|
52
|
+
>
|
|
53
|
+
<MenuItem onClick={handleClick}>
|
|
54
|
+
{' '}
|
|
55
|
+
{localSettings?.global ? (
|
|
56
|
+
<ListItemIcon>
|
|
57
|
+
<Check />
|
|
58
|
+
</ListItemIcon>
|
|
59
|
+
) : null}
|
|
60
|
+
{t('sidebar.installation.global')}
|
|
61
|
+
</MenuItem>
|
|
62
|
+
</Menu>
|
|
63
|
+
</>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default InstallListItem;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SettingsMenu } from './SettingsMenu';
|