@bundle-stats/ui 3.1.4-alpha.0 → 3.2.1-alpha.0
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.js +3 -3
- package/CHANGELOG.md +18 -1
- package/lib/app/app.js +2 -1
- package/lib/app/app.stories.js +2 -1
- package/lib/assets/icons/arrow.svg +1 -0
- package/lib/assets/icons/cancel.svg +1 -0
- package/lib/assets/icons/clock.svg +1 -0
- package/lib/assets/icons/close.svg +1 -0
- package/lib/assets/icons/commit.svg +1 -0
- package/lib/assets/icons/filter.svg +1 -0
- package/lib/assets/icons/help.svg +1 -0
- package/lib/assets/icons/menu.svg +1 -0
- package/lib/{ui/icon/assets → assets/icons}/sort.svg +0 -0
- package/lib/assets/icons/warning.svg +1 -0
- package/lib/assets/icons.svg +1 -0
- package/lib/components/bundle-assets/bundle-assets.constants.js +1 -1
- package/lib/components/bundle-assets/bundle-assets.js +3 -3
- package/lib/components/bundle-assets/bundle-assets.stories.js +19 -7
- package/lib/components/bundle-assets/bundle-assets.utils.js +95 -28
- package/lib/components/bundle-assets/index.js +115 -4
- package/lib/components/bundle-modules/bundle-modules.constants.js +1 -1
- package/lib/components/bundle-modules/bundle-modules.js +3 -3
- package/lib/components/bundle-modules/bundle-modules.utils.js +152 -0
- package/lib/components/bundle-modules/index.js +135 -4
- package/lib/components/bundle-packages/bundle-packages.constants.js +1 -1
- package/lib/components/bundle-packages/bundle-packages.js +27 -7
- package/lib/components/bundle-packages/bundle-packages.module.css +5 -0
- package/lib/components/bundle-packages/{bundle-packages.container.js → bundle-packages.utils.js} +8 -42
- package/lib/components/bundle-packages/index.js +111 -3
- package/lib/components/duplicate-packages-warning/duplicate-packages-warning.js +7 -4
- package/lib/components/duplicate-packages-warning/duplicate-packages-warning.stories.js +4 -3
- package/lib/components/index.js +18 -18
- package/lib/components/metrics-table/metrics-table.js +3 -7
- package/lib/components/metrics-table-search/metrics-table-search.js +2 -1
- package/lib/components/metrics-table-search/metrics-table-search.module.css +2 -1
- package/lib/constants.js +1 -1
- package/lib/hooks/rows-filter.js +28 -0
- package/lib/hooks/rows-sort.js +54 -0
- package/lib/{hocs/with-search.js → hooks/search-params.js} +15 -64
- package/lib/layout/index.js +8 -8
- package/lib/ui/icon/icon.js +4 -191
- package/lib/ui/logo/logo.constants.js +1 -1
- package/lib/ui/popover/popover.js +3 -1
- package/lib/ui/popover/popover.module.css +3 -3
- package/lib/ui/sort-dropdown/sort-dropdown.js +12 -13
- package/lib/ui/sort-dropdown/sort-dropdown.stories.js +2 -2
- package/lib/ui/tooltip/tooltip.js +2 -1
- package/lib-esm/app/app.js +89 -108
- package/lib-esm/app/app.stories.js +50 -70
- package/lib-esm/app/header/header.js +19 -20
- package/lib-esm/assets/icons/arrow.svg +1 -0
- package/lib-esm/assets/icons/cancel.svg +1 -0
- package/lib-esm/assets/icons/clock.svg +1 -0
- package/lib-esm/assets/icons/close.svg +1 -0
- package/lib-esm/assets/icons/commit.svg +1 -0
- package/lib-esm/assets/icons/filter.svg +1 -0
- package/lib-esm/assets/icons/help.svg +1 -0
- package/lib-esm/assets/icons/menu.svg +1 -0
- package/lib-esm/{ui/icon/assets → assets/icons}/sort.svg +0 -0
- package/lib-esm/assets/icons/warning.svg +1 -0
- package/lib-esm/assets/icons.svg +1 -0
- package/lib-esm/components/asset-info/asset-info.js +20 -18
- package/lib-esm/components/asset-info/asset-info.stories.js +29 -33
- package/lib-esm/components/browsertime-table/browsertime-table.js +6 -4
- package/lib-esm/components/browsertime-table/browsertime-table.stories.js +9 -13
- package/lib-esm/components/bundle-assets/bundle-assets.constants.js +17 -15
- package/lib-esm/components/bundle-assets/bundle-assets.js +148 -151
- package/lib-esm/components/bundle-assets/bundle-assets.stories.js +58 -63
- package/lib-esm/components/bundle-assets/bundle-assets.utils.js +65 -21
- package/lib-esm/components/bundle-assets/index.js +89 -2
- package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js +46 -51
- package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.stories.js +9 -13
- package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.js +13 -13
- package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.stories.js +13 -19
- package/lib-esm/components/bundle-modules/bundle-modules.constants.js +17 -15
- package/lib-esm/components/bundle-modules/bundle-modules.js +120 -133
- package/lib-esm/components/bundle-modules/bundle-modules.stories.js +46 -58
- package/lib-esm/components/bundle-modules/bundle-modules.utils.js +95 -0
- package/lib-esm/components/bundle-modules/index.js +111 -3
- package/lib-esm/components/bundle-packages/bundle-packages.constants.js +17 -15
- package/lib-esm/components/bundle-packages/bundle-packages.js +81 -77
- package/lib-esm/components/bundle-packages/bundle-packages.module.css +5 -0
- package/lib-esm/components/bundle-packages/bundle-packages.stories.js +34 -46
- package/lib-esm/components/bundle-packages/bundle-packages.utils.js +44 -0
- package/lib-esm/components/bundle-packages/index.js +87 -2
- package/lib-esm/components/component-link.js +9 -13
- package/lib-esm/components/delta/delta.js +7 -6
- package/lib-esm/components/delta/delta.stories.js +26 -38
- package/lib-esm/components/duplicate-packages-warning/duplicate-packages-warning.js +15 -10
- package/lib-esm/components/duplicate-packages-warning/duplicate-packages-warning.stories.js +20 -25
- package/lib-esm/components/job-header/job-header.js +14 -11
- package/lib-esm/components/job-header/job-header.stories.js +12 -18
- package/lib-esm/components/job-meta/job-meta.js +14 -18
- package/lib-esm/components/job-meta/job-meta.stories.js +10 -12
- package/lib-esm/components/job-name/job-name.js +11 -17
- package/lib-esm/components/job-name/job-name.stories.js +15 -23
- package/lib-esm/components/jobs-header/jobs-header.js +12 -12
- package/lib-esm/components/jobs-header/jobs-header.stories.js +80 -86
- package/lib-esm/components/lighthouse-table/lighthouse-table.js +6 -4
- package/lib-esm/components/lighthouse-table/lighthouse-table.stories.js +10 -14
- package/lib-esm/components/metric/metric.js +14 -19
- package/lib-esm/components/metric/metric.stories.js +36 -58
- package/lib-esm/components/metrics-table/metrics-table.js +128 -143
- package/lib-esm/components/metrics-table/metrics-table.stories.js +27 -35
- package/lib-esm/components/metrics-table-options/metrics-table-options.js +15 -20
- package/lib-esm/components/metrics-table-options/metrics-table-options.stories.js +6 -12
- package/lib-esm/components/metrics-table-search/metrics-table-search.js +17 -18
- package/lib-esm/components/metrics-table-search/metrics-table-search.module.css +2 -1
- package/lib-esm/components/metrics-table-search/metrics-table-search.stories.js +4 -9
- package/lib-esm/components/metrics-table-title/metrics-table-title.js +9 -7
- package/lib-esm/components/module-info/module-info.js +15 -13
- package/lib-esm/components/module-info/module-info.stories.js +20 -22
- package/lib-esm/components/summary/summary.js +38 -52
- package/lib-esm/components/summary/summary.stories.js +28 -46
- package/lib-esm/components/summary-item/summary-item.js +25 -29
- package/lib-esm/components/summary-item/summary-item.stories.js +40 -50
- package/lib-esm/components/total-size-type-title/total-size-type-title.js +14 -15
- package/lib-esm/constants.js +25 -30
- package/lib-esm/hooks/rows-filter.js +19 -0
- package/lib-esm/hooks/rows-sort.js +21 -0
- package/lib-esm/hooks/search-params.js +166 -0
- package/lib-esm/layout/box/box.js +12 -19
- package/lib-esm/layout/box/box.stories.js +34 -46
- package/lib-esm/layout/flex-stack/flex-stack.js +9 -12
- package/lib-esm/layout/flex-stack/flex-stack.stories.js +39 -49
- package/lib-esm/layout/footer/footer.js +34 -37
- package/lib-esm/layout/footer/footer.stories.js +7 -11
- package/lib-esm/layout/header/header.js +17 -24
- package/lib-esm/layout/header/header.stories.js +34 -43
- package/lib-esm/layout/stack/stack.js +8 -6
- package/lib-esm/layout/stack/stack.stories.js +39 -49
- package/lib-esm/layout/sub-header/sub-header.js +14 -12
- package/lib-esm/layout/sub-header/sub-header.stories.js +57 -69
- package/lib-esm/prototypes/typography.stories.js +48 -58
- package/lib-esm/query-state.js +13 -16
- package/lib-esm/stories/wrapper.js +14 -26
- package/lib-esm/ui/alert/alert.js +6 -4
- package/lib-esm/ui/alert/alert.stories.js +14 -24
- package/lib-esm/ui/container/container.js +9 -15
- package/lib-esm/ui/container/container.stories.js +15 -17
- package/lib-esm/ui/dropdown/dropdown.js +13 -11
- package/lib-esm/ui/dropdown/dropdown.stories.js +19 -26
- package/lib-esm/ui/empty-set/empty-set.js +12 -12
- package/lib-esm/ui/empty-set/empty-set.stories.js +11 -19
- package/lib-esm/ui/file-name/file-name.js +7 -8
- package/lib-esm/ui/file-name/file-name.stories.js +12 -16
- package/lib-esm/ui/filters/filters.container.js +52 -77
- package/lib-esm/ui/filters/filters.js +61 -89
- package/lib-esm/ui/filters/filters.stories.js +81 -100
- package/lib-esm/ui/filters/filters.utils.js +24 -28
- package/lib-esm/ui/filters/index.js +1 -1
- package/lib-esm/ui/horizontal-bar-chart/horizontal-bar-chart.js +67 -78
- package/lib-esm/ui/horizontal-bar-chart/horizontal-bar-chart.stories.js +67 -77
- package/lib-esm/ui/icon/icon.js +14 -206
- package/lib-esm/ui/icon/icon.stories.js +16 -24
- package/lib-esm/ui/input/input.js +6 -10
- package/lib-esm/ui/input/input.stories.js +8 -12
- package/lib-esm/ui/loader/loader.js +7 -13
- package/lib-esm/ui/loader/loader.stories.js +5 -9
- package/lib-esm/ui/logo/logo.constants.js +6 -6
- package/lib-esm/ui/logo/logo.js +14 -15
- package/lib-esm/ui/logo/logo.stories.js +14 -28
- package/lib-esm/ui/panels/panels.js +14 -27
- package/lib-esm/ui/panels/panels.stories.js +14 -16
- package/lib-esm/ui/popover/popover.js +13 -10
- package/lib-esm/ui/popover/popover.module.css +3 -3
- package/lib-esm/ui/popover/popover.stories.js +7 -11
- package/lib-esm/ui/skeleton/skeleton.js +6 -9
- package/lib-esm/ui/skeleton/skeleton.stories.js +2 -4
- package/lib-esm/ui/sort-dropdown/sort-dropdown.js +36 -39
- package/lib-esm/ui/sort-dropdown/sort-dropdown.stories.js +14 -16
- package/lib-esm/ui/table/table.js +25 -31
- package/lib-esm/ui/table/table.stories.js +84 -102
- package/lib-esm/ui/tabs/tabs.js +14 -25
- package/lib-esm/ui/tabs/tabs.stories.js +4 -6
- package/lib-esm/ui/toolbar/toolbar.js +7 -5
- package/lib-esm/ui/toolbar/toolbar.stories.js +11 -16
- package/lib-esm/ui/tooltip/tooltip.js +15 -17
- package/lib-esm/ui/tooltip/tooltip.stories.js +8 -12
- package/lib-esm/utils.js +15 -28
- package/package.json +19 -27
- package/src/app/app.jsx +4 -1
- package/src/assets/icons/arrow.svg +1 -0
- package/src/assets/icons/cancel.svg +1 -0
- package/src/assets/icons/clock.svg +1 -0
- package/src/assets/icons/close.svg +1 -0
- package/src/assets/icons/commit.svg +1 -0
- package/src/assets/icons/filter.svg +1 -0
- package/src/assets/icons/help.svg +1 -0
- package/src/assets/icons/menu.svg +1 -0
- package/src/{ui/icon/assets → assets/icons}/sort.svg +0 -0
- package/src/assets/icons/warning.svg +1 -0
- package/src/assets/icons.svg +1 -0
- package/src/components/bundle-assets/bundle-assets.jsx +3 -3
- package/src/components/bundle-assets/bundle-assets.utils.js +96 -17
- package/src/components/bundle-assets/index.jsx +89 -0
- package/src/components/bundle-modules/bundle-modules.jsx +3 -3
- package/src/components/bundle-modules/bundle-modules.utils.js +101 -0
- package/src/components/bundle-modules/index.jsx +107 -0
- package/src/components/bundle-packages/bundle-packages.jsx +21 -8
- package/src/components/bundle-packages/bundle-packages.module.css +5 -0
- package/src/components/bundle-packages/bundle-packages.utils.js +47 -0
- package/src/components/bundle-packages/index.jsx +84 -0
- package/src/components/duplicate-packages-warning/duplicate-packages-warning.jsx +9 -2
- package/src/components/metrics-table/metrics-table.jsx +2 -7
- package/src/components/metrics-table-search/metrics-table-search.jsx +1 -0
- package/src/components/metrics-table-search/metrics-table-search.module.css +2 -1
- package/src/hooks/rows-filter.js +16 -0
- package/src/hooks/rows-sort.js +24 -0
- package/src/hooks/search-params.js +153 -0
- package/src/ui/icon/icon.jsx +7 -42
- package/src/ui/popover/popover.jsx +1 -1
- package/src/ui/popover/popover.module.css +3 -3
- package/src/ui/sort-dropdown/sort-dropdown.jsx +11 -11
- package/src/ui/tooltip/tooltip.jsx +1 -1
- package/lib/components/bundle-assets/bundle-assets.container.js +0 -140
- package/lib/components/bundle-modules/bundle-modules.container.js +0 -222
- package/lib/hocs/with-custom-sort.js +0 -75
- package/lib/hocs/with-filtered-items.js +0 -54
- package/lib/ui/icon/assets/arrow.svg +0 -4
- package/lib/ui/icon/assets/branch.svg +0 -3
- package/lib/ui/icon/assets/cancel.svg +0 -4
- package/lib/ui/icon/assets/clock.svg +0 -3
- package/lib/ui/icon/assets/close.svg +0 -4
- package/lib/ui/icon/assets/commit.svg +0 -3
- package/lib/ui/icon/assets/filter.svg +0 -4
- package/lib/ui/icon/assets/help.svg +0 -4
- package/lib/ui/icon/assets/job.svg +0 -3
- package/lib/ui/icon/assets/menu.svg +0 -4
- package/lib/ui/icon/assets/package.svg +0 -3
- package/lib/ui/icon/assets/pull-request.svg +0 -3
- package/lib/ui/icon/assets/repository.svg +0 -3
- package/lib/ui/icon/assets/warning.svg +0 -4
- package/lib-esm/components/bundle-assets/bundle-assets.container.js +0 -119
- package/lib-esm/components/bundle-modules/bundle-modules.container.js +0 -175
- package/lib-esm/components/bundle-packages/bundle-packages.container.js +0 -91
- package/lib-esm/hocs/with-custom-sort.js +0 -43
- package/lib-esm/hocs/with-filtered-items.js +0 -35
- package/lib-esm/hocs/with-search.js +0 -214
- package/lib-esm/ui/icon/assets/arrow.svg +0 -4
- package/lib-esm/ui/icon/assets/branch.svg +0 -3
- package/lib-esm/ui/icon/assets/cancel.svg +0 -4
- package/lib-esm/ui/icon/assets/clock.svg +0 -3
- package/lib-esm/ui/icon/assets/close.svg +0 -4
- package/lib-esm/ui/icon/assets/commit.svg +0 -3
- package/lib-esm/ui/icon/assets/filter.svg +0 -4
- package/lib-esm/ui/icon/assets/help.svg +0 -4
- package/lib-esm/ui/icon/assets/job.svg +0 -3
- package/lib-esm/ui/icon/assets/menu.svg +0 -4
- package/lib-esm/ui/icon/assets/package.svg +0 -3
- package/lib-esm/ui/icon/assets/pull-request.svg +0 -3
- package/lib-esm/ui/icon/assets/repository.svg +0 -3
- package/lib-esm/ui/icon/assets/warning.svg +0 -4
- package/src/components/bundle-assets/bundle-assets.container.js +0 -146
- package/src/components/bundle-assets/index.js +0 -4
- package/src/components/bundle-modules/bundle-modules.container.js +0 -158
- package/src/components/bundle-modules/index.js +0 -4
- package/src/components/bundle-packages/bundle-packages.container.js +0 -93
- package/src/components/bundle-packages/index.js +0 -4
- package/src/hocs/with-custom-sort.jsx +0 -35
- package/src/hocs/with-filtered-items.jsx +0 -34
- package/src/hocs/with-search.jsx +0 -184
- package/src/ui/icon/assets/arrow.svg +0 -4
- package/src/ui/icon/assets/branch.svg +0 -3
- package/src/ui/icon/assets/cancel.svg +0 -4
- package/src/ui/icon/assets/clock.svg +0 -3
- package/src/ui/icon/assets/close.svg +0 -4
- package/src/ui/icon/assets/commit.svg +0 -3
- package/src/ui/icon/assets/filter.svg +0 -4
- package/src/ui/icon/assets/help.svg +0 -4
- package/src/ui/icon/assets/job.svg +0 -3
- package/src/ui/icon/assets/menu.svg +0 -4
- package/src/ui/icon/assets/package.svg +0 -3
- package/src/ui/icon/assets/pull-request.svg +0 -3
- package/src/ui/icon/assets/repository.svg +0 -3
- package/src/ui/icon/assets/warning.svg +0 -4
|
@@ -5,32 +5,30 @@ import cx from 'classnames';
|
|
|
5
5
|
import { Icon } from '../../ui/icon';
|
|
6
6
|
import { Input } from '../../ui/input';
|
|
7
7
|
import css from './metrics-table-search.module.css';
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
export const MetricsTableSearch = props => {
|
|
9
|
+
const {
|
|
10
|
+
className,
|
|
11
|
+
placeholder,
|
|
12
|
+
search,
|
|
13
|
+
updateSearch
|
|
14
|
+
} = props;
|
|
15
|
+
const rootClassname = cx(css.root, className);
|
|
16
|
+
const [value, setValue] = useState(search); // Update local state when initial value has changed
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
value = _useState[0],
|
|
17
|
-
setValue = _useState[1]; // Update local state when initial value has changed
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
useEffect(function () {
|
|
18
|
+
useEffect(() => {
|
|
21
19
|
setValue(search);
|
|
22
20
|
}, [search]);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
const debouncedUpdateSearch = useCallback(_debounce(updateSearch, 500), []);
|
|
22
|
+
const handleChangeValue = useCallback(event => {
|
|
23
|
+
const newValue = event.target.value;
|
|
26
24
|
setValue(newValue); // Update parent state when the local value has changed
|
|
27
25
|
|
|
28
26
|
if (newValue !== search) {
|
|
29
27
|
debouncedUpdateSearch(newValue);
|
|
30
28
|
}
|
|
31
29
|
}, [search]);
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
const handleClearValue = useCallback(() => {
|
|
31
|
+
const newValue = '';
|
|
34
32
|
setValue(newValue);
|
|
35
33
|
updateSearch(newValue);
|
|
36
34
|
}, []);
|
|
@@ -41,7 +39,8 @@ export var MetricsTableSearch = function MetricsTableSearch(props) {
|
|
|
41
39
|
placeholder: placeholder,
|
|
42
40
|
onChange: handleChangeValue,
|
|
43
41
|
value: value,
|
|
44
|
-
size: "small"
|
|
42
|
+
size: "small",
|
|
43
|
+
autoComplete: "off"
|
|
45
44
|
}), search && /*#__PURE__*/React.createElement("button", {
|
|
46
45
|
className: css.cancelButton,
|
|
47
46
|
type: "button",
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
.input {
|
|
8
|
+
height: var(--space-large);
|
|
8
9
|
border-color: var(--color-outline);
|
|
9
10
|
}
|
|
10
11
|
|
|
@@ -26,7 +27,7 @@
|
|
|
26
27
|
padding: var(--space-xxsmall);
|
|
27
28
|
width: var(--space-large);
|
|
28
29
|
height: var(--space-large);
|
|
29
|
-
background: radial-gradient(var(--color-background)
|
|
30
|
+
background: radial-gradient(var(--color-background) 50%, transparent);
|
|
30
31
|
color: var(--color-text-ultra-light);
|
|
31
32
|
transition: var(--transition-in);
|
|
32
33
|
}
|
|
@@ -2,14 +2,11 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import { storiesOf } from '@storybook/react';
|
|
3
3
|
import { getWrapperDecorator } from '../../stories';
|
|
4
4
|
import { MetricsTableSearch } from '.';
|
|
5
|
-
|
|
5
|
+
const stories = storiesOf('Components/MetricsTableSearch', module);
|
|
6
6
|
stories.addDecorator(getWrapperDecorator());
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
search = _useState[0],
|
|
11
|
-
updateSearch = _useState[1];
|
|
12
|
-
|
|
8
|
+
const MetricsTableWithState = () => {
|
|
9
|
+
const [search, updateSearch] = useState('');
|
|
13
10
|
return /*#__PURE__*/React.createElement(MetricsTableSearch, {
|
|
14
11
|
placeholder: "Search name",
|
|
15
12
|
search: search,
|
|
@@ -17,6 +14,4 @@ var MetricsTableWithState = function MetricsTableWithState() {
|
|
|
17
14
|
});
|
|
18
15
|
};
|
|
19
16
|
|
|
20
|
-
stories.add('default',
|
|
21
|
-
return /*#__PURE__*/React.createElement(MetricsTableWithState, null);
|
|
22
|
-
});
|
|
17
|
+
stories.add('default', () => /*#__PURE__*/React.createElement(MetricsTableWithState, null));
|
|
@@ -6,13 +6,15 @@ import { FlexStack } from '../../layout/flex-stack';
|
|
|
6
6
|
import { Stack } from '../../layout/stack';
|
|
7
7
|
import { Popover } from '../../ui/popover';
|
|
8
8
|
import css from './metrics-table-title.module.css';
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
export const MetricsTableTitle = props => {
|
|
10
|
+
const {
|
|
11
|
+
className,
|
|
12
|
+
title,
|
|
13
|
+
info,
|
|
14
|
+
popoverInfo,
|
|
15
|
+
popoverHref
|
|
16
|
+
} = props;
|
|
17
|
+
const rootClassName = cx(css.root, className);
|
|
16
18
|
return /*#__PURE__*/React.createElement(Stack, {
|
|
17
19
|
space: "xxxsmall",
|
|
18
20
|
className: rootClassName
|
|
@@ -11,20 +11,22 @@ import { Stack } from '../../layout/stack';
|
|
|
11
11
|
import { FileName } from '../../ui/file-name';
|
|
12
12
|
import { ComponentLink } from '../component-link';
|
|
13
13
|
import css from './module-info.module.css';
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
export const ModuleInfo = props => {
|
|
15
|
+
const {
|
|
16
|
+
className,
|
|
17
|
+
item,
|
|
18
|
+
labels,
|
|
19
|
+
chunks,
|
|
20
|
+
chunkIds,
|
|
21
|
+
customComponentLink: CustomComponentLink,
|
|
22
|
+
onClick
|
|
23
|
+
} = props;
|
|
22
24
|
return /*#__PURE__*/React.createElement(Stack, {
|
|
23
25
|
space: "small",
|
|
24
26
|
className: className
|
|
25
|
-
}, item.runs.map(
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
}, item.runs.map((run, index) => {
|
|
28
|
+
const TitleComponent = index !== 0 ? 'h4' : 'h3';
|
|
29
|
+
const key = `module-info-${(run == null ? void 0 : run.name) || index}-${index}`;
|
|
28
30
|
return /*#__PURE__*/React.createElement(Stack, {
|
|
29
31
|
space: "xxxsmall",
|
|
30
32
|
key: key
|
|
@@ -32,8 +34,8 @@ export var ModuleInfo = function ModuleInfo(props) {
|
|
|
32
34
|
className: css.chunks
|
|
33
35
|
}, /*#__PURE__*/React.createElement("strong", {
|
|
34
36
|
className: css.chunksTitle
|
|
35
|
-
}, "Chunks:"), run.chunkIds.map(
|
|
36
|
-
|
|
37
|
+
}, "Chunks:"), run.chunkIds.map(chunkId => {
|
|
38
|
+
const chunk = _find(chunks, {
|
|
37
39
|
id: chunkId
|
|
38
40
|
});
|
|
39
41
|
|
|
@@ -2,26 +2,24 @@ import React from 'react';
|
|
|
2
2
|
import { storiesOf } from '@storybook/react';
|
|
3
3
|
import { getWrapperDecorator } from '../../stories';
|
|
4
4
|
import { ModuleInfo } from '.';
|
|
5
|
-
|
|
5
|
+
const stories = storiesOf('Components/ModuleInfo', module);
|
|
6
6
|
stories.addDecorator(getWrapperDecorator());
|
|
7
|
-
stories.add('default',
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
27
|
-
});
|
|
7
|
+
stories.add('default', () => /*#__PURE__*/React.createElement(ModuleInfo, {
|
|
8
|
+
item: {
|
|
9
|
+
runs: [{
|
|
10
|
+
key: './node_modules/lodash/fp/_baseConvert.js',
|
|
11
|
+
name: './node_modules/lodash/fp/_baseConvert.js',
|
|
12
|
+
chunkIds: ['2']
|
|
13
|
+
}, {
|
|
14
|
+
key: './node_modules/lodash/fp/_baseConvert.js',
|
|
15
|
+
name: './node_modules/lodash/fp/_baseConvert.js',
|
|
16
|
+
chunkIds: ['2']
|
|
17
|
+
}]
|
|
18
|
+
},
|
|
19
|
+
chunks: [{
|
|
20
|
+
id: '2',
|
|
21
|
+
name: 'vendors'
|
|
22
|
+
}],
|
|
23
|
+
chunkIds: ['1', '2'],
|
|
24
|
+
labels: ['Job #2', 'Job #1']
|
|
25
|
+
}));
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import _get from "lodash/get";
|
|
2
2
|
|
|
3
|
-
var _PropTypes$shape;
|
|
4
|
-
|
|
5
|
-
var _excluded = ["className"];
|
|
6
|
-
|
|
7
3
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
8
4
|
|
|
9
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
|
-
|
|
11
5
|
import React from 'react';
|
|
12
6
|
import PropTypes from 'prop-types';
|
|
13
7
|
import cx from 'classnames';
|
|
@@ -18,48 +12,38 @@ import { FlexStack } from '../../layout/flex-stack';
|
|
|
18
12
|
import { ComponentLink } from '../component-link';
|
|
19
13
|
import { SummaryItem } from '../summary-item';
|
|
20
14
|
import css from './summary.module.css';
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
key: metricId,
|
|
54
|
-
id: metricId,
|
|
55
|
-
data: _get(data, metricId),
|
|
56
|
-
loading: loading,
|
|
57
|
-
showMetricDescription: true,
|
|
58
|
-
showDelta: showSummaryItemDelta && metricOptions.showDelta !== false,
|
|
59
|
-
className: css.item
|
|
60
|
-
});
|
|
61
|
-
})));
|
|
62
|
-
};
|
|
15
|
+
export const Summary = ({
|
|
16
|
+
className,
|
|
17
|
+
size,
|
|
18
|
+
keys,
|
|
19
|
+
data,
|
|
20
|
+
loading,
|
|
21
|
+
showSummaryItemDelta,
|
|
22
|
+
summaryItemLink: SummaryItemCustomLink
|
|
23
|
+
}) => /*#__PURE__*/React.createElement(Box, {
|
|
24
|
+
outline: true,
|
|
25
|
+
className: cx(css.root, className)
|
|
26
|
+
}, /*#__PURE__*/React.createElement(FlexStack, {
|
|
27
|
+
className: css.items
|
|
28
|
+
}, Array.from(METRIC_COMPONENT_LINKS).filter(([metricId]) => keys.includes(metricId)).map(([metricId, metricOptions]) => /*#__PURE__*/React.createElement(SummaryItem, {
|
|
29
|
+
as: ({
|
|
30
|
+
className: itemClassName,
|
|
31
|
+
...itemProps
|
|
32
|
+
}) => /*#__PURE__*/React.createElement(Box, _extends({
|
|
33
|
+
padding: ['xsmall', 'small'],
|
|
34
|
+
className: cx(itemClassName, css.summaryItemLink)
|
|
35
|
+
}, itemProps, {
|
|
36
|
+
as: SummaryItemCustomLink
|
|
37
|
+
}, metricOptions.link)),
|
|
38
|
+
size: size,
|
|
39
|
+
key: metricId,
|
|
40
|
+
id: metricId,
|
|
41
|
+
data: _get(data, metricId),
|
|
42
|
+
loading: loading,
|
|
43
|
+
showMetricDescription: true,
|
|
44
|
+
showDelta: showSummaryItemDelta && metricOptions.showDelta !== false,
|
|
45
|
+
className: css.item
|
|
46
|
+
}))));
|
|
63
47
|
Summary.defaultProps = {
|
|
64
48
|
className: '',
|
|
65
49
|
data: null,
|
|
@@ -73,10 +57,12 @@ Summary.propTypes = {
|
|
|
73
57
|
className: PropTypes.string,
|
|
74
58
|
size: PropTypes.string,
|
|
75
59
|
keys: PropTypes.arrayOf(PropTypes.string),
|
|
76
|
-
data: PropTypes.shape(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
60
|
+
data: PropTypes.shape({
|
|
61
|
+
[PropTypes.string]: PropTypes.shape({
|
|
62
|
+
baseline: PropTypes.number,
|
|
63
|
+
current: PropTypes.number
|
|
64
|
+
})
|
|
65
|
+
}),
|
|
80
66
|
loading: PropTypes.bool,
|
|
81
67
|
showSummaryItemDelta: PropTypes.bool,
|
|
82
68
|
summaryItemLink: PropTypes.elementType
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
var _excluded = ["keyProps"];
|
|
2
|
-
|
|
3
1
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
2
|
|
|
5
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
|
-
|
|
7
3
|
import React from 'react';
|
|
8
4
|
import { storiesOf } from '@storybook/react';
|
|
9
5
|
import { createJobs } from '@bundle-stats/utils';
|
|
@@ -12,52 +8,38 @@ import currentData from '../../../__mocks__/webpack-stats.current.json';
|
|
|
12
8
|
import { METRICS_WEBPACK_ASSETS } from '../../constants';
|
|
13
9
|
import { getWrapperDecorator } from '../../stories';
|
|
14
10
|
import { Summary } from '.';
|
|
15
|
-
|
|
11
|
+
const MULTIPLE_JOBS = createJobs([{
|
|
16
12
|
webpack: currentData
|
|
17
13
|
}, {
|
|
18
14
|
webpack: baselineData
|
|
19
15
|
}]);
|
|
20
|
-
|
|
16
|
+
const SINGLE_JOB = createJobs([{
|
|
21
17
|
webpack: currentData
|
|
22
18
|
}]);
|
|
23
|
-
|
|
19
|
+
const stories = storiesOf('Components/Summary', module);
|
|
24
20
|
stories.addDecorator(getWrapperDecorator());
|
|
25
|
-
stories.add('default',
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
summaryItemLink: function summaryItemLink(_ref) {
|
|
51
|
-
var keyProps = _ref.keyProps,
|
|
52
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
53
|
-
|
|
54
|
-
return /*#__PURE__*/React.createElement("button", _extends({
|
|
55
|
-
type: "button"
|
|
56
|
-
}, props, {
|
|
57
|
-
onClick: function onClick() {
|
|
58
|
-
return alert(JSON.stringify(keyProps));
|
|
59
|
-
}
|
|
60
|
-
}));
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
});
|
|
21
|
+
stories.add('default', () => /*#__PURE__*/React.createElement(Summary, {
|
|
22
|
+
data: MULTIPLE_JOBS[0].summary
|
|
23
|
+
}));
|
|
24
|
+
stories.add('custom keys', () => /*#__PURE__*/React.createElement(Summary, {
|
|
25
|
+
keys: METRICS_WEBPACK_ASSETS,
|
|
26
|
+
data: MULTIPLE_JOBS[0].summary
|
|
27
|
+
}));
|
|
28
|
+
stories.add('loading', () => /*#__PURE__*/React.createElement(Summary, {
|
|
29
|
+
loading: true
|
|
30
|
+
}));
|
|
31
|
+
stories.add('single run', () => /*#__PURE__*/React.createElement(Summary, {
|
|
32
|
+
data: SINGLE_JOB[0].summary,
|
|
33
|
+
showSummaryItemDelta: false
|
|
34
|
+
}));
|
|
35
|
+
stories.add('with link', () => /*#__PURE__*/React.createElement(Summary, {
|
|
36
|
+
data: MULTIPLE_JOBS[0].summary,
|
|
37
|
+
summaryItemLink: ({
|
|
38
|
+
keyProps,
|
|
39
|
+
...props
|
|
40
|
+
}) => /*#__PURE__*/React.createElement("button", _extends({
|
|
41
|
+
type: "button"
|
|
42
|
+
}, props, {
|
|
43
|
+
onClick: () => alert(JSON.stringify(keyProps))
|
|
44
|
+
}))
|
|
45
|
+
}));
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
var _excluded = ["className", "as", "size", "id", "data", "loading", "showDelta", "showMetricDescription"];
|
|
2
|
-
|
|
3
1
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
2
|
|
|
5
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
|
-
|
|
7
3
|
import React from 'react';
|
|
8
4
|
import PropTypes from 'prop-types';
|
|
9
5
|
import cx from 'classnames';
|
|
@@ -16,12 +12,12 @@ import { Metric } from '../metric';
|
|
|
16
12
|
import { Delta } from '../delta';
|
|
17
13
|
import css from './summary-item.module.css';
|
|
18
14
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
const MetricInfo = ({
|
|
16
|
+
description,
|
|
17
|
+
url
|
|
18
|
+
}) => {
|
|
23
19
|
// Workaround cases where the parent is a link
|
|
24
|
-
|
|
20
|
+
const readMoreOnClick = () => {
|
|
25
21
|
window.open(url);
|
|
26
22
|
};
|
|
27
23
|
|
|
@@ -41,28 +37,28 @@ MetricInfo.propTypes = {
|
|
|
41
37
|
MetricInfo.defaultProps = {
|
|
42
38
|
url: ''
|
|
43
39
|
};
|
|
44
|
-
export
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
40
|
+
export const SummaryItem = ({
|
|
41
|
+
className,
|
|
42
|
+
as: Component,
|
|
43
|
+
size,
|
|
44
|
+
id,
|
|
45
|
+
data,
|
|
46
|
+
loading,
|
|
47
|
+
showDelta,
|
|
48
|
+
showMetricDescription,
|
|
49
|
+
...props
|
|
50
|
+
}) => {
|
|
51
|
+
const {
|
|
52
|
+
baseline,
|
|
53
|
+
current
|
|
54
|
+
} = data || {
|
|
56
55
|
baseline: 0,
|
|
57
56
|
current: 0
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
var runInfo = getMetricRunInfo(metric, current, baseline);
|
|
64
|
-
var showMetricDescriptionTooltip = showMetricDescription && (metric == null ? void 0 : metric.description);
|
|
65
|
-
var rootClassName = cx(css.root, className, css[size], showMetricDescription && css.showMetricDescription, showMetricDescriptionTooltip && css.showMetricDescription, showDelta && css.showDelta);
|
|
57
|
+
};
|
|
58
|
+
const metric = getGlobalMetricType(id);
|
|
59
|
+
const runInfo = getMetricRunInfo(metric, current, baseline);
|
|
60
|
+
const showMetricDescriptionTooltip = showMetricDescription && (metric == null ? void 0 : metric.description);
|
|
61
|
+
const rootClassName = cx(css.root, className, css[size], showMetricDescription && css.showMetricDescription, showMetricDescriptionTooltip && css.showMetricDescription, showDelta && css.showDelta);
|
|
66
62
|
return /*#__PURE__*/React.createElement(Stack, _extends({
|
|
67
63
|
space: "xxsmall",
|
|
68
64
|
as: Component,
|
|
@@ -2,56 +2,46 @@ import React from 'react';
|
|
|
2
2
|
import { storiesOf } from '@storybook/react';
|
|
3
3
|
import { getWrapperDecorator } from '../../stories';
|
|
4
4
|
import { SummaryItem } from './summary-item';
|
|
5
|
-
|
|
5
|
+
const stories = storiesOf('Components/SummaryItem', module);
|
|
6
6
|
stories.addDecorator(getWrapperDecorator({
|
|
7
7
|
maxWidth: '320px'
|
|
8
8
|
}));
|
|
9
|
-
stories.add('default',
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
showDelta: false
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
stories.add('loading', function () {
|
|
53
|
-
return /*#__PURE__*/React.createElement(SummaryItem, {
|
|
54
|
-
loading: true,
|
|
55
|
-
id: "webpack.totalSizeByTypeALL"
|
|
56
|
-
});
|
|
57
|
-
});
|
|
9
|
+
stories.add('default', () => /*#__PURE__*/React.createElement(SummaryItem, {
|
|
10
|
+
loading: false,
|
|
11
|
+
id: "webpack.totalSizeByTypeALL",
|
|
12
|
+
data: {
|
|
13
|
+
current: 120 * 1000,
|
|
14
|
+
baseline: 100 * 1000
|
|
15
|
+
}
|
|
16
|
+
}));
|
|
17
|
+
stories.add('size large', () => /*#__PURE__*/React.createElement(SummaryItem, {
|
|
18
|
+
size: "large",
|
|
19
|
+
loading: false,
|
|
20
|
+
id: "webpack.totalSizeByTypeALL",
|
|
21
|
+
data: {
|
|
22
|
+
current: 120 * 1000,
|
|
23
|
+
baseline: 100 * 1000
|
|
24
|
+
}
|
|
25
|
+
}));
|
|
26
|
+
stories.add('showMetricDescription', () => /*#__PURE__*/React.createElement(SummaryItem, {
|
|
27
|
+
loading: false,
|
|
28
|
+
id: "webpack.totalSizeByTypeALL",
|
|
29
|
+
data: {
|
|
30
|
+
current: 120 * 1000,
|
|
31
|
+
baseline: 100 * 1000
|
|
32
|
+
},
|
|
33
|
+
showMetricDescription: true
|
|
34
|
+
}));
|
|
35
|
+
stories.add('showDelta false', () => /*#__PURE__*/React.createElement(SummaryItem, {
|
|
36
|
+
loading: false,
|
|
37
|
+
id: "webpack.totalSizeByTypeALL",
|
|
38
|
+
data: {
|
|
39
|
+
current: 120 * 1000,
|
|
40
|
+
baseline: 0
|
|
41
|
+
},
|
|
42
|
+
showDelta: false
|
|
43
|
+
}));
|
|
44
|
+
stories.add('loading', () => /*#__PURE__*/React.createElement(SummaryItem, {
|
|
45
|
+
loading: true,
|
|
46
|
+
id: "webpack.totalSizeByTypeALL"
|
|
47
|
+
}));
|
|
@@ -7,21 +7,20 @@ import { FlexStack } from '../../layout/flex-stack';
|
|
|
7
7
|
import { Stack } from '../../layout/stack';
|
|
8
8
|
import { Popover } from '../../ui/popover';
|
|
9
9
|
import css from './total-size-type-title.module.css';
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
10
|
+
export const TotalSizeTypeTitle = ({
|
|
11
|
+
className
|
|
12
|
+
}) => /*#__PURE__*/React.createElement(FlexStack, {
|
|
13
|
+
space: "xxxsmall",
|
|
14
|
+
className: cx(css.title, className)
|
|
15
|
+
}, /*#__PURE__*/React.createElement("span", null, I18N.ASSET_TOTALS), /*#__PURE__*/React.createElement(Popover, {
|
|
16
|
+
icon: "help"
|
|
17
|
+
}, /*#__PURE__*/React.createElement(Stack, {
|
|
18
|
+
space: "xxxsmall"
|
|
19
|
+
}, /*#__PURE__*/React.createElement("p", null, I18N.ASSET_TOTALS_INFO), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("a", {
|
|
20
|
+
href: config.documentation.assets,
|
|
21
|
+
target: "_blank",
|
|
22
|
+
rel: "noreferrer"
|
|
23
|
+
}, I18N.READ_MORE)))));
|
|
25
24
|
TotalSizeTypeTitle.propTypes = {
|
|
26
25
|
className: PropTypes.string
|
|
27
26
|
};
|