@bundle-stats/ui 3.2.1 → 3.3.0-alpha.1
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 +56 -0
- package/lib/app/app.js +31 -6
- package/lib/app/app.stories.js +31 -3
- package/lib/assets/icons/alert-circle.svg +1 -0
- package/lib/assets/icons/arrow-right-circle.svg +1 -0
- package/lib/assets/icons/check-circle.svg +1 -0
- package/lib/assets/icons/close.svg +1 -1
- package/lib/assets/icons.svg +50 -1
- package/lib/components/browsertime-table/browsertime-table.js +1 -1
- package/lib/components/browsertime-table/browsertime-table.stories.js +1 -1
- package/lib/components/budget-info/budget-info.js +80 -0
- package/lib/components/budget-info/budget-info.module.css +40 -0
- package/lib/components/budget-info/budget-info.stories.js +44 -0
- package/lib/components/budget-info/index.js +18 -0
- package/lib/components/budget-insights/budget-insights.js +200 -0
- package/lib/components/budget-insights/budget-insights.module.css +53 -0
- package/lib/components/budget-insights/budget-insights.stories.js +104 -0
- package/lib/components/budget-insights/index.js +18 -0
- package/lib/components/bundle-assets/bundle-assets.js +3 -3
- package/lib/components/bundle-assets/bundle-assets.utils.js +2 -2
- package/lib/components/bundle-assets/index.js +3 -3
- package/lib/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js +1 -1
- package/lib/components/bundle-assets-totals-table/bundle-assets-totals-table.js +44 -8
- package/lib/components/bundle-assets-totals-table/bundle-assets-totals-table.module.css +2 -2
- package/lib/components/bundle-assets-totals-table/bundle-assets-totals-table.stories.js +58 -43
- package/lib/components/bundle-modules/bundle-modules.js +3 -3
- package/lib/components/bundle-modules/bundle-modules.utils.js +2 -2
- package/lib/components/bundle-modules/index.js +3 -3
- package/lib/components/bundle-packages/bundle-packages.js +1 -1
- package/lib/components/bundle-packages/bundle-packages.utils.js +2 -2
- package/lib/components/bundle-packages/index.js +1 -1
- package/lib/components/index.js +8 -0
- package/lib/components/lighthouse-table/lighthouse-table.js +1 -1
- package/lib/components/metrics-table/metrics-table.js +1 -1
- package/lib/components/metrics-table-search/metrics-table-search.js +1 -1
- package/lib/components/metrics-table-search/metrics-table-search.stories.js +1 -1
- package/lib/components/summary/summary.js +40 -62
- package/lib/components/summary/summary.module.css +31 -14
- package/lib/components/summary/summary.stories.js +29 -0
- package/lib/components/summary-item/summary-item.js +30 -13
- package/lib/components/summary-item/summary-item.module.css +18 -9
- package/lib/components/summary-item/summary-item.stories.js +67 -52
- package/lib/constants.js +6 -6
- package/lib/css/variables.css +15 -11
- package/lib/hooks/search-params.js +2 -2
- package/lib/query-state.js +1 -1
- package/lib/stories/wrapper.js +2 -2
- package/lib/ui/alert/alert.js +13 -3
- package/lib/ui/filters/filters.container.js +5 -5
- package/lib/ui/filters/filters.js +2 -2
- package/lib/ui/filters/filters.stories.js +3 -3
- package/lib/ui/horizontal-bar-chart/horizontal-bar-chart.js +3 -3
- package/lib/ui/icon/icon.js +3 -0
- package/lib/ui/icon/icon.stories.js +40 -22
- package/lib/ui/panels/panels.js +2 -2
- package/lib/ui/popover/popover.js +3 -3
- package/lib/ui/popover/popover.module.css +2 -1
- package/lib/ui/tabs/tabs.js +2 -2
- package/lib/ui/tooltip/tooltip.module.css +1 -0
- package/lib/utils.js +2 -2
- package/lib-esm/app/app.js +57 -31
- package/lib-esm/app/app.stories.js +29 -1
- package/lib-esm/assets/icons/alert-circle.svg +1 -0
- package/lib-esm/assets/icons/arrow-right-circle.svg +1 -0
- package/lib-esm/assets/icons/check-circle.svg +1 -0
- package/lib-esm/assets/icons/close.svg +1 -1
- package/lib-esm/assets/icons.svg +50 -1
- package/lib-esm/components/budget-info/budget-info.js +58 -0
- package/lib-esm/components/budget-info/budget-info.module.css +40 -0
- package/lib-esm/components/budget-info/budget-info.stories.js +30 -0
- package/lib-esm/components/budget-info/index.js +1 -0
- package/lib-esm/components/budget-insights/budget-insights.js +148 -0
- package/lib-esm/components/budget-insights/budget-insights.module.css +53 -0
- package/lib-esm/components/budget-insights/budget-insights.stories.js +84 -0
- package/lib-esm/components/budget-insights/index.js +1 -0
- package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.js +23 -7
- package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.module.css +2 -2
- package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.stories.js +46 -21
- package/lib-esm/components/index.js +1 -0
- package/lib-esm/components/summary/summary.js +26 -45
- package/lib-esm/components/summary/summary.module.css +31 -14
- package/lib-esm/components/summary/summary.stories.js +27 -0
- package/lib-esm/components/summary-item/summary-item.js +28 -12
- package/lib-esm/components/summary-item/summary-item.module.css +18 -9
- package/lib-esm/components/summary-item/summary-item.stories.js +52 -42
- package/lib-esm/constants.js +4 -4
- package/lib-esm/css/variables.css +15 -11
- package/lib-esm/ui/alert/alert.js +6 -3
- package/lib-esm/ui/filters/filters.container.js +39 -41
- package/lib-esm/ui/icon/icon.js +3 -0
- package/lib-esm/ui/icon/icon.stories.js +22 -11
- package/lib-esm/ui/popover/popover.js +2 -2
- package/lib-esm/ui/popover/popover.module.css +2 -1
- package/lib-esm/ui/tooltip/tooltip.module.css +1 -0
- package/package.json +15 -15
- package/src/app/app.jsx +24 -8
- package/src/assets/icons/alert-circle.svg +1 -0
- package/src/assets/icons/arrow-right-circle.svg +1 -0
- package/src/assets/icons/check-circle.svg +1 -0
- package/src/assets/icons/close.svg +1 -1
- package/src/assets/icons.svg +50 -1
- package/src/components/budget-info/budget-info.jsx +65 -0
- package/src/components/budget-info/budget-info.module.css +40 -0
- package/src/components/budget-info/index.js +1 -0
- package/src/components/budget-insights/budget-insights.jsx +157 -0
- package/src/components/budget-insights/budget-insights.module.css +53 -0
- package/src/components/budget-insights/index.js +1 -0
- package/src/components/bundle-assets-totals-table/bundle-assets-totals-table.jsx +27 -13
- package/src/components/bundle-assets-totals-table/bundle-assets-totals-table.module.css +2 -2
- package/src/components/index.js +1 -0
- package/src/components/summary/summary.jsx +26 -44
- package/src/components/summary/summary.module.css +31 -14
- package/src/components/summary-item/summary-item.jsx +26 -24
- package/src/components/summary-item/summary-item.module.css +18 -9
- package/src/constants.js +7 -7
- package/src/css/variables.css +15 -11
- package/src/ui/alert/alert.jsx +7 -2
- package/src/ui/icon/icon.jsx +3 -0
- package/src/ui/popover/popover.jsx +3 -3
- package/src/ui/popover/popover.module.css +2 -1
- package/src/ui/tooltip/tooltip.module.css +1 -0
|
@@ -10,9 +10,10 @@ import { Stack } from '../../layout/stack';
|
|
|
10
10
|
import { FlexStack } from '../../layout/flex-stack';
|
|
11
11
|
import { Metric } from '../metric';
|
|
12
12
|
import { Delta } from '../delta';
|
|
13
|
+
import { BudgetInfo } from '../budget-info';
|
|
13
14
|
import css from './summary-item.module.css';
|
|
14
15
|
|
|
15
|
-
const
|
|
16
|
+
const MetricInfoPopover = _ref => {
|
|
16
17
|
let {
|
|
17
18
|
description,
|
|
18
19
|
url
|
|
@@ -32,11 +33,11 @@ const MetricInfo = _ref => {
|
|
|
32
33
|
}, "Read more")));
|
|
33
34
|
};
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
MetricInfoPopover.propTypes = {
|
|
36
37
|
description: PropTypes.string.isRequired,
|
|
37
38
|
url: PropTypes.string
|
|
38
39
|
};
|
|
39
|
-
|
|
40
|
+
MetricInfoPopover.defaultProps = {
|
|
40
41
|
url: ''
|
|
41
42
|
};
|
|
42
43
|
export const SummaryItem = _ref2 => {
|
|
@@ -49,6 +50,7 @@ export const SummaryItem = _ref2 => {
|
|
|
49
50
|
loading,
|
|
50
51
|
showDelta,
|
|
51
52
|
showMetricDescription,
|
|
53
|
+
budget,
|
|
52
54
|
...props
|
|
53
55
|
} = _ref2;
|
|
54
56
|
const {
|
|
@@ -61,7 +63,7 @@ export const SummaryItem = _ref2 => {
|
|
|
61
63
|
const metric = getGlobalMetricType(id);
|
|
62
64
|
const runInfo = getMetricRunInfo(metric, current, baseline);
|
|
63
65
|
const showMetricDescriptionTooltip = showMetricDescription && (metric == null ? void 0 : metric.description);
|
|
64
|
-
const rootClassName = cx(css.root, className, css[size],
|
|
66
|
+
const rootClassName = cx(css.root, className, css[size], showDelta && css.showDelta);
|
|
65
67
|
return /*#__PURE__*/React.createElement(Stack, _extends({
|
|
66
68
|
space: "xxsmall",
|
|
67
69
|
as: Component,
|
|
@@ -70,10 +72,16 @@ export const SummaryItem = _ref2 => {
|
|
|
70
72
|
as: "h3",
|
|
71
73
|
space: "xxxsmall",
|
|
72
74
|
className: css.title
|
|
73
|
-
}, /*#__PURE__*/React.createElement("span",
|
|
75
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
76
|
+
className: css.titleLabel
|
|
77
|
+
}, metric.label), showMetricDescriptionTooltip && /*#__PURE__*/React.createElement(Popover, {
|
|
74
78
|
className: css.icon,
|
|
75
79
|
icon: "help"
|
|
76
|
-
}, /*#__PURE__*/React.createElement(
|
|
80
|
+
}, /*#__PURE__*/React.createElement(MetricInfoPopover, metric)), budget && /*#__PURE__*/React.createElement(BudgetInfo, {
|
|
81
|
+
className: css.budgetInfo,
|
|
82
|
+
metricId: id,
|
|
83
|
+
budgetInsight: budget
|
|
84
|
+
})), !loading ? /*#__PURE__*/React.createElement(Stack, null, /*#__PURE__*/React.createElement(Metric, {
|
|
77
85
|
className: css.currentMetric,
|
|
78
86
|
value: current,
|
|
79
87
|
formatter: metric.formatter,
|
|
@@ -83,13 +91,13 @@ export const SummaryItem = _ref2 => {
|
|
|
83
91
|
className: css.delta,
|
|
84
92
|
displayValue: runInfo.displayDeltaPercentage,
|
|
85
93
|
deltaType: runInfo.deltaType
|
|
86
|
-
}))
|
|
87
|
-
className: cx(css.currentMetric, css.loading)
|
|
88
|
-
}), !loading ? /*#__PURE__*/React.createElement(Metric, {
|
|
94
|
+
})), /*#__PURE__*/React.createElement(Metric, {
|
|
89
95
|
className: css.baselineMetric,
|
|
90
96
|
value: baseline,
|
|
91
97
|
formatter: metric.formatter
|
|
92
|
-
}) : /*#__PURE__*/React.createElement(Skeleton, {
|
|
98
|
+
})) : /*#__PURE__*/React.createElement(Stack, null, /*#__PURE__*/React.createElement(Skeleton, {
|
|
99
|
+
className: cx(css.currentMetric, css.loading)
|
|
100
|
+
}), /*#__PURE__*/React.createElement(Skeleton, {
|
|
93
101
|
className: cx(css.baselineMetric, css.loading)
|
|
94
102
|
})));
|
|
95
103
|
};
|
|
@@ -100,7 +108,8 @@ SummaryItem.defaultProps = {
|
|
|
100
108
|
size: 'medium',
|
|
101
109
|
loading: false,
|
|
102
110
|
showMetricDescription: false,
|
|
103
|
-
showDelta: true
|
|
111
|
+
showDelta: true,
|
|
112
|
+
budget: undefined
|
|
104
113
|
};
|
|
105
114
|
SummaryItem.propTypes = {
|
|
106
115
|
/** Adopted child class name */
|
|
@@ -126,5 +135,12 @@ SummaryItem.propTypes = {
|
|
|
126
135
|
showMetricDescription: PropTypes.bool,
|
|
127
136
|
|
|
128
137
|
/** Show delta */
|
|
129
|
-
showDelta: PropTypes.bool
|
|
138
|
+
showDelta: PropTypes.bool,
|
|
139
|
+
|
|
140
|
+
/** Budget insight data */
|
|
141
|
+
budget: PropTypes.shape({
|
|
142
|
+
currentBalue: PropTypes.number,
|
|
143
|
+
budgetValue: PropTypes.number,
|
|
144
|
+
failed: PropTypes.bool
|
|
145
|
+
})
|
|
130
146
|
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
position: relative;
|
|
3
|
+
padding-right: var(--space-xlarge);
|
|
4
|
+
}
|
|
5
|
+
|
|
1
6
|
.title {
|
|
2
|
-
margin: 0;
|
|
3
7
|
color: var(--color-text-ultra-light);
|
|
4
8
|
font-weight: bold;
|
|
5
9
|
font-size: var(--size-xsmall);
|
|
@@ -8,6 +12,10 @@
|
|
|
8
12
|
white-space: nowrap;
|
|
9
13
|
}
|
|
10
14
|
|
|
15
|
+
.titleLabel {
|
|
16
|
+
flex: 0 0 auto;
|
|
17
|
+
}
|
|
18
|
+
|
|
11
19
|
.readMoreBtn {
|
|
12
20
|
appearance: none;
|
|
13
21
|
padding: 0;
|
|
@@ -27,24 +35,30 @@
|
|
|
27
35
|
text-decoration: none;
|
|
28
36
|
}
|
|
29
37
|
|
|
38
|
+
.budgetInfo {
|
|
39
|
+
position: absolute;
|
|
40
|
+
right: 0;
|
|
41
|
+
top: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
30
44
|
.currentMetric {
|
|
31
45
|
display: block;
|
|
32
46
|
color: var(--color-heading);
|
|
33
47
|
font-size: var(--size-large);
|
|
34
|
-
line-height:
|
|
48
|
+
line-height: var(--space-medium);
|
|
35
49
|
white-space: nowrap;
|
|
36
50
|
font-weight: bold;
|
|
37
51
|
}
|
|
38
52
|
|
|
39
53
|
.delta {
|
|
40
|
-
margin: var(--space-xxxsmall) 0 0;
|
|
41
54
|
font-size: var(--size-small);
|
|
55
|
+
line-height: var(--space-medium);
|
|
42
56
|
}
|
|
43
57
|
|
|
44
58
|
.baselineMetric {
|
|
45
59
|
color: var(--color-text-light);
|
|
46
60
|
font-size: var(--size-small);
|
|
47
|
-
line-height:
|
|
61
|
+
line-height: var(--space-small);
|
|
48
62
|
}
|
|
49
63
|
|
|
50
64
|
/* Loading state */
|
|
@@ -60,9 +74,4 @@
|
|
|
60
74
|
.large .currentMetric {
|
|
61
75
|
font-size: var(--size-xxxlarge);
|
|
62
76
|
line-height: var(--space-medium);
|
|
63
|
-
min-height: var(--space-medium);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.large .baselineMetric {
|
|
67
|
-
font-size: var(--size-medium);
|
|
68
77
|
}
|
|
@@ -1,47 +1,57 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { storiesOf } from '@storybook/react';
|
|
3
|
-
import { getWrapperDecorator } from '../../stories';
|
|
4
2
|
import { SummaryItem } from './summary-item';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Components/SummaryItem',
|
|
5
|
+
component: SummaryItem,
|
|
6
|
+
decorators: [Story => /*#__PURE__*/React.createElement("div", {
|
|
7
|
+
style: {
|
|
8
|
+
maxWidth: '320px'
|
|
9
|
+
}
|
|
10
|
+
}, /*#__PURE__*/React.createElement(Story, null))],
|
|
11
|
+
args: {
|
|
12
|
+
loading: false,
|
|
13
|
+
id: 'webpack.totalSizeByTypeALL',
|
|
14
|
+
data: {
|
|
15
|
+
current: 120 * 1000,
|
|
16
|
+
baseline: 100 * 1000
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
loading: false,
|
|
28
|
-
id: "webpack.totalSizeByTypeALL",
|
|
29
|
-
data: {
|
|
30
|
-
current: 120 * 1000,
|
|
31
|
-
baseline: 100 * 1000
|
|
32
|
-
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const Template = args => /*#__PURE__*/React.createElement(SummaryItem, args);
|
|
22
|
+
|
|
23
|
+
export const Standard = Template.bind();
|
|
24
|
+
export const SizeLarge = Template.bind();
|
|
25
|
+
SizeLarge.args = {
|
|
26
|
+
size: 'large'
|
|
27
|
+
};
|
|
28
|
+
export const ShowMetricDescription = Template.bind();
|
|
29
|
+
ShowMetricDescription.args = {
|
|
33
30
|
showMetricDescription: true
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
id: "webpack.totalSizeByTypeALL",
|
|
38
|
-
data: {
|
|
39
|
-
current: 120 * 1000,
|
|
40
|
-
baseline: 0
|
|
41
|
-
},
|
|
31
|
+
};
|
|
32
|
+
export const ShowDeltaFalse = Template.bind();
|
|
33
|
+
ShowDeltaFalse.args = {
|
|
42
34
|
showDelta: false
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
35
|
+
};
|
|
36
|
+
export const BudgetError = Template.bind();
|
|
37
|
+
BudgetError.args = {
|
|
38
|
+
showMetricDescription: true,
|
|
39
|
+
budget: {
|
|
40
|
+
currentValue: 120 * 1000,
|
|
41
|
+
budgetValue: 100 * 1000,
|
|
42
|
+
failed: true
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
export const BudgetSuccess = Template.bind();
|
|
46
|
+
BudgetSuccess.args = {
|
|
47
|
+
showMetricDescription: true,
|
|
48
|
+
budget: {
|
|
49
|
+
currentValue: 120 * 1000,
|
|
50
|
+
budgetValue: 120 * 1024,
|
|
51
|
+
failed: false
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
export const Loading = Template.bind();
|
|
55
|
+
Loading.args = {
|
|
56
|
+
loading: true
|
|
57
|
+
};
|
package/lib-esm/constants.js
CHANGED
|
@@ -25,7 +25,7 @@ export const SECTION_URLS = {
|
|
|
25
25
|
export const ASSETS_SIZES_FILE_TYPE_MAP = FILE_TYPES.reduce((agg, fileType) => ({ ...agg,
|
|
26
26
|
[`webpack.sizes.totalSizeByType${fileType}`]: fileType
|
|
27
27
|
}), {});
|
|
28
|
-
export const METRICS_WEBPACK_GENERAL = ['
|
|
29
|
-
export const METRICS_WEBPACK_ASSETS = ['
|
|
30
|
-
export const METRICS_WEBPACK_MODULES = ['
|
|
31
|
-
export const METRICS_WEBPACK_PACKAGES = ['
|
|
28
|
+
export const METRICS_WEBPACK_GENERAL = ['totalSizeByTypeALL', 'totalInitialSizeJS', 'totalInitialSizeCSS', 'cacheInvalidation'];
|
|
29
|
+
export const METRICS_WEBPACK_ASSETS = ['assetCount', 'chunkCount'];
|
|
30
|
+
export const METRICS_WEBPACK_MODULES = ['moduleCount'];
|
|
31
|
+
export const METRICS_WEBPACK_PACKAGES = ['packageCount', 'duplicatePackagesCount'];
|
|
@@ -27,20 +27,20 @@
|
|
|
27
27
|
|
|
28
28
|
/*
|
|
29
29
|
* Color scheme:
|
|
30
|
-
* http://mcg.mbitson.com/#!?mcgpalette0=%23dd555e&mcgpalette1=%2363bf5e&mcgpalette2=%23f7e37d&mcgpalette3=%
|
|
30
|
+
* http://mcg.mbitson.com/#!?mcgpalette0=%23dd555e&mcgpalette1=%2363bf5e&mcgpalette2=%23f7e37d&mcgpalette3=%23636568&mcgpalette4=%233385d6&themename=mcgtheme
|
|
31
31
|
* https://coolors.co/3385d6-dd555e-63bf5e-f7e37d-192339
|
|
32
32
|
*/
|
|
33
33
|
--color-gray-25: #fafafa;
|
|
34
|
-
--color-gray-50: #
|
|
35
|
-
--color-gray-100: #
|
|
36
|
-
--color-gray-200: #
|
|
37
|
-
--color-gray-300: #
|
|
38
|
-
--color-gray-400: #
|
|
39
|
-
--color-gray-500: #
|
|
40
|
-
--color-gray-600: #
|
|
41
|
-
--color-gray-700: #
|
|
42
|
-
--color-gray-800: #
|
|
43
|
-
--color-gray-900: #
|
|
34
|
+
--color-gray-50: #eceded;
|
|
35
|
+
--color-gray-100: #d0d1d2;
|
|
36
|
+
--color-gray-200: #b1b2b4;
|
|
37
|
+
--color-gray-300: #929395;
|
|
38
|
+
--color-gray-400: #7a7c7f;
|
|
39
|
+
--color-gray-500: #636568;
|
|
40
|
+
--color-gray-600: #5b5d60;
|
|
41
|
+
--color-gray-700: #515355;
|
|
42
|
+
--color-gray-800: #47494b;
|
|
43
|
+
--color-gray-900: #35373a;
|
|
44
44
|
|
|
45
45
|
--color-gray-ultra-light: var(--color-gray-200);
|
|
46
46
|
--color-gray-light: var(--color-gray-300);
|
|
@@ -181,6 +181,10 @@
|
|
|
181
181
|
--layer-high: 1000;
|
|
182
182
|
--layer-xhigh: 10000;
|
|
183
183
|
|
|
184
|
+
--radius-small: var(--space-xxxsmall);
|
|
185
|
+
--radius-medium: var(--space-xxsmall);
|
|
186
|
+
--radius-large: var(--space-small);
|
|
187
|
+
|
|
184
188
|
/** Layout */
|
|
185
189
|
--max-width: 80rem;
|
|
186
190
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
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); }
|
|
2
|
+
|
|
1
3
|
import React from 'react';
|
|
2
4
|
import cx from 'classnames';
|
|
3
5
|
import PropTypes from 'prop-types';
|
|
@@ -7,13 +9,14 @@ export const Alert = props => {
|
|
|
7
9
|
const {
|
|
8
10
|
className,
|
|
9
11
|
kind,
|
|
10
|
-
children
|
|
12
|
+
children,
|
|
13
|
+
...restProps
|
|
11
14
|
} = props;
|
|
12
|
-
return /*#__PURE__*/React.createElement(Box, {
|
|
15
|
+
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
13
16
|
padding: ['xsmall', 'small'],
|
|
14
17
|
outline: true,
|
|
15
18
|
className: cx(css.root, className, css[kind])
|
|
16
|
-
}, children);
|
|
19
|
+
}, restProps), children);
|
|
17
20
|
};
|
|
18
21
|
Alert.propTypes = {
|
|
19
22
|
className: PropTypes.string,
|
|
@@ -28,45 +28,6 @@ export const filtersDropdownContainer = BaseComponent => {
|
|
|
28
28
|
class FiltersContainer extends React.Component {
|
|
29
29
|
constructor(props) {
|
|
30
30
|
super(props);
|
|
31
|
-
|
|
32
|
-
this.toggleFilter = (key, value) => this.setState(_ref2 => {
|
|
33
|
-
let {
|
|
34
|
-
values,
|
|
35
|
-
...state
|
|
36
|
-
} = _ref2;
|
|
37
|
-
const newState = { ...state,
|
|
38
|
-
values: { ...values,
|
|
39
|
-
[key]: value
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
const {
|
|
43
|
-
onChange
|
|
44
|
-
} = this.props;
|
|
45
|
-
|
|
46
|
-
if (onChange) {
|
|
47
|
-
onChange(newState.values);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return newState;
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
this.toggleFilters = newFilters => this.setState(prevState => {
|
|
54
|
-
const newState = { ...prevState,
|
|
55
|
-
values: { ...prevState.values,
|
|
56
|
-
...newFilters
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
const {
|
|
60
|
-
onChange
|
|
61
|
-
} = this.props;
|
|
62
|
-
|
|
63
|
-
if (onChange) {
|
|
64
|
-
onChange(newState.values);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return newState;
|
|
68
|
-
});
|
|
69
|
-
|
|
70
31
|
const {
|
|
71
32
|
filters
|
|
72
33
|
} = this.props;
|
|
@@ -75,10 +36,10 @@ export const filtersDropdownContainer = BaseComponent => {
|
|
|
75
36
|
};
|
|
76
37
|
}
|
|
77
38
|
|
|
78
|
-
static getDerivedStateFromProps(
|
|
39
|
+
static getDerivedStateFromProps(_ref2, state) {
|
|
79
40
|
let {
|
|
80
41
|
filters
|
|
81
|
-
} =
|
|
42
|
+
} = _ref2;
|
|
82
43
|
|
|
83
44
|
if (_isEqual(filters, state.values)) {
|
|
84
45
|
return null;
|
|
@@ -89,6 +50,43 @@ export const filtersDropdownContainer = BaseComponent => {
|
|
|
89
50
|
};
|
|
90
51
|
}
|
|
91
52
|
|
|
53
|
+
toggleFilter = (key, value) => this.setState(_ref3 => {
|
|
54
|
+
let {
|
|
55
|
+
values,
|
|
56
|
+
...state
|
|
57
|
+
} = _ref3;
|
|
58
|
+
const newState = { ...state,
|
|
59
|
+
values: { ...values,
|
|
60
|
+
[key]: value
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const {
|
|
64
|
+
onChange
|
|
65
|
+
} = this.props;
|
|
66
|
+
|
|
67
|
+
if (onChange) {
|
|
68
|
+
onChange(newState.values);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return newState;
|
|
72
|
+
});
|
|
73
|
+
toggleFilters = newFilters => this.setState(prevState => {
|
|
74
|
+
const newState = { ...prevState,
|
|
75
|
+
values: { ...prevState.values,
|
|
76
|
+
...newFilters
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const {
|
|
80
|
+
onChange
|
|
81
|
+
} = this.props;
|
|
82
|
+
|
|
83
|
+
if (onChange) {
|
|
84
|
+
onChange(newState.values);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return newState;
|
|
88
|
+
});
|
|
89
|
+
|
|
92
90
|
render() {
|
|
93
91
|
return /*#__PURE__*/React.createElement(BaseComponent, _extends({}, this.props, this.state, {
|
|
94
92
|
toggleFilter: this.toggleFilter,
|
package/lib-esm/ui/icon/icon.js
CHANGED
|
@@ -5,10 +5,13 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import cx from 'classnames';
|
|
6
6
|
import css from './icon.module.css';
|
|
7
7
|
const ICONS = {
|
|
8
|
+
ALERT_CIRCLE: 'alert-circle',
|
|
8
9
|
ARROW: 'arrow',
|
|
10
|
+
ARROW_RIGHT_CIRLCE: 'arrow-right-circle',
|
|
9
11
|
CANCEL: 'cancel',
|
|
10
12
|
CLOSE: 'close',
|
|
11
13
|
CLOCK: 'clock',
|
|
14
|
+
CHECK_CIRCLE: 'check-circle',
|
|
12
15
|
COMMIT: 'commit',
|
|
13
16
|
FILTER: 'filter',
|
|
14
17
|
HELP: 'help',
|
|
@@ -1,21 +1,32 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { storiesOf } from '@storybook/react';
|
|
3
|
-
import { getWrapperDecorator } from '../../stories';
|
|
4
2
|
import { Icon } from '.';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
export default {
|
|
4
|
+
title: 'UI/Icon',
|
|
5
|
+
component: Icon
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const Template = args => /*#__PURE__*/React.createElement(Icon, args);
|
|
9
|
+
|
|
10
|
+
export const Standard = Template.bind();
|
|
11
|
+
Standard.args = {
|
|
8
12
|
glyph: Icon.ICONS.ARROW
|
|
9
|
-
}
|
|
10
|
-
|
|
13
|
+
};
|
|
14
|
+
export const CustomSize = Template.bind();
|
|
15
|
+
CustomSize.args = {
|
|
11
16
|
glyph: Icon.ICONS.ARROW,
|
|
12
17
|
size: Icon.SIZE_LARGE
|
|
13
|
-
}
|
|
14
|
-
|
|
18
|
+
};
|
|
19
|
+
export const All = () => /*#__PURE__*/React.createElement(React.Fragment, null, Object.values(Icon.ICONS).map(glyph => /*#__PURE__*/React.createElement("div", {
|
|
15
20
|
style: {
|
|
16
|
-
|
|
21
|
+
display: 'inline-block',
|
|
22
|
+
padding: '1rem',
|
|
23
|
+
textAlign: 'center'
|
|
17
24
|
}
|
|
18
25
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
19
26
|
glyph: glyph,
|
|
20
27
|
key: glyph
|
|
21
|
-
})
|
|
28
|
+
}), /*#__PURE__*/React.createElement("code", {
|
|
29
|
+
style: {
|
|
30
|
+
display: 'block'
|
|
31
|
+
}
|
|
32
|
+
}, glyph))));
|
|
@@ -16,7 +16,7 @@ export const Popover = _ref => {
|
|
|
16
16
|
} = _ref;
|
|
17
17
|
const popover = usePopoverState({
|
|
18
18
|
baseId: process.env.NODE_ENV === 'test' && 'id-test',
|
|
19
|
-
gutter:
|
|
19
|
+
gutter: 12,
|
|
20
20
|
modal: true,
|
|
21
21
|
placement: 'top'
|
|
22
22
|
});
|
|
@@ -45,7 +45,7 @@ export const Popover = _ref => {
|
|
|
45
45
|
}), /*#__PURE__*/React.createElement(UIPopoverArrow, _extends({
|
|
46
46
|
className: css.arrow
|
|
47
47
|
}, popover, {
|
|
48
|
-
size:
|
|
48
|
+
size: 16
|
|
49
49
|
})), typeof children === 'function' ? children({
|
|
50
50
|
popoverToggle: popover.toggle
|
|
51
51
|
}) : children, /*#__PURE__*/React.createElement(Icon, {
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
.popover {
|
|
26
|
-
padding: var(--space-
|
|
26
|
+
padding: var(--space-small) var(--space-large) var(--space-small) var(--space-small);
|
|
27
|
+
border-radius: var(--radius-small);
|
|
27
28
|
max-width: 360px;
|
|
28
29
|
outline: none;
|
|
29
30
|
filter: drop-shadow(0 0 var(--space-xxxsmall) var(--color-shadow));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bundle-stats/ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0-alpha.1",
|
|
4
4
|
"description": "UI components for BundleStats projects.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-esm/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"build-esm": "babel -D src -d lib-esm --ignore **/__tests__/**/* --ignore /prototypes/**",
|
|
13
13
|
"build-storybook": "npx build-storybook -c ./build/storybook",
|
|
14
14
|
"generate-chart-colors": "node scripts/generate-chart-colors.js",
|
|
15
|
-
"generate-svg-sprite": "npx svg-sprite -s --si src/assets/icons/*.svg && mv symbol/svg/sprite.symbol.svg src/assets/icons.svg",
|
|
15
|
+
"generate-svg-sprite": "npx svg-sprite -s --si --no-svg-namespace-classnames src/assets/icons/*.svg && mv symbol/svg/sprite.symbol.svg src/assets/icons.svg",
|
|
16
16
|
"lint": "../../node_modules/.bin/eslint . --ext .jsx,.js",
|
|
17
17
|
"start": "cross-env NODE_ENV=development start-storybook -c ./build/storybook -p 8080",
|
|
18
18
|
"test": "npm run test:unit && npm run test:storyshots",
|
|
@@ -42,31 +42,31 @@
|
|
|
42
42
|
"@babel/preset-env": "7.16.4",
|
|
43
43
|
"@babel/preset-react": "7.16.0",
|
|
44
44
|
"@simplyianm/babel-plugin-inline-react-svg": "1.2.0",
|
|
45
|
-
"@storybook/addon-knobs": "6.
|
|
45
|
+
"@storybook/addon-knobs": "6.4.0",
|
|
46
46
|
"@storybook/addon-postcss": "2.0.0",
|
|
47
|
-
"@storybook/addon-storyshots": "6.
|
|
48
|
-
"@storybook/addons": "6.
|
|
49
|
-
"@storybook/builder-webpack5": "6.
|
|
50
|
-
"@storybook/manager-webpack5": "6.
|
|
51
|
-
"@storybook/react": "6.
|
|
47
|
+
"@storybook/addon-storyshots": "6.4.8",
|
|
48
|
+
"@storybook/addons": "6.4.8",
|
|
49
|
+
"@storybook/builder-webpack5": "6.4.8",
|
|
50
|
+
"@storybook/manager-webpack5": "6.4.8",
|
|
51
|
+
"@storybook/react": "6.4.8",
|
|
52
52
|
"babel-core": "7.0.0-bridge.0",
|
|
53
|
-
"babel-jest": "27.
|
|
53
|
+
"babel-jest": "27.4.2",
|
|
54
54
|
"babel-plugin-lodash": "3.3.4",
|
|
55
55
|
"babel-plugin-require-context-hook": "1.0.0",
|
|
56
|
-
"chromatic": "6.0
|
|
56
|
+
"chromatic": "6.2.0",
|
|
57
57
|
"classnames": "2.3.1",
|
|
58
58
|
"colormap": "2.3.2",
|
|
59
|
-
"core-js": "3.19.
|
|
59
|
+
"core-js": "3.19.3",
|
|
60
60
|
"cross-env": "7.0.3",
|
|
61
61
|
"enzyme": "3.11.0",
|
|
62
62
|
"enzyme-adapter-react-16": "1.15.6",
|
|
63
63
|
"enzyme-to-json": "3.6.2",
|
|
64
64
|
"hex-rgb": "5.0.0",
|
|
65
65
|
"identity-obj-proxy": "3.0.0",
|
|
66
|
-
"jest": "27.3
|
|
66
|
+
"jest": "27.4.3",
|
|
67
67
|
"jest-date-mock": "1.0.8",
|
|
68
68
|
"lodash": "4.17.21",
|
|
69
|
-
"postcss": "8.
|
|
69
|
+
"postcss": "8.4.4",
|
|
70
70
|
"prop-types": "15.7.2",
|
|
71
71
|
"react": "16.14.0",
|
|
72
72
|
"react-dom": "16.14.0",
|
|
@@ -84,11 +84,11 @@
|
|
|
84
84
|
"react-router-dom": "^5.3.0"
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@bundle-stats/utils": "^3.
|
|
87
|
+
"@bundle-stats/utils": "^3.3.0-alpha.1",
|
|
88
88
|
"date-fns": "^2.6.0",
|
|
89
89
|
"query-string": "^7.0.0",
|
|
90
90
|
"reakit": "^1.3.6",
|
|
91
91
|
"use-query-params": "^1.2.2"
|
|
92
92
|
},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "b510975b373ee38b66899a990c7341d1a29a69e2"
|
|
94
94
|
}
|