@bundle-stats/ui 3.3.5 → 3.3.7-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/lib/components/summary/summary.js +5 -11
- package/lib/components/summary/summary.module.css +2 -46
- package/lib/components/summary-item/summary-item.js +10 -16
- package/lib/components/summary-item/summary-item.module.css +25 -2
- package/lib/ui/hover-card/hover-card.js +7 -1
- package/lib-esm/components/summary/summary.js +5 -10
- package/lib-esm/components/summary/summary.module.css +2 -46
- package/lib-esm/components/summary-item/summary-item.js +8 -14
- package/lib-esm/components/summary-item/summary-item.module.css +25 -2
- package/lib-esm/ui/hover-card/hover-card.js +7 -1
- package/package.json +14 -14
- package/src/components/summary/summary.jsx +12 -16
- package/src/components/summary/summary.module.css +2 -46
- package/src/components/summary-item/summary-item.jsx +9 -11
- package/src/components/summary-item/summary-item.module.css +25 -2
- package/src/ui/hover-card/hover-card.jsx +5 -0
|
@@ -17,8 +17,6 @@ var _utils = require("@bundle-stats/utils");
|
|
|
17
17
|
|
|
18
18
|
var _constants = require("../../constants");
|
|
19
19
|
|
|
20
|
-
var _icon = require("../../ui/icon");
|
|
21
|
-
|
|
22
20
|
var _box = require("../../layout/box");
|
|
23
21
|
|
|
24
22
|
var _flexStack = require("../../layout/flex-stack");
|
|
@@ -70,22 +68,18 @@ var Summary = function Summary(_ref) {
|
|
|
70
68
|
metricId = _ref5[0],
|
|
71
69
|
metricOptions = _ref5[1];
|
|
72
70
|
|
|
73
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
71
|
+
return /*#__PURE__*/_react["default"].createElement(_summaryItem.SummaryItem, _extends({
|
|
74
72
|
key: metricId,
|
|
75
|
-
className: _summaryModule["default"].item
|
|
76
|
-
|
|
73
|
+
className: _summaryModule["default"].item,
|
|
74
|
+
as: SummaryItemCustomLink
|
|
75
|
+
}, metricOptions.link, {
|
|
77
76
|
size: size,
|
|
78
77
|
id: metricId,
|
|
79
78
|
data: (0, _get2["default"])(data, metricId),
|
|
80
79
|
loading: loading,
|
|
81
80
|
showMetricDescription: true,
|
|
82
81
|
showDelta: showSummaryItemDelta && metricOptions.showDelta !== false
|
|
83
|
-
})
|
|
84
|
-
className: _summaryModule["default"].readMore
|
|
85
|
-
}), /*#__PURE__*/_react["default"].createElement(_icon.Icon, {
|
|
86
|
-
className: _summaryModule["default"].readMoreIcon,
|
|
87
|
-
glyph: _icon.Icon.ICONS.ARROW_RIGHT_CIRLCE
|
|
88
|
-
})));
|
|
82
|
+
}));
|
|
89
83
|
})));
|
|
90
84
|
};
|
|
91
85
|
|
|
@@ -4,51 +4,7 @@
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
.item {
|
|
7
|
-
padding: var(--space-small) var(--space-xxlarge) var(--space-small) var(--space-small);
|
|
8
|
-
flex: 1 0 25%; /* force equal sizes */
|
|
9
|
-
position: relative;
|
|
10
|
-
z-index: 1;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.item::before {
|
|
14
|
-
content: '';
|
|
15
|
-
display: block;
|
|
16
|
-
width: 1px;
|
|
17
|
-
position: absolute;
|
|
18
|
-
left: -1px;
|
|
19
|
-
top: var(--space-small);
|
|
20
|
-
bottom: var(--space-small);
|
|
21
|
-
background: var(--color-outline);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.readMore {
|
|
25
|
-
display: block;
|
|
26
|
-
position: absolute;
|
|
27
|
-
right: 0;
|
|
28
|
-
bottom: 0;
|
|
29
7
|
padding: var(--space-small);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.readMore:hover,
|
|
35
|
-
.readMore:focus {
|
|
36
|
-
color: var(--color-primary);
|
|
37
|
-
transition: var(--transition-in);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.readMoreIcon {
|
|
41
|
-
display: block;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/** hover state */
|
|
45
|
-
.readMore {
|
|
46
|
-
opacity: 0;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.item:hover .readMore,
|
|
50
|
-
.item:active .readMore,
|
|
51
|
-
.item:focus .readMore {
|
|
52
|
-
opacity: 1;
|
|
53
|
-
transition: var(--transition-in);
|
|
8
|
+
flex: 1 0 25%; /* force equal sizes */
|
|
9
|
+
text-decoration: none;
|
|
54
10
|
}
|
|
@@ -15,14 +15,10 @@ var _utils = require("@bundle-stats/utils");
|
|
|
15
15
|
|
|
16
16
|
var _hoverCard = require("../../ui/hover-card");
|
|
17
17
|
|
|
18
|
-
var _icon = require("../../ui/icon");
|
|
19
|
-
|
|
20
18
|
var _skeleton = require("../../ui/skeleton");
|
|
21
19
|
|
|
22
20
|
var _stack = require("../../layout/stack");
|
|
23
21
|
|
|
24
|
-
var _flexStack = require("../../layout/flex-stack");
|
|
25
|
-
|
|
26
22
|
var _metric = require("../metric");
|
|
27
23
|
|
|
28
24
|
var _delta = require("../delta");
|
|
@@ -44,8 +40,11 @@ var MetricInfo = function MetricInfo(_ref) {
|
|
|
44
40
|
url = _ref.url;
|
|
45
41
|
return /*#__PURE__*/_react["default"].createElement(_stack.Stack, {
|
|
46
42
|
space: "xxxsmall"
|
|
47
|
-
}, /*#__PURE__*/_react["default"].createElement("p", null, description), url && /*#__PURE__*/_react["default"].createElement("p", null, /*#__PURE__*/_react["default"].createElement("
|
|
48
|
-
|
|
43
|
+
}, /*#__PURE__*/_react["default"].createElement("p", null, description), url && /*#__PURE__*/_react["default"].createElement("p", null, /*#__PURE__*/_react["default"].createElement("button", {
|
|
44
|
+
type: "button",
|
|
45
|
+
onClick: function onClick() {
|
|
46
|
+
return window.open(url);
|
|
47
|
+
},
|
|
49
48
|
className: _summaryItemModule["default"].readMoreLink
|
|
50
49
|
}, "Read more")));
|
|
51
50
|
};
|
|
@@ -81,19 +80,14 @@ var SummaryItem = function SummaryItem(_ref2) {
|
|
|
81
80
|
var showMetricDescriptionTooltip = showMetricDescription && (metric === null || metric === void 0 ? void 0 : metric.description);
|
|
82
81
|
var rootClassName = (0, _classnames["default"])(_summaryItemModule["default"].root, className, _summaryItemModule["default"][size], showDelta && _summaryItemModule["default"].showDelta);
|
|
83
82
|
return /*#__PURE__*/_react["default"].createElement(_stack.Stack, _extends({
|
|
84
|
-
space: "
|
|
83
|
+
space: "xxsmall",
|
|
85
84
|
as: Component,
|
|
86
85
|
className: rootClassName
|
|
87
|
-
}, props), /*#__PURE__*/_react["default"].createElement(
|
|
88
|
-
as: "h3",
|
|
89
|
-
space: "xxxsmall",
|
|
86
|
+
}, props), /*#__PURE__*/_react["default"].createElement("h3", {
|
|
90
87
|
className: _summaryItemModule["default"].title
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
glyph: "help"
|
|
95
|
-
})
|
|
96
|
-
}, /*#__PURE__*/_react["default"].createElement(MetricInfo, metric))), !loading ? /*#__PURE__*/_react["default"].createElement(_stack.Stack, null, /*#__PURE__*/_react["default"].createElement(_metric.Metric, {
|
|
88
|
+
}, showMetricDescriptionTooltip ? /*#__PURE__*/_react["default"].createElement(_hoverCard.HoverCard, {
|
|
89
|
+
label: metric.label
|
|
90
|
+
}, /*#__PURE__*/_react["default"].createElement(MetricInfo, metric)) : metric.label), !loading ? /*#__PURE__*/_react["default"].createElement(_stack.Stack, null, /*#__PURE__*/_react["default"].createElement(_metric.Metric, {
|
|
97
91
|
className: _summaryItemModule["default"].currentMetric,
|
|
98
92
|
value: current,
|
|
99
93
|
formatter: metric.formatter,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
.title {
|
|
2
|
-
align-items: center;
|
|
3
2
|
color: var(--color-text-ultra-light);
|
|
4
3
|
font-weight: bold;
|
|
5
4
|
font-size: var(--size-xsmall);
|
|
6
|
-
line-height:
|
|
5
|
+
line-height: 1;
|
|
7
6
|
text-transform: uppercase;
|
|
8
7
|
white-space: nowrap;
|
|
9
8
|
}
|
|
@@ -28,6 +27,30 @@
|
|
|
28
27
|
line-height: var(--space-small);
|
|
29
28
|
}
|
|
30
29
|
|
|
30
|
+
.readMoreLink {
|
|
31
|
+
appearance: none;
|
|
32
|
+
background: none;
|
|
33
|
+
margin: 0;
|
|
34
|
+
border: 0;
|
|
35
|
+
padding: 0;
|
|
36
|
+
color: var(--color-primary);
|
|
37
|
+
text-decoration: underline;
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.readMoreLink:hover,
|
|
42
|
+
.readMoreLink:active,
|
|
43
|
+
.readMoreLink:focus {
|
|
44
|
+
color: var(--color-primary-dark);
|
|
45
|
+
text-decoration: none;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* Hover state */
|
|
49
|
+
.root:hover .title {
|
|
50
|
+
color: var(--color-text-light);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
31
54
|
/* Loading state */
|
|
32
55
|
.loading.currentMetric {
|
|
33
56
|
width: 8em;
|
|
@@ -53,6 +53,11 @@ var HoverCard = function HoverCard(props) {
|
|
|
53
53
|
}); // Fallback to span if no href
|
|
54
54
|
|
|
55
55
|
var Component = resolveComponent(as, href);
|
|
56
|
+
|
|
57
|
+
var handleOnClick = function handleOnClick(event) {
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
};
|
|
60
|
+
|
|
56
61
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
57
62
|
className: (0, _classnames["default"])(_hoverCardModule["default"].root, className)
|
|
58
63
|
}, /*#__PURE__*/_react["default"].createElement(_hovercard.HovercardAnchor, {
|
|
@@ -65,7 +70,8 @@ var HoverCard = function HoverCard(props) {
|
|
|
65
70
|
className: (0, _classnames["default"])(_hoverCardModule["default"].hoverCard, hoverCardClassName),
|
|
66
71
|
style: {
|
|
67
72
|
zIndex: 10000
|
|
68
|
-
}
|
|
73
|
+
},
|
|
74
|
+
onClick: handleOnClick
|
|
69
75
|
}), /*#__PURE__*/_react["default"].createElement(_hovercard.HovercardArrow, {
|
|
70
76
|
size: 24
|
|
71
77
|
}), typeof children === 'function' ? children({
|
|
@@ -7,7 +7,6 @@ import PropTypes from 'prop-types';
|
|
|
7
7
|
import cx from 'classnames';
|
|
8
8
|
import { METRIC_COMPONENT_LINKS } from '@bundle-stats/utils';
|
|
9
9
|
import { METRICS_WEBPACK_GENERAL } from '../../constants';
|
|
10
|
-
import { Icon } from '../../ui/icon';
|
|
11
10
|
import { Box } from '../../layout/box';
|
|
12
11
|
import { FlexStack } from '../../layout/flex-stack';
|
|
13
12
|
import { ComponentLink } from '../component-link';
|
|
@@ -33,22 +32,18 @@ export const Summary = _ref => {
|
|
|
33
32
|
return keys.includes(metricId);
|
|
34
33
|
}).map(_ref3 => {
|
|
35
34
|
let [metricId, metricOptions] = _ref3;
|
|
36
|
-
return /*#__PURE__*/React.createElement(
|
|
35
|
+
return /*#__PURE__*/React.createElement(SummaryItem, _extends({
|
|
37
36
|
key: metricId,
|
|
38
|
-
className: css.item
|
|
39
|
-
|
|
37
|
+
className: css.item,
|
|
38
|
+
as: SummaryItemCustomLink
|
|
39
|
+
}, metricOptions.link, {
|
|
40
40
|
size: size,
|
|
41
41
|
id: metricId,
|
|
42
42
|
data: _get(data, metricId),
|
|
43
43
|
loading: loading,
|
|
44
44
|
showMetricDescription: true,
|
|
45
45
|
showDelta: showSummaryItemDelta && metricOptions.showDelta !== false
|
|
46
|
-
})
|
|
47
|
-
className: css.readMore
|
|
48
|
-
}), /*#__PURE__*/React.createElement(Icon, {
|
|
49
|
-
className: css.readMoreIcon,
|
|
50
|
-
glyph: Icon.ICONS.ARROW_RIGHT_CIRLCE
|
|
51
|
-
})));
|
|
46
|
+
}));
|
|
52
47
|
})));
|
|
53
48
|
};
|
|
54
49
|
Summary.defaultProps = {
|
|
@@ -4,51 +4,7 @@
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
.item {
|
|
7
|
-
padding: var(--space-small) var(--space-xxlarge) var(--space-small) var(--space-small);
|
|
8
|
-
flex: 1 0 25%; /* force equal sizes */
|
|
9
|
-
position: relative;
|
|
10
|
-
z-index: 1;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.item::before {
|
|
14
|
-
content: '';
|
|
15
|
-
display: block;
|
|
16
|
-
width: 1px;
|
|
17
|
-
position: absolute;
|
|
18
|
-
left: -1px;
|
|
19
|
-
top: var(--space-small);
|
|
20
|
-
bottom: var(--space-small);
|
|
21
|
-
background: var(--color-outline);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.readMore {
|
|
25
|
-
display: block;
|
|
26
|
-
position: absolute;
|
|
27
|
-
right: 0;
|
|
28
|
-
bottom: 0;
|
|
29
7
|
padding: var(--space-small);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.readMore:hover,
|
|
35
|
-
.readMore:focus {
|
|
36
|
-
color: var(--color-primary);
|
|
37
|
-
transition: var(--transition-in);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.readMoreIcon {
|
|
41
|
-
display: block;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/** hover state */
|
|
45
|
-
.readMore {
|
|
46
|
-
opacity: 0;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.item:hover .readMore,
|
|
50
|
-
.item:active .readMore,
|
|
51
|
-
.item:focus .readMore {
|
|
52
|
-
opacity: 1;
|
|
53
|
-
transition: var(--transition-in);
|
|
8
|
+
flex: 1 0 25%; /* force equal sizes */
|
|
9
|
+
text-decoration: none;
|
|
54
10
|
}
|
|
@@ -5,10 +5,8 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import cx from 'classnames';
|
|
6
6
|
import { getGlobalMetricType, getMetricRunInfo } from '@bundle-stats/utils';
|
|
7
7
|
import { HoverCard } from '../../ui/hover-card';
|
|
8
|
-
import { Icon } from '../../ui/icon';
|
|
9
8
|
import { Skeleton } from '../../ui/skeleton';
|
|
10
9
|
import { Stack } from '../../layout/stack';
|
|
11
|
-
import { FlexStack } from '../../layout/flex-stack';
|
|
12
10
|
import { Metric } from '../metric';
|
|
13
11
|
import { Delta } from '../delta';
|
|
14
12
|
import css from './summary-item.module.css';
|
|
@@ -20,8 +18,9 @@ const MetricInfo = _ref => {
|
|
|
20
18
|
} = _ref;
|
|
21
19
|
return /*#__PURE__*/React.createElement(Stack, {
|
|
22
20
|
space: "xxxsmall"
|
|
23
|
-
}, /*#__PURE__*/React.createElement("p", null, description), url && /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("
|
|
24
|
-
|
|
21
|
+
}, /*#__PURE__*/React.createElement("p", null, description), url && /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("button", {
|
|
22
|
+
type: "button",
|
|
23
|
+
onClick: () => window.open(url),
|
|
25
24
|
className: css.readMoreLink
|
|
26
25
|
}, "Read more")));
|
|
27
26
|
};
|
|
@@ -57,19 +56,14 @@ export const SummaryItem = _ref2 => {
|
|
|
57
56
|
const showMetricDescriptionTooltip = showMetricDescription && (metric == null ? void 0 : metric.description);
|
|
58
57
|
const rootClassName = cx(css.root, className, css[size], showDelta && css.showDelta);
|
|
59
58
|
return /*#__PURE__*/React.createElement(Stack, _extends({
|
|
60
|
-
space: "
|
|
59
|
+
space: "xxsmall",
|
|
61
60
|
as: Component,
|
|
62
61
|
className: rootClassName
|
|
63
|
-
}, props), /*#__PURE__*/React.createElement(
|
|
64
|
-
as: "h3",
|
|
65
|
-
space: "xxxsmall",
|
|
62
|
+
}, props), /*#__PURE__*/React.createElement("h3", {
|
|
66
63
|
className: css.title
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
glyph: "help"
|
|
71
|
-
})
|
|
72
|
-
}, /*#__PURE__*/React.createElement(MetricInfo, metric))), !loading ? /*#__PURE__*/React.createElement(Stack, null, /*#__PURE__*/React.createElement(Metric, {
|
|
64
|
+
}, showMetricDescriptionTooltip ? /*#__PURE__*/React.createElement(HoverCard, {
|
|
65
|
+
label: metric.label
|
|
66
|
+
}, /*#__PURE__*/React.createElement(MetricInfo, metric)) : metric.label), !loading ? /*#__PURE__*/React.createElement(Stack, null, /*#__PURE__*/React.createElement(Metric, {
|
|
73
67
|
className: css.currentMetric,
|
|
74
68
|
value: current,
|
|
75
69
|
formatter: metric.formatter,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
.title {
|
|
2
|
-
align-items: center;
|
|
3
2
|
color: var(--color-text-ultra-light);
|
|
4
3
|
font-weight: bold;
|
|
5
4
|
font-size: var(--size-xsmall);
|
|
6
|
-
line-height:
|
|
5
|
+
line-height: 1;
|
|
7
6
|
text-transform: uppercase;
|
|
8
7
|
white-space: nowrap;
|
|
9
8
|
}
|
|
@@ -28,6 +27,30 @@
|
|
|
28
27
|
line-height: var(--space-small);
|
|
29
28
|
}
|
|
30
29
|
|
|
30
|
+
.readMoreLink {
|
|
31
|
+
appearance: none;
|
|
32
|
+
background: none;
|
|
33
|
+
margin: 0;
|
|
34
|
+
border: 0;
|
|
35
|
+
padding: 0;
|
|
36
|
+
color: var(--color-primary);
|
|
37
|
+
text-decoration: underline;
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.readMoreLink:hover,
|
|
42
|
+
.readMoreLink:active,
|
|
43
|
+
.readMoreLink:focus {
|
|
44
|
+
color: var(--color-primary-dark);
|
|
45
|
+
text-decoration: none;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* Hover state */
|
|
49
|
+
.root:hover .title {
|
|
50
|
+
color: var(--color-text-light);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
31
54
|
/* Loading state */
|
|
32
55
|
.loading.currentMetric {
|
|
33
56
|
width: 8em;
|
|
@@ -36,6 +36,11 @@ export const HoverCard = props => {
|
|
|
36
36
|
}); // Fallback to span if no href
|
|
37
37
|
|
|
38
38
|
const Component = resolveComponent(as, href);
|
|
39
|
+
|
|
40
|
+
const handleOnClick = event => {
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
};
|
|
43
|
+
|
|
39
44
|
return /*#__PURE__*/React.createElement("div", {
|
|
40
45
|
className: cx(css.root, className)
|
|
41
46
|
}, /*#__PURE__*/React.createElement(HovercardAnchor, {
|
|
@@ -48,7 +53,8 @@ export const HoverCard = props => {
|
|
|
48
53
|
className: cx(css.hoverCard, hoverCardClassName),
|
|
49
54
|
style: {
|
|
50
55
|
zIndex: 10000
|
|
51
|
-
}
|
|
56
|
+
},
|
|
57
|
+
onClick: handleOnClick
|
|
52
58
|
}), /*#__PURE__*/React.createElement(HovercardArrow, {
|
|
53
59
|
size: 24
|
|
54
60
|
}), typeof children === 'function' ? children({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bundle-stats/ui",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.7-alpha.0",
|
|
4
4
|
"description": "UI components for BundleStats projects.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-esm/index.js",
|
|
@@ -37,27 +37,27 @@
|
|
|
37
37
|
"homepage": "https://github.com/relative-ci/bundle-stats/blob/master/packages/ui#readme",
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@babel/cli": "7.17.6",
|
|
40
|
-
"@babel/core": "7.17.
|
|
40
|
+
"@babel/core": "7.17.9",
|
|
41
41
|
"@babel/plugin-proposal-class-properties": "7.16.7",
|
|
42
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.
|
|
45
|
+
"@storybook/addon-essentials": "6.4.22",
|
|
46
46
|
"@storybook/addon-knobs": "6.4.0",
|
|
47
47
|
"@storybook/addon-postcss": "2.0.0",
|
|
48
|
-
"@storybook/addon-storyshots": "6.4.
|
|
49
|
-
"@storybook/addons": "6.4.
|
|
50
|
-
"@storybook/builder-webpack5": "6.4.
|
|
51
|
-
"@storybook/manager-webpack5": "6.4.
|
|
52
|
-
"@storybook/react": "6.4.
|
|
48
|
+
"@storybook/addon-storyshots": "6.4.22",
|
|
49
|
+
"@storybook/addons": "6.4.22",
|
|
50
|
+
"@storybook/builder-webpack5": "6.4.22",
|
|
51
|
+
"@storybook/manager-webpack5": "6.4.22",
|
|
52
|
+
"@storybook/react": "6.4.22",
|
|
53
53
|
"babel-core": "7.0.0-bridge.0",
|
|
54
|
-
"babel-jest": "
|
|
54
|
+
"babel-jest": "28.0.1",
|
|
55
55
|
"babel-plugin-lodash": "3.3.4",
|
|
56
56
|
"babel-plugin-require-context-hook": "1.0.0",
|
|
57
|
-
"chromatic": "6.5.
|
|
57
|
+
"chromatic": "6.5.4",
|
|
58
58
|
"classnames": "2.3.1",
|
|
59
59
|
"colormap": "2.3.2",
|
|
60
|
-
"core-js": "3.
|
|
60
|
+
"core-js": "3.22.2",
|
|
61
61
|
"cross-env": "7.0.3",
|
|
62
62
|
"enzyme": "3.11.0",
|
|
63
63
|
"enzyme-adapter-react-16": "1.15.6",
|
|
@@ -85,12 +85,12 @@
|
|
|
85
85
|
"react-router-dom": "^5.0.0"
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
|
-
"@bundle-stats/utils": "^3.3.
|
|
89
|
-
"ariakit": "2.0.0-
|
|
88
|
+
"@bundle-stats/utils": "^3.3.7-alpha.0",
|
|
89
|
+
"ariakit": "2.0.0-next.24",
|
|
90
90
|
"date-fns": "^2.28.0",
|
|
91
91
|
"modern-css-reset": "^1.4.0",
|
|
92
92
|
"query-string": "^7.1.0",
|
|
93
93
|
"use-query-params": "^1.2.3"
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "346065f7f6f5ebe1bbc82ba677a452420fb1fb1d"
|
|
96
96
|
}
|
|
@@ -5,7 +5,6 @@ import { get } from 'lodash';
|
|
|
5
5
|
import { METRIC_COMPONENT_LINKS } from '@bundle-stats/utils';
|
|
6
6
|
|
|
7
7
|
import { METRICS_WEBPACK_GENERAL } from '../../constants';
|
|
8
|
-
import { Icon } from '../../ui/icon';
|
|
9
8
|
import { Box } from '../../layout/box';
|
|
10
9
|
import { FlexStack } from '../../layout/flex-stack';
|
|
11
10
|
import { ComponentLink } from '../component-link';
|
|
@@ -26,21 +25,18 @@ export const Summary = ({
|
|
|
26
25
|
{Array.from(METRIC_COMPONENT_LINKS)
|
|
27
26
|
.filter(([metricId]) => keys.includes(metricId))
|
|
28
27
|
.map(([metricId, metricOptions]) => (
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
</SummaryItemCustomLink>
|
|
42
|
-
)}
|
|
43
|
-
</div>
|
|
28
|
+
<SummaryItem
|
|
29
|
+
key={metricId}
|
|
30
|
+
className={css.item}
|
|
31
|
+
as={SummaryItemCustomLink}
|
|
32
|
+
{...metricOptions.link}
|
|
33
|
+
size={size}
|
|
34
|
+
id={metricId}
|
|
35
|
+
data={get(data, metricId)}
|
|
36
|
+
loading={loading}
|
|
37
|
+
showMetricDescription
|
|
38
|
+
showDelta={showSummaryItemDelta && metricOptions.showDelta !== false}
|
|
39
|
+
/>
|
|
44
40
|
))}
|
|
45
41
|
</FlexStack>
|
|
46
42
|
</Box>
|
|
@@ -4,51 +4,7 @@
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
.item {
|
|
7
|
-
padding: var(--space-small) var(--space-xxlarge) var(--space-small) var(--space-small);
|
|
8
|
-
flex: 1 0 25%; /* force equal sizes */
|
|
9
|
-
position: relative;
|
|
10
|
-
z-index: 1;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.item::before {
|
|
14
|
-
content: '';
|
|
15
|
-
display: block;
|
|
16
|
-
width: 1px;
|
|
17
|
-
position: absolute;
|
|
18
|
-
left: -1px;
|
|
19
|
-
top: var(--space-small);
|
|
20
|
-
bottom: var(--space-small);
|
|
21
|
-
background: var(--color-outline);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.readMore {
|
|
25
|
-
display: block;
|
|
26
|
-
position: absolute;
|
|
27
|
-
right: 0;
|
|
28
|
-
bottom: 0;
|
|
29
7
|
padding: var(--space-small);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.readMore:hover,
|
|
35
|
-
.readMore:focus {
|
|
36
|
-
color: var(--color-primary);
|
|
37
|
-
transition: var(--transition-in);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.readMoreIcon {
|
|
41
|
-
display: block;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/** hover state */
|
|
45
|
-
.readMore {
|
|
46
|
-
opacity: 0;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.item:hover .readMore,
|
|
50
|
-
.item:active .readMore,
|
|
51
|
-
.item:focus .readMore {
|
|
52
|
-
opacity: 1;
|
|
53
|
-
transition: var(--transition-in);
|
|
8
|
+
flex: 1 0 25%; /* force equal sizes */
|
|
9
|
+
text-decoration: none;
|
|
54
10
|
}
|
|
@@ -4,10 +4,8 @@ import cx from 'classnames';
|
|
|
4
4
|
import { getGlobalMetricType, getMetricRunInfo } from '@bundle-stats/utils';
|
|
5
5
|
|
|
6
6
|
import { HoverCard } from '../../ui/hover-card';
|
|
7
|
-
import { Icon } from '../../ui/icon';
|
|
8
7
|
import { Skeleton } from '../../ui/skeleton';
|
|
9
8
|
import { Stack } from '../../layout/stack';
|
|
10
|
-
import { FlexStack } from '../../layout/flex-stack';
|
|
11
9
|
import { Metric } from '../metric';
|
|
12
10
|
import { Delta } from '../delta';
|
|
13
11
|
import css from './summary-item.module.css';
|
|
@@ -17,9 +15,9 @@ const MetricInfo = ({ description, url }) => (
|
|
|
17
15
|
<p>{description}</p>
|
|
18
16
|
{url && (
|
|
19
17
|
<p>
|
|
20
|
-
<
|
|
18
|
+
<button type="button" onClick={() => window.open(url)} className={css.readMoreLink}>
|
|
21
19
|
Read more
|
|
22
|
-
</
|
|
20
|
+
</button>
|
|
23
21
|
</p>
|
|
24
22
|
)}
|
|
25
23
|
</Stack>
|
|
@@ -54,16 +52,16 @@ export const SummaryItem = ({
|
|
|
54
52
|
const rootClassName = cx(css.root, className, css[size], showDelta && css.showDelta);
|
|
55
53
|
|
|
56
54
|
return (
|
|
57
|
-
<Stack space="
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
{showMetricDescriptionTooltip && (
|
|
62
|
-
<HoverCard className={css.icon} label={<Icon glyph="help" />}>
|
|
55
|
+
<Stack space="xxsmall" as={Component} className={rootClassName} {...props}>
|
|
56
|
+
<h3 className={css.title}>
|
|
57
|
+
{showMetricDescriptionTooltip ? (
|
|
58
|
+
<HoverCard label={metric.label}>
|
|
63
59
|
<MetricInfo {...metric} />
|
|
64
60
|
</HoverCard>
|
|
61
|
+
) : (
|
|
62
|
+
metric.label
|
|
65
63
|
)}
|
|
66
|
-
</
|
|
64
|
+
</h3>
|
|
67
65
|
|
|
68
66
|
{!loading ? (
|
|
69
67
|
<Stack>
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
.title {
|
|
2
|
-
align-items: center;
|
|
3
2
|
color: var(--color-text-ultra-light);
|
|
4
3
|
font-weight: bold;
|
|
5
4
|
font-size: var(--size-xsmall);
|
|
6
|
-
line-height:
|
|
5
|
+
line-height: 1;
|
|
7
6
|
text-transform: uppercase;
|
|
8
7
|
white-space: nowrap;
|
|
9
8
|
}
|
|
@@ -28,6 +27,30 @@
|
|
|
28
27
|
line-height: var(--space-small);
|
|
29
28
|
}
|
|
30
29
|
|
|
30
|
+
.readMoreLink {
|
|
31
|
+
appearance: none;
|
|
32
|
+
background: none;
|
|
33
|
+
margin: 0;
|
|
34
|
+
border: 0;
|
|
35
|
+
padding: 0;
|
|
36
|
+
color: var(--color-primary);
|
|
37
|
+
text-decoration: underline;
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.readMoreLink:hover,
|
|
42
|
+
.readMoreLink:active,
|
|
43
|
+
.readMoreLink:focus {
|
|
44
|
+
color: var(--color-primary-dark);
|
|
45
|
+
text-decoration: none;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* Hover state */
|
|
49
|
+
.root:hover .title {
|
|
50
|
+
color: var(--color-text-light);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
31
54
|
/* Loading state */
|
|
32
55
|
.loading.currentMetric {
|
|
33
56
|
width: 8em;
|
|
@@ -31,6 +31,10 @@ export const HoverCard = (props) => {
|
|
|
31
31
|
// Fallback to span if no href
|
|
32
32
|
const Component = resolveComponent(as, href);
|
|
33
33
|
|
|
34
|
+
const handleOnClick = (event) => {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
};
|
|
37
|
+
|
|
34
38
|
return (
|
|
35
39
|
<div className={cx(css.root, className)}>
|
|
36
40
|
<HovercardAnchor state={state} href={href} className={css.anchor} as={Component}>
|
|
@@ -41,6 +45,7 @@ export const HoverCard = (props) => {
|
|
|
41
45
|
state={state}
|
|
42
46
|
className={cx(css.hoverCard, hoverCardClassName)}
|
|
43
47
|
style={{ zIndex: 10000 }}
|
|
48
|
+
onClick={handleOnClick}
|
|
44
49
|
>
|
|
45
50
|
<HovercardArrow size={24} />
|
|
46
51
|
{typeof children === 'function' ? children({ close: state.hide }) : children}
|