@bundle-stats/ui 3.2.4-alpha.0 → 3.2.5-alpha.17
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 +50 -1
- package/lib/components/bundle-assets/bundle-assets.js +7 -9
- package/lib/components/bundle-assets/bundle-assets.module.css +0 -5
- package/lib/components/bundle-modules/bundle-modules.js +63 -34
- package/lib/components/bundle-modules/bundle-modules.module.css +4 -0
- package/lib/components/bundle-packages/bundle-packages.js +24 -29
- package/lib/components/bundle-packages/bundle-packages.module.css +20 -37
- package/lib/components/metrics-table-title/metrics-table-title.js +3 -7
- package/lib/components/summary-item/summary-item.js +18 -16
- package/lib/components/total-size-type-title/total-size-type-title.js +3 -7
- package/lib/ui/dropdown/dropdown.js +19 -15
- package/lib/ui/filters/filters.js +5 -3
- package/lib/ui/index.js +8 -8
- package/lib/ui/{hover-card → popover}/index.js +4 -4
- package/lib/ui/popover/popover.js +92 -0
- package/lib/ui/popover/popover.module.css +66 -0
- package/lib/ui/popover/popover.stories.js +26 -0
- package/lib/ui/sort-dropdown/sort-dropdown.js +5 -2
- package/lib/ui/tooltip/tooltip.js +14 -22
- package/lib/ui/tooltip/tooltip.module.css +3 -5
- package/lib-esm/components/bundle-assets/bundle-assets.js +7 -9
- package/lib-esm/components/bundle-assets/bundle-assets.module.css +0 -5
- package/lib-esm/components/bundle-modules/bundle-modules.js +29 -17
- package/lib-esm/components/bundle-modules/bundle-modules.module.css +4 -0
- package/lib-esm/components/bundle-packages/bundle-packages.js +23 -28
- package/lib-esm/components/bundle-packages/bundle-packages.module.css +20 -37
- package/lib-esm/components/metrics-table-title/metrics-table-title.js +3 -6
- package/lib-esm/components/summary-item/summary-item.js +18 -15
- package/lib-esm/components/total-size-type-title/total-size-type-title.js +3 -6
- package/lib-esm/ui/dropdown/dropdown.js +19 -9
- package/lib-esm/ui/filters/filters.js +5 -3
- package/lib-esm/ui/index.js +1 -1
- package/lib-esm/ui/popover/index.js +1 -0
- package/lib-esm/ui/popover/popover.js +71 -0
- package/lib-esm/ui/popover/popover.module.css +66 -0
- package/lib-esm/ui/popover/popover.stories.js +14 -0
- package/lib-esm/ui/sort-dropdown/sort-dropdown.js +5 -2
- package/lib-esm/ui/tooltip/tooltip.js +14 -15
- package/lib-esm/ui/tooltip/tooltip.module.css +3 -5
- package/package.json +13 -15
- package/src/components/bundle-assets/bundle-assets.jsx +42 -51
- package/src/components/bundle-assets/bundle-assets.module.css +0 -5
- package/src/components/bundle-modules/bundle-modules.jsx +31 -28
- package/src/components/bundle-modules/bundle-modules.module.css +4 -0
- package/src/components/bundle-packages/bundle-packages.jsx +25 -31
- package/src/components/bundle-packages/bundle-packages.module.css +20 -37
- package/src/components/metrics-table-options/metrics-table-options.jsx +1 -1
- package/src/components/metrics-table-title/metrics-table-title.jsx +3 -4
- package/src/components/summary-item/summary-item.jsx +26 -21
- package/src/components/total-size-type-title/total-size-type-title.jsx +9 -6
- package/src/ui/dropdown/dropdown.jsx +18 -14
- package/src/ui/filters/filters.jsx +39 -30
- package/src/ui/index.js +1 -1
- package/src/ui/popover/index.js +1 -0
- package/src/ui/popover/popover.jsx +79 -0
- package/src/ui/popover/popover.module.css +66 -0
- package/src/ui/sort-dropdown/sort-dropdown.jsx +11 -9
- package/src/ui/tooltip/tooltip.jsx +27 -20
- package/src/ui/tooltip/tooltip.module.css +3 -5
- package/lib/ui/hover-card/hover-card.js +0 -65
- package/lib/ui/hover-card/hover-card.module.css +0 -29
- package/lib/ui/hover-card/hover-card.stories.js +0 -26
- package/lib-esm/ui/hover-card/hover-card.js +0 -45
- package/lib-esm/ui/hover-card/hover-card.module.css +0 -29
- package/lib-esm/ui/hover-card/hover-card.stories.js +0 -9
- package/lib-esm/ui/hover-card/index.js +0 -1
- package/src/ui/hover-card/hover-card.jsx +0 -42
- package/src/ui/hover-card/hover-card.module.css +0 -29
- package/src/ui/hover-card/index.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bundle-stats/ui",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.5-alpha.17",
|
|
4
4
|
"description": "UI components for BundleStats projects.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-esm/index.js",
|
|
@@ -37,23 +37,24 @@
|
|
|
37
37
|
"homepage": "https://github.com/relative-ci/bundle-stats/blob/master/packages/ui#readme",
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@babel/cli": "7.16.8",
|
|
40
|
-
"@babel/core": "7.16.
|
|
40
|
+
"@babel/core": "7.16.12",
|
|
41
41
|
"@babel/plugin-proposal-class-properties": "7.16.7",
|
|
42
|
-
"@babel/preset-env": "7.16.
|
|
42
|
+
"@babel/preset-env": "7.16.11",
|
|
43
43
|
"@babel/preset-react": "7.16.7",
|
|
44
44
|
"@simplyianm/babel-plugin-inline-react-svg": "1.2.0",
|
|
45
|
+
"@storybook/addon-essentials": "6.4.14",
|
|
45
46
|
"@storybook/addon-knobs": "6.4.0",
|
|
46
47
|
"@storybook/addon-postcss": "2.0.0",
|
|
47
|
-
"@storybook/addon-storyshots": "6.4.
|
|
48
|
-
"@storybook/addons": "6.4.
|
|
49
|
-
"@storybook/builder-webpack5": "6.4.
|
|
50
|
-
"@storybook/manager-webpack5": "6.4.
|
|
51
|
-
"@storybook/react": "6.4.
|
|
48
|
+
"@storybook/addon-storyshots": "6.4.14",
|
|
49
|
+
"@storybook/addons": "6.4.14",
|
|
50
|
+
"@storybook/builder-webpack5": "6.4.14",
|
|
51
|
+
"@storybook/manager-webpack5": "6.4.14",
|
|
52
|
+
"@storybook/react": "6.4.14",
|
|
52
53
|
"babel-core": "7.0.0-bridge.0",
|
|
53
54
|
"babel-jest": "27.4.6",
|
|
54
55
|
"babel-plugin-lodash": "3.3.4",
|
|
55
56
|
"babel-plugin-require-context-hook": "1.0.0",
|
|
56
|
-
"chromatic": "6.
|
|
57
|
+
"chromatic": "6.4.1",
|
|
57
58
|
"classnames": "2.3.1",
|
|
58
59
|
"colormap": "2.3.2",
|
|
59
60
|
"core-js": "3.20.2",
|
|
@@ -76,7 +77,7 @@
|
|
|
76
77
|
},
|
|
77
78
|
"peerDependencies": {
|
|
78
79
|
"classnames": "2.2.6",
|
|
79
|
-
"core-js": "3.
|
|
80
|
+
"core-js": "3.20.2",
|
|
80
81
|
"lodash": "4.17.21",
|
|
81
82
|
"prop-types": "15.7.2",
|
|
82
83
|
"react": "16.14.0",
|
|
@@ -84,14 +85,11 @@
|
|
|
84
85
|
"react-router-dom": "5.3.0"
|
|
85
86
|
},
|
|
86
87
|
"dependencies": {
|
|
87
|
-
"@bundle-stats/utils": "^3.2.
|
|
88
|
-
"@radix-ui/react-dropdown-menu": "0.1.3",
|
|
89
|
-
"@radix-ui/react-hover-card": "0.1.3",
|
|
90
|
-
"@radix-ui/react-tooltip": "0.1.3",
|
|
88
|
+
"@bundle-stats/utils": "^3.2.5-alpha.17",
|
|
91
89
|
"date-fns": "2.28.0",
|
|
92
90
|
"query-string": "7.1.0",
|
|
93
91
|
"reakit": "1.3.11",
|
|
94
92
|
"use-query-params": "1.2.3"
|
|
95
93
|
},
|
|
96
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "a93ac0ad27f04d5b3e9da9a91b2b6cac3d8f2b33"
|
|
97
95
|
}
|
|
@@ -2,19 +2,14 @@ import React, { useMemo } from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
import { get, map } from 'lodash';
|
|
5
|
-
import {
|
|
6
|
-
ASSET_ENTRY_TYPE,
|
|
7
|
-
ASSET_FILE_TYPE,
|
|
8
|
-
ASSET_FILTERS,
|
|
9
|
-
FILE_TYPE_LABELS,
|
|
10
|
-
} from '@bundle-stats/utils';
|
|
5
|
+
import { ASSET_ENTRY_TYPE, ASSET_FILE_TYPE, ASSET_FILTERS, FILE_TYPE_LABELS } from '@bundle-stats/utils';
|
|
11
6
|
|
|
12
7
|
import config from '../../config.json';
|
|
13
8
|
import I18N from '../../i18n';
|
|
14
9
|
import { FlexStack } from '../../layout/flex-stack';
|
|
15
10
|
import { Icon } from '../../ui/icon';
|
|
16
11
|
import { FileName } from '../../ui/file-name';
|
|
17
|
-
import {
|
|
12
|
+
import { Popover } from '../../ui/popover';
|
|
18
13
|
import { Tooltip } from '../../ui/tooltip';
|
|
19
14
|
import { Filters } from '../../ui/filters';
|
|
20
15
|
import { SortDropdown } from '../../ui/sort-dropdown';
|
|
@@ -76,51 +71,47 @@ TooltipNotPredictive.propTypes = {
|
|
|
76
71
|
runs: PropTypes.array, // eslint-disable-line react/forbid-prop-types
|
|
77
72
|
};
|
|
78
73
|
|
|
79
|
-
const getRenderRowHeader =
|
|
80
|
-
|
|
81
|
-
(item) => {
|
|
82
|
-
const { label, isNotPredictive, runs, isChunk, isEntry, isInitial } = item;
|
|
74
|
+
const getRenderRowHeader = ({ labels, CustomComponentLink, chunks }) => (item) => {
|
|
75
|
+
const { label, isNotPredictive, runs, isChunk, isEntry, isInitial } = item;
|
|
83
76
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
);
|
|
123
|
-
};
|
|
77
|
+
return (
|
|
78
|
+
<Popover
|
|
79
|
+
label={<FileName name={label} />}
|
|
80
|
+
icon={
|
|
81
|
+
<div className={css.assetInfoFlags}>
|
|
82
|
+
{isNotPredictive && (
|
|
83
|
+
<Tooltip className={css.notPredictive} title={<TooltipNotPredictive runs={runs} />}>
|
|
84
|
+
<Icon className={css.notPredictiveIcon} glyph="warning" />
|
|
85
|
+
</Tooltip>
|
|
86
|
+
)}
|
|
87
|
+
{isChunk && (
|
|
88
|
+
<span title="Chunk" className={css.flagChunk}>
|
|
89
|
+
c
|
|
90
|
+
</span>
|
|
91
|
+
)}
|
|
92
|
+
{isEntry && (
|
|
93
|
+
<span title="Entrypoint" className={css.flagEntry}>
|
|
94
|
+
e
|
|
95
|
+
</span>
|
|
96
|
+
)}
|
|
97
|
+
{isInitial && (
|
|
98
|
+
<span title="Initial" className={css.flagInitial}>
|
|
99
|
+
i
|
|
100
|
+
</span>
|
|
101
|
+
)}
|
|
102
|
+
</div>
|
|
103
|
+
}
|
|
104
|
+
>
|
|
105
|
+
<AssetInfo
|
|
106
|
+
className={css.assetInfo}
|
|
107
|
+
item={item}
|
|
108
|
+
labels={labels}
|
|
109
|
+
chunks={chunks}
|
|
110
|
+
CustomComponentLink={CustomComponentLink}
|
|
111
|
+
/>
|
|
112
|
+
</Popover>
|
|
113
|
+
);
|
|
114
|
+
};
|
|
124
115
|
|
|
125
116
|
export const BundleAssets = (props) => {
|
|
126
117
|
const {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
1
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
import { get, isEmpty, map } from 'lodash';
|
|
@@ -18,7 +18,7 @@ import { FlexStack } from '../../layout/flex-stack';
|
|
|
18
18
|
import { EmptySet } from '../../ui/empty-set';
|
|
19
19
|
import { FileName } from '../../ui/file-name';
|
|
20
20
|
import { Filters } from '../../ui/filters';
|
|
21
|
-
import {
|
|
21
|
+
import { Popover } from '../../ui/popover';
|
|
22
22
|
import { SortDropdown } from '../../ui/sort-dropdown';
|
|
23
23
|
import { Toolbar } from '../../ui/toolbar';
|
|
24
24
|
import { MetricsTable } from '../metrics-table';
|
|
@@ -30,18 +30,31 @@ import css from './bundle-modules.module.css';
|
|
|
30
30
|
|
|
31
31
|
const RowHeader = ({ row, chunks, labels, CustomComponentLink }) => {
|
|
32
32
|
const chunkIds = map(chunks, 'id');
|
|
33
|
+
|
|
34
|
+
const [showPopopver, setPopover] = useState(false);
|
|
35
|
+
const handleOnMouseEnter = useCallback(() => setPopover(true), [showPopopver]);
|
|
33
36
|
const content = <FileName name={row.label} />;
|
|
34
37
|
|
|
35
38
|
return (
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
<div onMouseEnter={handleOnMouseEnter}>
|
|
40
|
+
{!showPopopver ?
|
|
41
|
+
content
|
|
42
|
+
: (
|
|
43
|
+
<Popover ariaLabel="View module info" label={content}>
|
|
44
|
+
{({ popoverToggle }) => (
|
|
45
|
+
<ModuleInfo
|
|
46
|
+
className={css.namePopover}
|
|
47
|
+
item={row}
|
|
48
|
+
chunks={chunks}
|
|
49
|
+
chunkIds={chunkIds}
|
|
50
|
+
labels={labels}
|
|
51
|
+
customComponentLink={CustomComponentLink}
|
|
52
|
+
onClick={popoverToggle}
|
|
53
|
+
/>
|
|
54
|
+
)}
|
|
55
|
+
</Popover>
|
|
56
|
+
)}
|
|
57
|
+
</div>
|
|
45
58
|
);
|
|
46
59
|
};
|
|
47
60
|
|
|
@@ -63,17 +76,9 @@ RowHeader.defaultProps = {
|
|
|
63
76
|
chunks: [],
|
|
64
77
|
};
|
|
65
78
|
|
|
66
|
-
const getRenderRowHeader =
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
(
|
|
70
|
-
<RowHeader
|
|
71
|
-
row={row}
|
|
72
|
-
chunks={chunks}
|
|
73
|
-
labels={labels}
|
|
74
|
-
CustomComponentLink={CustomComponentLink}
|
|
75
|
-
/>
|
|
76
|
-
);
|
|
79
|
+
const getRenderRowHeader = ({ labels, chunks, CustomComponentLink }) => (row) => (
|
|
80
|
+
<RowHeader row={row} chunks={chunks} labels={labels} CustomComponentLink={CustomComponentLink} />
|
|
81
|
+
);
|
|
77
82
|
|
|
78
83
|
export const BundleModules = ({
|
|
79
84
|
className,
|
|
@@ -235,12 +240,10 @@ BundleModules.propTypes = {
|
|
|
235
240
|
jobs: PropTypes.array, // eslint-disable-line react/forbid-prop-types
|
|
236
241
|
|
|
237
242
|
/** Chunks data */
|
|
238
|
-
chunks: PropTypes.arrayOf(
|
|
239
|
-
PropTypes.
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}),
|
|
243
|
-
).isRequired,
|
|
243
|
+
chunks: PropTypes.arrayOf(PropTypes.shape({
|
|
244
|
+
id: PropTypes.string,
|
|
245
|
+
name: PropTypes.string,
|
|
246
|
+
})).isRequired,
|
|
244
247
|
|
|
245
248
|
/** total row count */
|
|
246
249
|
totalRowCount: PropTypes.number,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {useCallback} from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
import {
|
|
@@ -15,7 +15,7 @@ import { Stack } from '../../layout/stack';
|
|
|
15
15
|
import { FlexStack } from '../../layout/flex-stack';
|
|
16
16
|
import { EmptySet } from '../../ui/empty-set';
|
|
17
17
|
import { Filters } from '../../ui/filters';
|
|
18
|
-
import {
|
|
18
|
+
import { Popover } from '../../ui/popover';
|
|
19
19
|
import { SortDropdown } from '../../ui/sort-dropdown';
|
|
20
20
|
import { Toolbar } from '../../ui/toolbar';
|
|
21
21
|
import { FileName } from '../../ui/file-name';
|
|
@@ -26,29 +26,28 @@ import { MetricsTableOptions } from '../metrics-table-options';
|
|
|
26
26
|
import { MetricsTableTitle } from '../metrics-table-title';
|
|
27
27
|
import css from './bundle-packages.module.css';
|
|
28
28
|
|
|
29
|
-
const
|
|
30
|
-
const normalizedPackagePath =
|
|
31
|
-
path || `node_modules/${fullName.split(PACKAGES_SEPARATOR).join('/node_modules/')}/`;
|
|
29
|
+
const PackagePopoverContent = ({ name, fullName, path, duplicate, CustomComponentLink }) => {
|
|
30
|
+
const normalizedPackagePath = path || `node_modules/${fullName.split(PACKAGES_SEPARATOR).join('/node_modules/')}/`;
|
|
32
31
|
const [normalizedName, packageId] = name.split(PACKAGE_ID_SEPARATOR);
|
|
33
32
|
|
|
34
33
|
return (
|
|
35
|
-
<Stack space="xxsmall" className={css.
|
|
34
|
+
<Stack space="xxsmall" className={css.packagePopover}>
|
|
36
35
|
<Stack space="xxxsmall">
|
|
37
|
-
<h3 className={css.
|
|
36
|
+
<h3 className={css.packagePopoverTitle}>
|
|
38
37
|
{normalizedName}
|
|
39
38
|
{packageId && (
|
|
40
|
-
<span className={css.
|
|
39
|
+
<span className={css.packagePopoverTitleIndex}>
|
|
41
40
|
{`${PACKAGE_ID_SEPARATOR}${packageId}`}
|
|
42
41
|
</span>
|
|
43
42
|
)}
|
|
44
43
|
</h3>
|
|
45
|
-
<p className={css.
|
|
46
|
-
<FileName className={css.
|
|
44
|
+
<p className={css.packagePopoverPath}>
|
|
45
|
+
<FileName className={css.packagePopoverPathValue} name={normalizedPackagePath} />
|
|
47
46
|
</p>
|
|
48
47
|
</Stack>
|
|
49
48
|
|
|
50
|
-
<ul className={css.
|
|
51
|
-
<li className={css.
|
|
49
|
+
<ul className={css.packagePopoverList}>
|
|
50
|
+
<li className={css.packagePopoverItem}>
|
|
52
51
|
<a
|
|
53
52
|
href={`https://www.npmjs.com/package/${normalizedName}`}
|
|
54
53
|
target="_blank"
|
|
@@ -57,7 +56,7 @@ const PackageCard = ({ name, fullName, path, duplicate, CustomComponentLink }) =
|
|
|
57
56
|
npmjs.com
|
|
58
57
|
</a>
|
|
59
58
|
</li>
|
|
60
|
-
<li className={css.
|
|
59
|
+
<li className={css.packagePopoverItem}>
|
|
61
60
|
<a
|
|
62
61
|
href={`https://bundlephobia.com/result?p=${normalizedName}`}
|
|
63
62
|
target="_blank"
|
|
@@ -68,7 +67,7 @@ const PackageCard = ({ name, fullName, path, duplicate, CustomComponentLink }) =
|
|
|
68
67
|
</li>
|
|
69
68
|
</ul>
|
|
70
69
|
|
|
71
|
-
<Stack space="xxxsmall" className={css.
|
|
70
|
+
<Stack space="xxxsmall" className={css.packagePopover.actions}>
|
|
72
71
|
{duplicate && (
|
|
73
72
|
<div>
|
|
74
73
|
<CustomComponentLink {...getBundlePackagesByNameComponentLink(normalizedName)}>
|
|
@@ -85,7 +84,7 @@ const PackageCard = ({ name, fullName, path, duplicate, CustomComponentLink }) =
|
|
|
85
84
|
);
|
|
86
85
|
};
|
|
87
86
|
|
|
88
|
-
|
|
87
|
+
PackagePopoverContent.propTypes = {
|
|
89
88
|
name: PropTypes.string.isRequired,
|
|
90
89
|
path: PropTypes.string,
|
|
91
90
|
fullName: PropTypes.string.isRequired,
|
|
@@ -93,7 +92,7 @@ PackageCard.propTypes = {
|
|
|
93
92
|
CustomComponentLink: PropTypes.elementType.isRequired,
|
|
94
93
|
};
|
|
95
94
|
|
|
96
|
-
|
|
95
|
+
PackagePopoverContent.defaultProps = {
|
|
97
96
|
path: '',
|
|
98
97
|
};
|
|
99
98
|
|
|
@@ -102,33 +101,28 @@ const PackageRowHeader = ({ item, CustomComponentLink }) => {
|
|
|
102
101
|
const { path } = item.runs[0] || {};
|
|
103
102
|
|
|
104
103
|
return (
|
|
105
|
-
<
|
|
104
|
+
<span className={css.packageNames}>
|
|
106
105
|
{packageNames.map((packageName, index) => {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
D
|
|
113
|
-
</span>
|
|
114
|
-
)}
|
|
115
|
-
<span className={css.packageNameText}>{packageName}</span>
|
|
116
|
-
</FlexStack>
|
|
106
|
+
// Render duplicate flag only for the last entry
|
|
107
|
+
const duplicateFlag = index === packageNames.length - 1 && item.duplicate && (
|
|
108
|
+
<span className={css.duplicate} title="Duplicate package">
|
|
109
|
+
D
|
|
110
|
+
</span>
|
|
117
111
|
);
|
|
118
112
|
|
|
119
113
|
return (
|
|
120
|
-
<
|
|
121
|
-
<
|
|
114
|
+
<Popover className={css.packageName} icon={duplicateFlag} label={packageName}>
|
|
115
|
+
<PackagePopoverContent
|
|
122
116
|
name={packageName}
|
|
123
117
|
path={path}
|
|
124
118
|
fullName={item.label}
|
|
125
119
|
duplicate={item.duplicate}
|
|
126
120
|
CustomComponentLink={CustomComponentLink}
|
|
127
121
|
/>
|
|
128
|
-
</
|
|
122
|
+
</Popover>
|
|
129
123
|
);
|
|
130
124
|
})}
|
|
131
|
-
</
|
|
125
|
+
</span>
|
|
132
126
|
);
|
|
133
127
|
};
|
|
134
128
|
|
|
@@ -12,8 +12,20 @@
|
|
|
12
12
|
margin-right: -1px; /** collapse border */
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
.
|
|
16
|
-
|
|
15
|
+
.duplicate {
|
|
16
|
+
margin-right: var(--space-xxxsmall);
|
|
17
|
+
display: inline-block;
|
|
18
|
+
width: var(--space-small);
|
|
19
|
+
height: var(--space-small);
|
|
20
|
+
font-size: 10px;
|
|
21
|
+
font-weight: bold;
|
|
22
|
+
line-height: var(--space-small);
|
|
23
|
+
text-align: center;
|
|
24
|
+
text-transform: uppercase;
|
|
25
|
+
vertical-align: middle;
|
|
26
|
+
|
|
27
|
+
background: var(--color-danger);
|
|
28
|
+
color: var(--color-light);
|
|
17
29
|
}
|
|
18
30
|
|
|
19
31
|
.packageName {
|
|
@@ -26,56 +38,27 @@
|
|
|
26
38
|
|
|
27
39
|
.packageName + .packageName::before {
|
|
28
40
|
display: inline-block;
|
|
29
|
-
margin: 0 var(--space-xxxsmall)
|
|
41
|
+
margin: 0 var(--space-xxxsmall);
|
|
30
42
|
content: '/';
|
|
31
43
|
color: var(--color-text-ultra-light);
|
|
32
44
|
}
|
|
33
45
|
|
|
34
|
-
.
|
|
35
|
-
|
|
36
|
-
align-items: center;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.packageNameDuplicate {
|
|
40
|
-
margin-right: var(--space-xxxsmall);
|
|
41
|
-
display: inline-block;
|
|
42
|
-
width: var(--space-xsmall);
|
|
43
|
-
height: var(--space-xsmall);
|
|
44
|
-
font-size: 8px;
|
|
45
|
-
font-weight: bold;
|
|
46
|
-
line-height: var(--space-xsmall);
|
|
47
|
-
text-align: center;
|
|
48
|
-
text-transform: uppercase;
|
|
49
|
-
vertical-align: middle;
|
|
50
|
-
|
|
51
|
-
background: var(--color-danger);
|
|
52
|
-
color: var(--color-light);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.packageName:hover,
|
|
56
|
-
.packageName:active,
|
|
57
|
-
.packageName:focus {
|
|
58
|
-
text-decoration: none !important;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.packageName:hover .packageNameText,
|
|
62
|
-
.packageName:active .packageNameText,
|
|
63
|
-
.packageName:focus .packageNameText {
|
|
64
|
-
text-decoration: underline !important;
|
|
46
|
+
.packagePopover {
|
|
47
|
+
min-width: 320px;
|
|
65
48
|
}
|
|
66
49
|
|
|
67
|
-
.
|
|
50
|
+
.packagePopoverTitleIndex {
|
|
68
51
|
color: var(--color-text-light);
|
|
69
52
|
font-weight: normal;
|
|
70
53
|
}
|
|
71
54
|
|
|
72
|
-
.
|
|
55
|
+
.packagePopoverPathValue {
|
|
73
56
|
padding: var(--space-xxxsmall);
|
|
74
57
|
background: var(--color-highlight-warning);
|
|
75
58
|
font-family: var(--font-family-monospace);
|
|
76
59
|
}
|
|
77
60
|
|
|
78
|
-
.
|
|
61
|
+
.packagePopoverList {
|
|
79
62
|
padding: 0;
|
|
80
63
|
list-style: inside;
|
|
81
64
|
}
|
|
@@ -5,7 +5,7 @@ import I18N from '../../i18n';
|
|
|
5
5
|
import { Dropdown } from '../../ui/dropdown';
|
|
6
6
|
|
|
7
7
|
export const MetricsTableOptions = (props) => {
|
|
8
|
-
const { className,
|
|
8
|
+
const { className, handleViewAll, handleResetFilters, ...restProps } = props;
|
|
9
9
|
|
|
10
10
|
return (
|
|
11
11
|
<Dropdown className={className} glyph="menu" {...restProps}>
|
|
@@ -5,8 +5,7 @@ import cx from 'classnames';
|
|
|
5
5
|
import I18N from '../../i18n';
|
|
6
6
|
import { FlexStack } from '../../layout/flex-stack';
|
|
7
7
|
import { Stack } from '../../layout/stack';
|
|
8
|
-
import {
|
|
9
|
-
import { HoverCard } from '../../ui/hover-card';
|
|
8
|
+
import { Popover } from '../../ui/popover';
|
|
10
9
|
import css from './metrics-table-title.module.css';
|
|
11
10
|
|
|
12
11
|
export const MetricsTableTitle = (props) => {
|
|
@@ -19,7 +18,7 @@ export const MetricsTableTitle = (props) => {
|
|
|
19
18
|
<span>{title}</span>
|
|
20
19
|
{info && <span className={css.info}>{info}</span>}
|
|
21
20
|
{(popoverInfo || popoverHref) && (
|
|
22
|
-
<
|
|
21
|
+
<Popover icon="help">
|
|
23
22
|
<Stack space="xxxsmall">
|
|
24
23
|
{popoverInfo && <p>{popoverInfo}</p>}
|
|
25
24
|
{popoverHref && (
|
|
@@ -30,7 +29,7 @@ export const MetricsTableTitle = (props) => {
|
|
|
30
29
|
</p>
|
|
31
30
|
)}
|
|
32
31
|
</Stack>
|
|
33
|
-
</
|
|
32
|
+
</Popover>
|
|
34
33
|
)}
|
|
35
34
|
</FlexStack>
|
|
36
35
|
</Stack>
|
|
@@ -3,8 +3,7 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
import { getGlobalMetricType, getMetricRunInfo } from '@bundle-stats/utils';
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import { HoverCard } from '../../ui/hover-card';
|
|
6
|
+
import { Popover } from '../../ui/popover';
|
|
8
7
|
import { Skeleton } from '../../ui/skeleton';
|
|
9
8
|
import { Stack } from '../../layout/stack';
|
|
10
9
|
import { FlexStack } from '../../layout/flex-stack';
|
|
@@ -12,26 +11,32 @@ import { Metric } from '../metric';
|
|
|
12
11
|
import { Delta } from '../delta';
|
|
13
12
|
import css from './summary-item.module.css';
|
|
14
13
|
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
14
|
+
const MetricInfoPopover = ({ description, url }) => {
|
|
15
|
+
// Workaround cases where the parent is a link
|
|
16
|
+
const readMoreOnClick = () => {
|
|
17
|
+
window.open(url);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<Stack space="xxxsmall">
|
|
22
|
+
<p>{description}</p>
|
|
23
|
+
{url && (
|
|
24
|
+
<p>
|
|
25
|
+
<button type="button" className={css.readMoreBtn} onClick={readMoreOnClick}>
|
|
26
|
+
Read more
|
|
27
|
+
</button>
|
|
28
|
+
</p>
|
|
29
|
+
)}
|
|
30
|
+
</Stack>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
MetricInfoPopover.propTypes = {
|
|
30
35
|
description: PropTypes.string.isRequired,
|
|
31
36
|
url: PropTypes.string,
|
|
32
37
|
};
|
|
33
38
|
|
|
34
|
-
|
|
39
|
+
MetricInfoPopover.defaultProps = {
|
|
35
40
|
url: '',
|
|
36
41
|
};
|
|
37
42
|
|
|
@@ -60,9 +65,9 @@ export const SummaryItem = ({
|
|
|
60
65
|
<span>{metric.label}</span>
|
|
61
66
|
|
|
62
67
|
{showMetricDescriptionTooltip && (
|
|
63
|
-
<
|
|
64
|
-
<
|
|
65
|
-
</
|
|
68
|
+
<Popover className={css.icon} icon="help">
|
|
69
|
+
<MetricInfoPopover {...metric} />
|
|
70
|
+
</Popover>
|
|
66
71
|
)}
|
|
67
72
|
</FlexStack>
|
|
68
73
|
|
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import cx from 'classnames'
|
|
3
|
+
import cx from 'classnames'
|
|
4
4
|
|
|
5
5
|
import config from '../../config.json';
|
|
6
6
|
import I18N from '../../i18n';
|
|
7
7
|
import { FlexStack } from '../../layout/flex-stack';
|
|
8
8
|
import { Stack } from '../../layout/stack';
|
|
9
|
-
import {
|
|
10
|
-
import { HoverCard } from '../../ui/hover-card';
|
|
9
|
+
import { Popover } from '../../ui/popover';
|
|
11
10
|
import css from './total-size-type-title.module.css';
|
|
12
11
|
|
|
13
12
|
export const TotalSizeTypeTitle = ({ className }) => (
|
|
14
13
|
<FlexStack space="xxxsmall" className={cx(css.title, className)}>
|
|
15
14
|
<span>{I18N.ASSET_TOTALS}</span>
|
|
16
|
-
<
|
|
15
|
+
<Popover icon="help">
|
|
17
16
|
<Stack space="xxxsmall">
|
|
18
17
|
<p>{I18N.ASSET_TOTALS_INFO}</p>
|
|
19
18
|
<p>
|
|
20
|
-
<a
|
|
19
|
+
<a
|
|
20
|
+
href={config.documentation.assets}
|
|
21
|
+
target="_blank"
|
|
22
|
+
rel="noreferrer"
|
|
23
|
+
>
|
|
21
24
|
{I18N.READ_MORE}
|
|
22
25
|
</a>
|
|
23
26
|
</p>
|
|
24
27
|
</Stack>
|
|
25
|
-
</
|
|
28
|
+
</Popover>
|
|
26
29
|
</FlexStack>
|
|
27
30
|
);
|
|
28
31
|
|