@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
package/build/utils/utils.js
CHANGED
|
@@ -17,11 +17,11 @@ var _localizedFormat = _interopRequireDefault(require("dayjs/plugin/localizedFor
|
|
|
17
17
|
var _relativeTime = _interopRequireDefault(require("dayjs/plugin/relativeTime"));
|
|
18
18
|
var _i18next = _interopRequireDefault(require("i18next"));
|
|
19
19
|
var _isString = _interopRequireDefault(require("lodash/isString"));
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {
|
|
21
|
-
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
const TIMEFORMAT = 'L LTS';
|
|
22
22
|
exports.TIMEFORMAT = TIMEFORMAT;
|
|
23
|
-
_dayjs
|
|
24
|
-
_dayjs
|
|
23
|
+
_dayjs.default.extend(_relativeTime.default);
|
|
24
|
+
_dayjs.default.extend(_localizedFormat.default);
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Formats license field for webui.
|
|
@@ -30,7 +30,7 @@ _dayjs["default"].extend(_localizedFormat["default"]);
|
|
|
30
30
|
// License should use type License defined above, but conflicts with the unit test that provide array or empty object
|
|
31
31
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
32
32
|
function formatLicense(license) {
|
|
33
|
-
if ((0, _isString
|
|
33
|
+
if ((0, _isString.default)(license)) {
|
|
34
34
|
return license;
|
|
35
35
|
}
|
|
36
36
|
if (license !== null && license !== void 0 && license.type) {
|
|
@@ -46,7 +46,7 @@ function formatLicense(license) {
|
|
|
46
46
|
// Repository should use type Repository defined above, but conflicts with the unit test that provide array or empty object
|
|
47
47
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
48
48
|
function formatRepository(repository) {
|
|
49
|
-
if ((0, _isString
|
|
49
|
+
if ((0, _isString.default)(repository)) {
|
|
50
50
|
return repository;
|
|
51
51
|
}
|
|
52
52
|
if (repository !== null && repository !== void 0 && repository.url) {
|
|
@@ -55,21 +55,20 @@ function formatRepository(repository) {
|
|
|
55
55
|
return null;
|
|
56
56
|
}
|
|
57
57
|
function formatDate(lastUpdate) {
|
|
58
|
-
return (0, _dayjs
|
|
58
|
+
return (0, _dayjs.default)(new Date(lastUpdate)).format(TIMEFORMAT);
|
|
59
59
|
}
|
|
60
60
|
function formatDateDistance(lastUpdate) {
|
|
61
|
-
return (0, _dayjs
|
|
61
|
+
return (0, _dayjs.default)(new Date(lastUpdate)).fromNow();
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* For <LastSync /> component
|
|
66
66
|
* @param {array} uplinks
|
|
67
67
|
*/
|
|
68
|
-
function getLastUpdatedPackageTime() {
|
|
69
|
-
|
|
70
|
-
var lastUpdate = 0;
|
|
68
|
+
function getLastUpdatedPackageTime(uplinks = {}) {
|
|
69
|
+
let lastUpdate = 0;
|
|
71
70
|
Object.keys(uplinks).forEach(function computeUplink(upLinkName) {
|
|
72
|
-
|
|
71
|
+
const status = uplinks[upLinkName];
|
|
73
72
|
if (status.fetched > lastUpdate) {
|
|
74
73
|
lastUpdate = status.fetched;
|
|
75
74
|
}
|
|
@@ -82,22 +81,19 @@ function getLastUpdatedPackageTime() {
|
|
|
82
81
|
* @param {Object} time
|
|
83
82
|
* @returns {Array} last 3 releases
|
|
84
83
|
*/
|
|
85
|
-
function getRecentReleases() {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
time: formatDate(time[version])
|
|
91
|
-
};
|
|
92
|
-
});
|
|
84
|
+
function getRecentReleases(time = {}) {
|
|
85
|
+
const recent = Object.keys(time).map(version => ({
|
|
86
|
+
version,
|
|
87
|
+
time: formatDate(time[version])
|
|
88
|
+
}));
|
|
93
89
|
return recent.slice(recent.length - 3, recent.length).reverse();
|
|
94
90
|
}
|
|
95
91
|
function getAuthorName(authorName) {
|
|
96
92
|
if (!authorName) {
|
|
97
|
-
return _i18next
|
|
93
|
+
return _i18next.default.t('author-unknown');
|
|
98
94
|
}
|
|
99
95
|
if (authorName.toLowerCase() === 'anonymous') {
|
|
100
|
-
return _i18next
|
|
96
|
+
return _i18next.default.t('author-anonymous');
|
|
101
97
|
}
|
|
102
98
|
return authorName;
|
|
103
99
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdaccio/ui-components",
|
|
3
|
-
"version": "2.0.0-6-next.
|
|
3
|
+
"version": "2.0.0-6-next.10",
|
|
4
4
|
"description": "theme ui component",
|
|
5
5
|
"author": "Juan Picado <juanpicado19@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@emotion/react": "^11.10.6",
|
|
12
12
|
"@emotion/styled": "^11.10.6",
|
|
13
|
+
"@fontsource/material-icons": "^4.5.4",
|
|
14
|
+
"@fontsource/roboto": "^4.5.8",
|
|
13
15
|
"@mui/icons-material": "5.11.16",
|
|
14
16
|
"@mui/material": "5.12.0",
|
|
15
17
|
"@mui/styles": "5.12.0",
|
|
@@ -17,8 +19,6 @@
|
|
|
17
19
|
"@rematch/core": "2.2.0",
|
|
18
20
|
"@rematch/loading": "2.1.2",
|
|
19
21
|
"@rematch/persist": "2.1.2",
|
|
20
|
-
"@fontsource/material-icons": "^4.5.4",
|
|
21
|
-
"@fontsource/roboto": "^4.5.8",
|
|
22
22
|
"country-flag-icons": "1.5.5",
|
|
23
23
|
"dayjs": "1.11.7",
|
|
24
24
|
"dompurify": "2.4.5",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"i18next": "20.6.1",
|
|
29
29
|
"localstorage-memory": "1.0.3",
|
|
30
30
|
"lodash": "4.17.21",
|
|
31
|
-
"marked": "4.
|
|
31
|
+
"marked": "4.3.0",
|
|
32
32
|
"normalize.css": "8.0.1",
|
|
33
33
|
"react": "18.2.0",
|
|
34
34
|
"react-dom": "18.2.0",
|
|
@@ -45,7 +45,6 @@
|
|
|
45
45
|
"validator": "13.9.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@verdaccio/types": "11.0.0-6-next.25",
|
|
49
48
|
"@babel/core": "^7.20.7",
|
|
50
49
|
"@emotion/babel-plugin": "11.10.6",
|
|
51
50
|
"@emotion/jest": "11.10.5",
|
|
@@ -63,6 +62,7 @@
|
|
|
63
62
|
"@types/hast": "^2.0.0",
|
|
64
63
|
"@types/react-router": "^5.1.20",
|
|
65
64
|
"@types/unist": "^2.0.0",
|
|
65
|
+
"@verdaccio/types": "11.0.0-6-next.25",
|
|
66
66
|
"babel-loader": "^8.3.0",
|
|
67
67
|
"mockdate": "3.0.5",
|
|
68
68
|
"msw": "0.49.2"
|
|
@@ -1,50 +1,64 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { clone, merge } from 'lodash';
|
|
1
3
|
import React from 'react';
|
|
2
4
|
|
|
3
5
|
import { default as ActionBar } from '.';
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
title: 'ActionBar
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
export const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
7
|
+
const meta: Meta<typeof ActionBar> = {
|
|
8
|
+
title: 'Components/Sidebar/ActionBar',
|
|
9
|
+
component: ActionBar,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof ActionBar>;
|
|
14
|
+
|
|
15
|
+
const packageMeta = {
|
|
16
|
+
_uplinks: {},
|
|
17
|
+
latest: {
|
|
18
|
+
name: 'verdaccio-ui/local-storage',
|
|
19
|
+
version: '8.0.1-next.1',
|
|
20
|
+
dist: {
|
|
21
|
+
fileCount: 0,
|
|
22
|
+
unpackedSize: 0,
|
|
23
|
+
tarball: 'https://registry.verdaccio.org/storybook/-/storybook-0.2.0.tgz',
|
|
24
|
+
},
|
|
25
|
+
homepage: 'https://verdaccio.org',
|
|
26
|
+
bugs: {
|
|
27
|
+
url: 'https://github.com/verdaccio/monorepo/issues',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const Primary: Story = {
|
|
33
|
+
name: 'Default',
|
|
34
|
+
render: () => <ActionBar packageMeta={packageMeta} />,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const Raw: Story = {
|
|
38
|
+
name: 'Raw viewer',
|
|
39
|
+
render: () => <ActionBar packageMeta={packageMeta} showRaw={true} />,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const NoLatest: Story = {
|
|
43
|
+
name: 'No latest (empty)',
|
|
44
|
+
render: () => <ActionBar packageMeta={{}} showRaw={true} />,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const Download: Story = {
|
|
48
|
+
name: 'No show download',
|
|
49
|
+
render: () => <ActionBar packageMeta={{ ...clone(packageMeta) }} showDownloadTarball={false} />,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const Home: Story = {
|
|
53
|
+
name: 'No home',
|
|
54
|
+
render: () => (
|
|
55
|
+
<ActionBar packageMeta={{ ...merge(clone(packageMeta), { latest: { homepage: null } }) }} />
|
|
56
|
+
),
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const Bugs: Story = {
|
|
60
|
+
name: 'No bugs',
|
|
61
|
+
render: () => (
|
|
62
|
+
<ActionBar packageMeta={{ ...merge(clone(packageMeta), { latest: { bugs: null } }) }} />
|
|
63
|
+
),
|
|
64
|
+
};
|
|
@@ -34,12 +34,12 @@ function CopyToClipBoard({ text, children, dataTestId, title, ...props }: Props)
|
|
|
34
34
|
<Content>{children ?? text}</Content>
|
|
35
35
|
{title ? (
|
|
36
36
|
<Tooltip disableFocusListener={true} title={title}>
|
|
37
|
-
<IconButton data-testid={dataTestId} onClick={copyToClipBoardUtility(text)} size="
|
|
37
|
+
<IconButton data-testid={dataTestId} onClick={copyToClipBoardUtility(text)} size="small">
|
|
38
38
|
<FileCopy fontSize="small" />
|
|
39
39
|
</IconButton>
|
|
40
40
|
</Tooltip>
|
|
41
41
|
) : (
|
|
42
|
-
<IconButton data-testid={dataTestId} onClick={copyToClipBoardUtility(text)} size="
|
|
42
|
+
<IconButton data-testid={dataTestId} onClick={copyToClipBoardUtility(text)} size="small">
|
|
43
43
|
<FileCopy fontSize="small" />
|
|
44
44
|
</IconButton>
|
|
45
45
|
)}
|
|
@@ -1,58 +1,158 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
|
|
3
4
|
import { default as Dependencies } from '.';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
title: 'Dependencies
|
|
6
|
+
const meta: Meta<typeof Dependencies> = {
|
|
7
|
+
title: 'Components/Detail/Dependencies',
|
|
8
|
+
component: Dependencies,
|
|
7
9
|
};
|
|
8
10
|
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
packageMeta={{
|
|
12
|
-
latest: {
|
|
13
|
-
name: 'verdaccio',
|
|
14
|
-
version: '4.0.0',
|
|
15
|
-
author: {
|
|
16
|
-
name: 'verdaccio user',
|
|
17
|
-
email: 'verdaccio.user@verdaccio.org',
|
|
18
|
-
url: '',
|
|
19
|
-
avatar: 'https://www.gravatar.com/avatar/000000',
|
|
20
|
-
},
|
|
21
|
-
dist: { fileCount: 0, unpackedSize: 0 },
|
|
22
|
-
dependencies: {
|
|
23
|
-
react: '16.9.0',
|
|
24
|
-
'react-dom': '16.9.0',
|
|
25
|
-
},
|
|
26
|
-
devDependencies: {
|
|
27
|
-
'babel-core': '7.0.0-beta6',
|
|
28
|
-
},
|
|
29
|
-
peerDependencies: {
|
|
30
|
-
'styled-components': '5.0.0',
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
_uplinks: {},
|
|
34
|
-
}}
|
|
35
|
-
/>
|
|
36
|
-
);
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof Dependencies>;
|
|
37
13
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
14
|
+
const packageMeta = {
|
|
15
|
+
latest: {
|
|
16
|
+
name: 'verdaccio',
|
|
17
|
+
version: '4.0.0',
|
|
18
|
+
author: {
|
|
19
|
+
name: 'verdaccio user',
|
|
20
|
+
email: 'verdaccio.user@verdaccio.org',
|
|
21
|
+
url: '',
|
|
22
|
+
avatar: 'https://www.gravatar.com/avatar/000000',
|
|
23
|
+
},
|
|
24
|
+
dist: { fileCount: 0, unpackedSize: 0 },
|
|
25
|
+
dependencies: {
|
|
26
|
+
react: '16.9.0',
|
|
27
|
+
'react-dom': '16.9.0',
|
|
28
|
+
'@storybook/codemod': '^3.2.6',
|
|
29
|
+
chalk: '^2.1.0',
|
|
30
|
+
'child-process-promise': '^2.2.1',
|
|
31
|
+
commander: '^2.11.0',
|
|
32
|
+
'cross-spawn': '^5.0.1',
|
|
33
|
+
jscodeshift: '^0.3.30',
|
|
34
|
+
json5: '^0.5.1',
|
|
35
|
+
'latest-version': '^3.1.0',
|
|
36
|
+
'merge-dirs': '^0.2.1',
|
|
37
|
+
opencollective: '^1.0.3',
|
|
38
|
+
shelljs: '^0.7.8',
|
|
39
|
+
'update-notifier': '^2.1.0',
|
|
40
|
+
},
|
|
41
|
+
devDependencies: {
|
|
42
|
+
'babel-core': '7.0.0-beta6',
|
|
43
|
+
'cross-spawn': '^5.0.1',
|
|
44
|
+
jscodeshift: '^0.3.30',
|
|
45
|
+
json5: '^0.5.1',
|
|
46
|
+
'latest-version': '^3.1.0',
|
|
47
|
+
'merge-dirs': '^0.2.1',
|
|
48
|
+
opencollective: '^1.0.3',
|
|
49
|
+
shelljs: '^0.7.8',
|
|
50
|
+
'update-notifier': '^2.1.0',
|
|
51
|
+
},
|
|
52
|
+
peerDependencies: {
|
|
53
|
+
'styled-components': '5.0.0',
|
|
54
|
+
'cross-spawn': '^5.0.1',
|
|
55
|
+
jscodeshift: '^0.3.30',
|
|
56
|
+
json5: '^0.5.1',
|
|
57
|
+
'latest-version': '^3.1.0',
|
|
58
|
+
'merge-dirs': '^0.2.1',
|
|
59
|
+
opencollective: '^1.0.3',
|
|
60
|
+
shelljs: '^0.7.8',
|
|
61
|
+
'update-notifier': '^2.1.0',
|
|
62
|
+
},
|
|
63
|
+
optionalDependencies: {
|
|
64
|
+
'styled-components': '5.0.0',
|
|
65
|
+
'cross-spawn': '^5.0.1',
|
|
66
|
+
jscodeshift: '^0.3.30',
|
|
67
|
+
json5: '^0.5.1',
|
|
68
|
+
'latest-version': '^3.1.0',
|
|
69
|
+
'merge-dirs': '^0.2.1',
|
|
70
|
+
opencollective: '^1.0.3',
|
|
71
|
+
shelljs: '^0.7.8',
|
|
72
|
+
'update-notifier': '^2.1.0',
|
|
73
|
+
},
|
|
74
|
+
bundleDependencies: {
|
|
75
|
+
'styled-components': '5.0.0',
|
|
76
|
+
'cross-spawn': '^5.0.1',
|
|
77
|
+
jscodeshift: '^0.3.30',
|
|
78
|
+
json5: '^0.5.1',
|
|
79
|
+
'latest-version': '^3.1.0',
|
|
80
|
+
'merge-dirs': '^0.2.1',
|
|
81
|
+
opencollective: '^1.0.3',
|
|
82
|
+
shelljs: '^0.7.8',
|
|
83
|
+
'update-notifier': '^2.1.0',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
_uplinks: {},
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const Primary: Story = {
|
|
90
|
+
name: 'Default',
|
|
91
|
+
render: () => {
|
|
92
|
+
return <Dependencies packageMeta={packageMeta} />;
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export const OnlyDeps: Story = {
|
|
97
|
+
name: 'Only dependencies',
|
|
98
|
+
render: () => {
|
|
99
|
+
return (
|
|
100
|
+
<Dependencies
|
|
101
|
+
packageMeta={{
|
|
102
|
+
latest: {
|
|
103
|
+
name: 'verdaccio',
|
|
104
|
+
version: '4.0.0',
|
|
105
|
+
author: {
|
|
106
|
+
name: 'verdaccio user',
|
|
107
|
+
email: 'verdaccio.user@verdaccio.org',
|
|
108
|
+
url: '',
|
|
109
|
+
avatar: 'https://www.gravatar.com/avatar/000000',
|
|
110
|
+
},
|
|
111
|
+
dist: { fileCount: 0, unpackedSize: 0 },
|
|
112
|
+
dependencies: {
|
|
113
|
+
'styled-components': '5.0.0',
|
|
114
|
+
'cross-spawn': '^5.0.1',
|
|
115
|
+
jscodeshift: '^0.3.30',
|
|
116
|
+
json5: '^0.5.1',
|
|
117
|
+
'latest-version': '^3.1.0',
|
|
118
|
+
'merge-dirs': '^0.2.1',
|
|
119
|
+
opencollective: '^1.0.3',
|
|
120
|
+
shelljs: '^0.7.8',
|
|
121
|
+
'update-notifier': '^2.1.0',
|
|
122
|
+
},
|
|
123
|
+
devDependencies: { jscodeshift: '^0.3.30', json5: '^0.5.1' },
|
|
124
|
+
peerDependencies: {},
|
|
125
|
+
},
|
|
126
|
+
_uplinks: {},
|
|
127
|
+
}}
|
|
128
|
+
/>
|
|
129
|
+
);
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export const NoDependencies: Story = {
|
|
134
|
+
name: 'No dependencies',
|
|
135
|
+
render: () => {
|
|
136
|
+
return (
|
|
137
|
+
<Dependencies
|
|
138
|
+
packageMeta={{
|
|
139
|
+
latest: {
|
|
140
|
+
name: 'verdaccio',
|
|
141
|
+
version: '4.0.0',
|
|
142
|
+
author: {
|
|
143
|
+
name: 'verdaccio user',
|
|
144
|
+
email: 'verdaccio.user@verdaccio.org',
|
|
145
|
+
url: '',
|
|
146
|
+
avatar: 'https://www.gravatar.com/avatar/000000',
|
|
147
|
+
},
|
|
148
|
+
dist: { fileCount: 0, unpackedSize: 0 },
|
|
149
|
+
dependencies: {},
|
|
150
|
+
devDependencies: {},
|
|
151
|
+
peerDependencies: {},
|
|
152
|
+
},
|
|
153
|
+
_uplinks: {},
|
|
154
|
+
}}
|
|
155
|
+
/>
|
|
156
|
+
);
|
|
157
|
+
},
|
|
158
|
+
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import Box from '@mui/material/Box';
|
|
1
2
|
import CardContent from '@mui/material/CardContent';
|
|
3
|
+
import { useTheme } from '@mui/styles';
|
|
2
4
|
import React from 'react';
|
|
3
5
|
import { useTranslation } from 'react-i18next';
|
|
4
6
|
import { useHistory } from 'react-router-dom';
|
|
@@ -10,44 +12,38 @@ import { CardWrap, StyledText, Tag, Tags } from './styles';
|
|
|
10
12
|
interface DependencyBlockProps {
|
|
11
13
|
title: string;
|
|
12
14
|
dependencies: PackageDependencies;
|
|
13
|
-
enableLoading?: () => void;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
const DependencyBlock: React.FC<DependencyBlockProps> = ({
|
|
17
|
-
title,
|
|
18
|
-
dependencies,
|
|
19
|
-
enableLoading,
|
|
20
|
-
}) => {
|
|
17
|
+
const DependencyBlock: React.FC<DependencyBlockProps> = ({ title, dependencies }) => {
|
|
21
18
|
const history = useHistory();
|
|
22
19
|
const { t } = useTranslation();
|
|
20
|
+
const theme = useTheme();
|
|
23
21
|
|
|
24
22
|
const deps = Object.entries(dependencies);
|
|
25
23
|
|
|
26
24
|
function handleClick(name: string): void {
|
|
27
|
-
enableLoading?.();
|
|
28
|
-
|
|
29
25
|
history.push(`/-/web/detail/${name}`);
|
|
30
26
|
}
|
|
31
27
|
|
|
32
28
|
return (
|
|
33
|
-
<
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
</
|
|
50
|
-
</
|
|
29
|
+
<Box data-testid={title} sx={{ margin: theme.spacing(2) }}>
|
|
30
|
+
<StyledText sx={{ marginBottom: theme.spacing(1) }} variant="subtitle1">
|
|
31
|
+
{`${title} (${deps.length})`}
|
|
32
|
+
</StyledText>
|
|
33
|
+
<Tags>
|
|
34
|
+
{deps.map(([name, version]) => (
|
|
35
|
+
<Tag
|
|
36
|
+
className={'dep-tag'}
|
|
37
|
+
clickable={true}
|
|
38
|
+
data-testid={name}
|
|
39
|
+
key={name}
|
|
40
|
+
label={t('dependencies.dependency-block', { package: name, version })}
|
|
41
|
+
// eslint-disable-next-line
|
|
42
|
+
onClick={() => handleClick(name)}
|
|
43
|
+
/>
|
|
44
|
+
))}
|
|
45
|
+
</Tags>
|
|
46
|
+
</Box>
|
|
51
47
|
);
|
|
52
48
|
};
|
|
53
49
|
|
|
@@ -65,37 +61,51 @@ const Dependencies: React.FC<{ packageMeta: any }> = ({ packageMeta }) => {
|
|
|
65
61
|
const { latest } = packageMeta;
|
|
66
62
|
// FIXME: add dependencies to package meta type
|
|
67
63
|
// @ts-ignore
|
|
68
|
-
const {
|
|
69
|
-
|
|
64
|
+
const {
|
|
65
|
+
dependencies,
|
|
66
|
+
devDependencies,
|
|
67
|
+
peerDependencies,
|
|
68
|
+
optionalDependencies,
|
|
69
|
+
bundleDependencies,
|
|
70
|
+
name,
|
|
71
|
+
} = latest;
|
|
72
|
+
const dependencyMap = {
|
|
73
|
+
dependencies,
|
|
74
|
+
devDependencies,
|
|
75
|
+
peerDependencies,
|
|
76
|
+
bundleDependencies,
|
|
77
|
+
optionalDependencies,
|
|
78
|
+
};
|
|
70
79
|
const hasDependencies =
|
|
71
|
-
hasKeys(dependencies) ||
|
|
72
|
-
|
|
80
|
+
hasKeys(dependencies) ||
|
|
81
|
+
hasKeys(bundleDependencies) ||
|
|
82
|
+
hasKeys(optionalDependencies) ||
|
|
83
|
+
hasKeys(devDependencies) ||
|
|
84
|
+
hasKeys(peerDependencies);
|
|
73
85
|
if (hasDependencies) {
|
|
74
86
|
return (
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
<CardWrap>
|
|
88
|
+
<CardContent>
|
|
89
|
+
{Object.entries(dependencyMap).map(([dependencyType, dependencies]) => {
|
|
90
|
+
if (!dependencies || Object.keys(dependencies).length === 0) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
return (
|
|
94
|
+
<>
|
|
95
|
+
<DependencyBlock
|
|
96
|
+
dependencies={dependencies}
|
|
97
|
+
key={dependencyType}
|
|
98
|
+
title={dependencyType}
|
|
99
|
+
/>
|
|
100
|
+
</>
|
|
101
|
+
);
|
|
102
|
+
})}
|
|
103
|
+
</CardContent>
|
|
104
|
+
</CardWrap>
|
|
90
105
|
);
|
|
91
106
|
}
|
|
92
107
|
|
|
93
|
-
return (
|
|
94
|
-
<NoItems
|
|
95
|
-
className="no-dependencies"
|
|
96
|
-
text={t('dependencies.has-no-dependencies', { package: name })}
|
|
97
|
-
/>
|
|
98
|
-
);
|
|
108
|
+
return <NoItems text={t('dependencies.has-no-dependencies', { package: name })} />;
|
|
99
109
|
};
|
|
100
110
|
|
|
101
111
|
export default Dependencies;
|