@bundle-stats/ui 4.0.1 → 4.0.5-beta.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/metric/metric.js +40 -25
- package/lib/components/metric/metric.module.css +4 -14
- package/lib/components/metrics-table-title/metrics-table-title.js +1 -1
- package/lib/components/metrics-table-title/metrics-table-title.module.css +3 -3
- package/lib/components/summary-item/summary-item.js +3 -1
- package/lib/components/summary-item/summary-item.module.css +0 -9
- package/lib/components/total-size-type-title/total-size-type-title.js +6 -3
- package/lib/components/total-size-type-title/total-size-type-title.module.css +9 -1
- package/lib/i18n.js +2 -2
- package/lib/ui/dropdown/dropdown.module.css +3 -2
- package/lib/ui/filters/filters.js +11 -8
- package/lib/ui/filters/filters.module.css +11 -12
- package/lib/ui/hover-card/hover-card.js +8 -2
- package/lib/ui/skeleton/skeleton.js +11 -5
- package/lib/ui/skeleton/skeleton.module.css +6 -2
- package/lib/ui/skeleton/skeleton.stories.js +44 -9
- package/lib/ui/sort-dropdown/sort-dropdown.js +90 -30
- package/lib/ui/sort-dropdown/sort-dropdown.module.css +5 -3
- package/lib-esm/components/metric/metric.js +40 -15
- package/lib-esm/components/metric/metric.module.css +4 -14
- package/lib-esm/components/metrics-table-title/metrics-table-title.js +1 -1
- package/lib-esm/components/metrics-table-title/metrics-table-title.module.css +3 -3
- package/lib-esm/components/summary-item/summary-item.js +3 -1
- package/lib-esm/components/summary-item/summary-item.module.css +0 -9
- package/lib-esm/components/total-size-type-title/total-size-type-title.js +6 -3
- package/lib-esm/components/total-size-type-title/total-size-type-title.module.css +9 -1
- package/lib-esm/i18n.js +2 -2
- package/lib-esm/ui/dropdown/dropdown.module.css +3 -2
- package/lib-esm/ui/filters/filters.js +9 -7
- package/lib-esm/ui/filters/filters.module.css +11 -12
- package/lib-esm/ui/hover-card/hover-card.js +8 -2
- package/lib-esm/ui/skeleton/skeleton.js +10 -4
- package/lib-esm/ui/skeleton/skeleton.module.css +6 -2
- package/lib-esm/ui/skeleton/skeleton.stories.js +28 -5
- package/lib-esm/ui/sort-dropdown/sort-dropdown.js +72 -23
- package/lib-esm/ui/sort-dropdown/sort-dropdown.module.css +5 -3
- package/package.json +5 -5
- package/src/components/metric/metric.jsx +32 -24
- package/src/components/metric/metric.module.css +4 -14
- package/src/components/metrics-table-title/metrics-table-title.jsx +1 -1
- package/src/components/metrics-table-title/metrics-table-title.module.css +3 -3
- package/src/components/summary-item/summary-item.jsx +3 -3
- package/src/components/summary-item/summary-item.module.css +0 -9
- package/src/components/total-size-type-title/total-size-type-title.jsx +3 -3
- package/src/components/total-size-type-title/total-size-type-title.module.css +9 -1
- package/src/i18n.js +2 -2
- package/src/ui/dropdown/dropdown.module.css +3 -2
- package/src/ui/filters/filters.jsx +24 -18
- package/src/ui/filters/filters.module.css +11 -12
- package/src/ui/hover-card/hover-card.jsx +11 -3
- package/src/ui/skeleton/skeleton.jsx +7 -3
- package/src/ui/skeleton/skeleton.module.css +6 -2
- package/src/ui/sort-dropdown/sort-dropdown.jsx +70 -27
- package/src/ui/sort-dropdown/sort-dropdown.module.css +5 -3
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.SortDropdown = void 0;
|
|
7
9
|
|
|
8
|
-
var _react =
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
11
|
|
|
10
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
13
|
|
|
@@ -17,11 +19,15 @@ var _icon = require("../icon");
|
|
|
17
19
|
|
|
18
20
|
var _sortDropdownModule = _interopRequireDefault(require("./sort-dropdown.module.css"));
|
|
19
21
|
|
|
22
|
+
var _excluded = ["className", "as", "id", "label", "active", "direction", "defaultDirection", "getButtonOnClick"];
|
|
23
|
+
|
|
20
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
25
|
|
|
22
|
-
function
|
|
26
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
27
|
|
|
24
|
-
function
|
|
28
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
|
+
|
|
30
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
25
31
|
|
|
26
32
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
33
|
|
|
@@ -35,6 +41,67 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
35
41
|
|
|
36
42
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
37
43
|
|
|
44
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
45
|
+
|
|
46
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
47
|
+
|
|
48
|
+
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; }
|
|
49
|
+
|
|
50
|
+
var Item = function Item(_ref) {
|
|
51
|
+
var className = _ref.className,
|
|
52
|
+
Component = _ref.as,
|
|
53
|
+
id = _ref.id,
|
|
54
|
+
label = _ref.label,
|
|
55
|
+
active = _ref.active,
|
|
56
|
+
direction = _ref.direction,
|
|
57
|
+
defaultDirection = _ref.defaultDirection,
|
|
58
|
+
getButtonOnClick = _ref.getButtonOnClick,
|
|
59
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
60
|
+
|
|
61
|
+
var buttonProps = (0, _react.useMemo)(function () {
|
|
62
|
+
var resolveNextDirection = defaultDirection;
|
|
63
|
+
|
|
64
|
+
if (active) {
|
|
65
|
+
resolveNextDirection = direction === 'asc' ? 'desc' : 'asc';
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (resolveNextDirection === 'desc') {
|
|
69
|
+
return {
|
|
70
|
+
className: _sortDropdownModule["default"].itemAsc,
|
|
71
|
+
onClick: getButtonOnClick(id, 'desc'),
|
|
72
|
+
title: "Order data by ".concat(label, " descending")
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
onClick: getButtonOnClick(id, 'asc'),
|
|
78
|
+
title: "Order data by ".concat(label, " ascending")
|
|
79
|
+
};
|
|
80
|
+
}, [active, direction, defaultDirection, id, label]);
|
|
81
|
+
return /*#__PURE__*/_react["default"].createElement(Component, _extends({}, restProps, buttonProps, {
|
|
82
|
+
className: (0, _classnames["default"])(className, _sortDropdownModule["default"].item, active && _sortDropdownModule["default"].itemActive, buttonProps.className)
|
|
83
|
+
}), /*#__PURE__*/_react["default"].createElement(_icon.Icon, {
|
|
84
|
+
className: _sortDropdownModule["default"].itemIcon,
|
|
85
|
+
glyph: "arrow"
|
|
86
|
+
}), /*#__PURE__*/_react["default"].createElement("span", {
|
|
87
|
+
className: _sortDropdownModule["default"].itemLabel
|
|
88
|
+
}, label));
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
Item.propTypes = {
|
|
92
|
+
className: _propTypes["default"].string,
|
|
93
|
+
as: _propTypes["default"].element.isRequired,
|
|
94
|
+
id: _propTypes["default"].string.isRequired,
|
|
95
|
+
label: _propTypes["default"].string.isRequired,
|
|
96
|
+
active: _propTypes["default"].bool.isRequired,
|
|
97
|
+
direction: _propTypes["default"].string.isRequired,
|
|
98
|
+
defaultDirection: _propTypes["default"].string.isRequired,
|
|
99
|
+
getButtonOnClick: _propTypes["default"].func.isRequired
|
|
100
|
+
};
|
|
101
|
+
Item.defaultProps = {
|
|
102
|
+
className: ''
|
|
103
|
+
};
|
|
104
|
+
|
|
38
105
|
var SortDropdown = function SortDropdown(props) {
|
|
39
106
|
var className = props.className,
|
|
40
107
|
label = props.label,
|
|
@@ -49,11 +116,11 @@ var SortDropdown = function SortDropdown(props) {
|
|
|
49
116
|
label: customLabel,
|
|
50
117
|
glyph: "sort",
|
|
51
118
|
align: "right"
|
|
52
|
-
}, function (
|
|
53
|
-
var MenuItem =
|
|
54
|
-
menu =
|
|
55
|
-
menuItemClassName =
|
|
56
|
-
menuItemActiveClassName =
|
|
119
|
+
}, function (_ref2) {
|
|
120
|
+
var MenuItem = _ref2.MenuItem,
|
|
121
|
+
menu = _ref2.menu,
|
|
122
|
+
menuItemClassName = _ref2.menuItemClassName,
|
|
123
|
+
menuItemActiveClassName = _ref2.menuItemActiveClassName;
|
|
57
124
|
|
|
58
125
|
var getButtonOnClick = function getButtonOnClick(newField, newDirection) {
|
|
59
126
|
return function () {
|
|
@@ -67,30 +134,23 @@ var SortDropdown = function SortDropdown(props) {
|
|
|
67
134
|
|
|
68
135
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
69
136
|
className: _sortDropdownModule["default"].items
|
|
70
|
-
}, Object.entries(fields).map(function (
|
|
71
|
-
var
|
|
72
|
-
key =
|
|
73
|
-
item =
|
|
137
|
+
}, Object.entries(fields).map(function (_ref3) {
|
|
138
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
139
|
+
key = _ref4[0],
|
|
140
|
+
item = _ref4[1];
|
|
74
141
|
|
|
75
|
-
var buttonProps = direction === 'asc' ? {
|
|
76
|
-
className: _sortDropdownModule["default"].itemAsc,
|
|
77
|
-
onClick: getButtonOnClick(key, 'desc'),
|
|
78
|
-
title: "Order data by ".concat(item.label, " descending")
|
|
79
|
-
} : {
|
|
80
|
-
onClick: getButtonOnClick(key, 'asc'),
|
|
81
|
-
title: "Order data by ".concat(item.label, " ascending")
|
|
82
|
-
};
|
|
83
142
|
var isActive = field === key;
|
|
84
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
85
|
-
key: key
|
|
86
|
-
|
|
87
|
-
className: (0, _classnames["default"])(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
143
|
+
return /*#__PURE__*/_react["default"].createElement(Item, {
|
|
144
|
+
key: key,
|
|
145
|
+
as: MenuItem,
|
|
146
|
+
className: (0, _classnames["default"])(menuItemClassName, isActive && menuItemActiveClassName),
|
|
147
|
+
id: key,
|
|
148
|
+
label: item.label,
|
|
149
|
+
direction: direction,
|
|
150
|
+
defaultDirection: item.defaultDirection,
|
|
151
|
+
active: isActive,
|
|
152
|
+
getButtonOnClick: getButtonOnClick
|
|
153
|
+
});
|
|
94
154
|
}));
|
|
95
155
|
});
|
|
96
156
|
};
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
.itemIcon {
|
|
7
|
-
|
|
7
|
+
flex: 0 0 auto;
|
|
8
|
+
visibility: hidden;
|
|
9
|
+
margin-right: var(--space-xxxsmall);
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
.itemLabel {
|
|
@@ -15,6 +17,6 @@
|
|
|
15
17
|
transform: rotate(180deg);
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
.
|
|
19
|
-
|
|
20
|
+
.itemActive .itemIcon {
|
|
21
|
+
visibility: visible;
|
|
20
22
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import cx from 'classnames';
|
|
4
|
-
import
|
|
4
|
+
import css from './metric.module.css'; // Separate value and unit
|
|
5
5
|
|
|
6
6
|
const EXTRACT_VALUE_UNIT_PATTERN = /([\d|.|,| ]*)(\w*|%)$/;
|
|
7
7
|
export const Metric = _ref => {
|
|
@@ -10,29 +10,55 @@ export const Metric = _ref => {
|
|
|
10
10
|
value,
|
|
11
11
|
formatter,
|
|
12
12
|
inline,
|
|
13
|
-
anchored,
|
|
14
13
|
children,
|
|
15
14
|
enhanced
|
|
16
15
|
} = _ref;
|
|
17
|
-
const
|
|
16
|
+
const {
|
|
17
|
+
displayValue,
|
|
18
|
+
displayUnit
|
|
19
|
+
} = useMemo(() => {
|
|
20
|
+
const formattedValue = formatter == null ? void 0 : formatter(value);
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
if (!formattedValue) {
|
|
23
|
+
return {
|
|
24
|
+
displayValue: value
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!enhanced) {
|
|
29
|
+
return {
|
|
30
|
+
displayValue: formattedValue
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const matches = formattedValue.match(EXTRACT_VALUE_UNIT_PATTERN);
|
|
35
|
+
|
|
36
|
+
if (!matches) {
|
|
37
|
+
return {
|
|
38
|
+
displayValue: value
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
displayUnit: matches[2],
|
|
44
|
+
displayValue: matches[1]
|
|
45
|
+
};
|
|
46
|
+
}, [formatter, value]);
|
|
47
|
+
const rootClassName = cx(className, css.root, inline && css.inline);
|
|
48
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
22
49
|
className: rootClassName
|
|
50
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
className: css.display
|
|
23
52
|
}, /*#__PURE__*/React.createElement("span", {
|
|
24
|
-
className:
|
|
25
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
26
|
-
className: styles.displayValue
|
|
53
|
+
className: css.displayValue
|
|
27
54
|
}, displayValue), displayUnit && /*#__PURE__*/React.createElement("span", {
|
|
28
|
-
className:
|
|
29
|
-
}, displayUnit)), /*#__PURE__*/React.createElement("
|
|
30
|
-
className:
|
|
55
|
+
className: css.displayUnit
|
|
56
|
+
}, displayUnit)), /*#__PURE__*/React.createElement("div", {
|
|
57
|
+
className: css.delta
|
|
31
58
|
}, children));
|
|
32
59
|
};
|
|
33
60
|
Metric.defaultProps = {
|
|
34
61
|
className: '',
|
|
35
|
-
anchored: false,
|
|
36
62
|
enhanced: false,
|
|
37
63
|
inline: false,
|
|
38
64
|
value: 0,
|
|
@@ -43,7 +69,6 @@ Metric.propTypes = {
|
|
|
43
69
|
className: PropTypes.string,
|
|
44
70
|
enhanced: PropTypes.bool,
|
|
45
71
|
inline: PropTypes.bool,
|
|
46
|
-
anchored: PropTypes.bool,
|
|
47
72
|
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
48
73
|
formatter: PropTypes.func,
|
|
49
74
|
children: PropTypes.node
|
|
@@ -1,27 +1,17 @@
|
|
|
1
1
|
.root {
|
|
2
|
-
display: block;
|
|
3
2
|
letter-spacing: 0.05em;
|
|
4
3
|
}
|
|
5
4
|
|
|
6
5
|
.displayUnit {
|
|
7
|
-
|
|
6
|
+
font-size: var(--size-small);
|
|
8
7
|
}
|
|
9
8
|
|
|
10
9
|
.delta {
|
|
11
|
-
|
|
12
|
-
font-size: var(--size-xsmall);
|
|
10
|
+
font-size: var(--size-small);
|
|
13
11
|
}
|
|
14
12
|
|
|
15
|
-
.
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.anchored .delta {
|
|
20
|
-
position: absolute;
|
|
21
|
-
right: 0;
|
|
22
|
-
top: 100%;
|
|
23
|
-
line-height: 1;
|
|
24
|
-
margin-top: -2px;
|
|
13
|
+
.inline .display {
|
|
14
|
+
display: inline-block;
|
|
25
15
|
}
|
|
26
16
|
|
|
27
17
|
.inline .delta {
|
|
@@ -25,7 +25,7 @@ export const MetricsTableTitle = props => {
|
|
|
25
25
|
label: /*#__PURE__*/React.createElement(Icon, {
|
|
26
26
|
glyph: "help"
|
|
27
27
|
}),
|
|
28
|
-
|
|
28
|
+
anchorClassName: css.anchor
|
|
29
29
|
}, /*#__PURE__*/React.createElement(Stack, {
|
|
30
30
|
space: "xxxsmall"
|
|
31
31
|
}, popoverInfo && /*#__PURE__*/React.createElement("p", null, popoverInfo), popoverHref && /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("button", {
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
}
|
|
3
3
|
|
|
4
4
|
.title {
|
|
5
|
-
color: var(--color-text-light);
|
|
6
5
|
align-items: center;
|
|
6
|
+
color: var(--color-text-light);
|
|
7
7
|
font-weight: bold;
|
|
8
8
|
text-transform: uppercase;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
.
|
|
12
|
-
|
|
11
|
+
.anchor {
|
|
12
|
+
display: block;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
.info {
|
|
@@ -56,7 +56,7 @@ export const SummaryItem = _ref2 => {
|
|
|
56
56
|
const showMetricDescriptionTooltip = showMetricDescription && (metric == null ? void 0 : metric.description);
|
|
57
57
|
const rootClassName = cx(css.root, className, css[size], showDelta && css.showDelta);
|
|
58
58
|
return /*#__PURE__*/React.createElement(Stack, _extends({
|
|
59
|
-
space: "
|
|
59
|
+
space: "xxxsmall",
|
|
60
60
|
as: Component,
|
|
61
61
|
className: rootClassName
|
|
62
62
|
}, props), /*#__PURE__*/React.createElement("h3", {
|
|
@@ -78,8 +78,10 @@ export const SummaryItem = _ref2 => {
|
|
|
78
78
|
value: baseline,
|
|
79
79
|
formatter: metric.formatter
|
|
80
80
|
})) : /*#__PURE__*/React.createElement(Stack, null, /*#__PURE__*/React.createElement(Skeleton, {
|
|
81
|
+
as: "p",
|
|
81
82
|
className: cx(css.currentMetric, css.loading)
|
|
82
83
|
}), /*#__PURE__*/React.createElement(Skeleton, {
|
|
84
|
+
as: "p",
|
|
83
85
|
className: cx(css.baselineMetric, css.loading)
|
|
84
86
|
})));
|
|
85
87
|
};
|
|
@@ -8,23 +8,15 @@
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
.currentMetric {
|
|
11
|
-
display: block;
|
|
12
11
|
color: var(--color-heading);
|
|
13
12
|
font-size: var(--size-xlarge);
|
|
14
|
-
line-height: var(--space-medium);
|
|
15
13
|
white-space: nowrap;
|
|
16
14
|
font-weight: bold;
|
|
17
15
|
}
|
|
18
16
|
|
|
19
|
-
.delta {
|
|
20
|
-
font-size: var(--size-small);
|
|
21
|
-
line-height: var(--space-medium);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
17
|
.baselineMetric {
|
|
25
18
|
color: var(--color-text-light);
|
|
26
19
|
font-size: var(--size-small);
|
|
27
|
-
line-height: var(--space-small);
|
|
28
20
|
}
|
|
29
21
|
|
|
30
22
|
.readMoreLink {
|
|
@@ -63,5 +55,4 @@
|
|
|
63
55
|
/* Size large */
|
|
64
56
|
.large .currentMetric {
|
|
65
57
|
font-size: var(--size-xxxlarge);
|
|
66
|
-
line-height: var(--space-medium);
|
|
67
58
|
}
|
|
@@ -14,11 +14,14 @@ export const TotalSizeTypeTitle = _ref => {
|
|
|
14
14
|
} = _ref;
|
|
15
15
|
return /*#__PURE__*/React.createElement(FlexStack, {
|
|
16
16
|
space: "xxxsmall",
|
|
17
|
-
className: cx(css.
|
|
18
|
-
}, /*#__PURE__*/React.createElement("span",
|
|
17
|
+
className: cx(css.root, className)
|
|
18
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
19
|
+
className: css.text
|
|
20
|
+
}, I18N.ASSET_TOTALS), /*#__PURE__*/React.createElement(HoverCard, {
|
|
19
21
|
label: /*#__PURE__*/React.createElement(Icon, {
|
|
20
22
|
glyph: "help"
|
|
21
|
-
})
|
|
23
|
+
}),
|
|
24
|
+
anchorClassName: css.anchor
|
|
22
25
|
}, /*#__PURE__*/React.createElement(Stack, {
|
|
23
26
|
space: "xxxsmall"
|
|
24
27
|
}, /*#__PURE__*/React.createElement("p", null, I18N.ASSET_TOTALS_INFO), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("button", {
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
.
|
|
1
|
+
.root {
|
|
2
2
|
color: var(--color-text-light);
|
|
3
|
+
align-items: center;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.text {
|
|
3
7
|
font-weight: bold;
|
|
4
8
|
font-size: var(--size-medium);
|
|
5
9
|
line-height: var(--space-medium);
|
|
6
10
|
text-transform: uppercase;
|
|
7
11
|
}
|
|
8
12
|
|
|
13
|
+
.anchor {
|
|
14
|
+
display: block;
|
|
15
|
+
}
|
|
16
|
+
|
|
9
17
|
.readMoreLink {
|
|
10
18
|
appearance: none;
|
|
11
19
|
background: none;
|
package/lib-esm/i18n.js
CHANGED
|
@@ -10,8 +10,8 @@ export default {
|
|
|
10
10
|
READ_MORE: 'Read more',
|
|
11
11
|
ASSETS_INFO: 'Asset size - the size of the file produced by webpack',
|
|
12
12
|
ASSET_TOTALS_INFO: 'The total size of the assets produced by webpack by type',
|
|
13
|
-
MODULES_INFO: 'Module size - module
|
|
14
|
-
PACKAGES_INFO: "Package size - the total package's module size before any
|
|
13
|
+
MODULES_INFO: 'Module size - module source size before any production optimization(ex: terser minification)',
|
|
14
|
+
PACKAGES_INFO: "Package size - the total package's module size before any production optimization(ex: terser minification)",
|
|
15
15
|
RESET_FILTERS: 'Reset filters',
|
|
16
16
|
VIEW_ALL: 'View all entries'
|
|
17
17
|
};
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
background: var(--color-background);
|
|
41
41
|
min-width: 180px;
|
|
42
42
|
z-index: var(--layer-high);
|
|
43
|
-
padding: var(--space-
|
|
43
|
+
padding: var(--space-xxsmall) 0;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
.dropdown:focus {
|
|
@@ -55,12 +55,13 @@
|
|
|
55
55
|
width: 100%;
|
|
56
56
|
outline: none;
|
|
57
57
|
border: 0;
|
|
58
|
-
padding: var(--space-xxxsmall) var(--space-
|
|
58
|
+
padding: var(--space-xxxsmall) var(--space-xsmall);
|
|
59
59
|
background: none;
|
|
60
60
|
text-align: left;
|
|
61
61
|
color: var(--color-text-light);
|
|
62
62
|
font-size: var(--size-small);
|
|
63
63
|
line-height: inherit;
|
|
64
|
+
text-decoration: none;
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
.menuItem:hover {
|
|
@@ -13,6 +13,7 @@ import css from './filters.module.css';
|
|
|
13
13
|
const Filter = props => {
|
|
14
14
|
const {
|
|
15
15
|
className,
|
|
16
|
+
as: Component = 'div',
|
|
16
17
|
buttonClassName,
|
|
17
18
|
label,
|
|
18
19
|
name,
|
|
@@ -21,7 +22,7 @@ const Filter = props => {
|
|
|
21
22
|
} = props;
|
|
22
23
|
const id = `filter-${name}`;
|
|
23
24
|
const rootClassName = cx(css.filter, className);
|
|
24
|
-
return /*#__PURE__*/React.createElement(
|
|
25
|
+
return /*#__PURE__*/React.createElement(Component, {
|
|
25
26
|
className: rootClassName
|
|
26
27
|
}, /*#__PURE__*/React.createElement(FlexStack, {
|
|
27
28
|
space: "xxxsmall",
|
|
@@ -44,6 +45,7 @@ const Filter = props => {
|
|
|
44
45
|
|
|
45
46
|
Filter.propTypes = {
|
|
46
47
|
className: PropTypes.string,
|
|
48
|
+
as: PropTypes.elementType,
|
|
47
49
|
buttonClassName: PropTypes.string,
|
|
48
50
|
name: PropTypes.string.isRequired,
|
|
49
51
|
label: PropTypes.string.isRequired,
|
|
@@ -51,6 +53,7 @@ Filter.propTypes = {
|
|
|
51
53
|
};
|
|
52
54
|
Filter.defaultProps = {
|
|
53
55
|
className: '',
|
|
56
|
+
as: 'div',
|
|
54
57
|
buttonClassName: '',
|
|
55
58
|
getOnOnlyClick: null
|
|
56
59
|
};
|
|
@@ -123,18 +126,17 @@ const FilterGroup = props => {
|
|
|
123
126
|
[id]: true
|
|
124
127
|
});
|
|
125
128
|
|
|
126
|
-
return /*#__PURE__*/React.createElement(
|
|
127
|
-
key: id
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}), /*#__PURE__*/React.createElement(Filter, {
|
|
129
|
+
return /*#__PURE__*/React.createElement(Filter, {
|
|
130
|
+
key: id,
|
|
131
|
+
className: menuItemClassName,
|
|
132
|
+
as: MenuItem,
|
|
131
133
|
name: id,
|
|
132
134
|
label: itemData.label,
|
|
133
135
|
onChange: onCheckboxChange,
|
|
134
136
|
checked: values[id],
|
|
135
137
|
disabled: itemData.disabled,
|
|
136
138
|
getOnOnlyClick: getOnOnlyClick
|
|
137
|
-
})
|
|
139
|
+
});
|
|
138
140
|
})), /*#__PURE__*/React.createElement("div", {
|
|
139
141
|
className: css.filterGroupActions
|
|
140
142
|
}, areAllGroupItemsChecked ? /*#__PURE__*/React.createElement(MenuItem, {
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/* Checkbox + label + button */
|
|
2
2
|
.filter {
|
|
3
|
+
/* Update MenuItem padding */
|
|
4
|
+
padding-top: calc(var(--space-xxxsmall) / 2);
|
|
5
|
+
padding-bottom: calc(var(--space-xxxsmall) / 2);
|
|
6
|
+
|
|
3
7
|
position: relative;
|
|
4
8
|
width: 100%;
|
|
5
9
|
max-width: 240px;
|
|
@@ -11,7 +15,6 @@
|
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
.filterInput {
|
|
14
|
-
border-radius: var(--radius-small) 0 0 var(--radius-small);
|
|
15
18
|
flex: 0 0 auto;
|
|
16
19
|
height: 1em;
|
|
17
20
|
cursor: pointer;
|
|
@@ -26,17 +29,17 @@
|
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
.filterOnlyButton {
|
|
29
|
-
padding: var(--space-
|
|
32
|
+
padding: var(--space-xxxsmall) var(--space-xsmall);
|
|
30
33
|
display: none;
|
|
31
34
|
appearance: none;
|
|
32
35
|
border: none;
|
|
33
36
|
background: linear-gradient(90deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255) 30%);
|
|
34
37
|
cursor: pointer;
|
|
35
|
-
line-height: 1;
|
|
36
38
|
position: absolute;
|
|
37
39
|
right: 0;
|
|
38
|
-
top:
|
|
39
|
-
|
|
40
|
+
top: 0;
|
|
41
|
+
bottom: 0;
|
|
42
|
+
line-height: var(--space-xsmall);
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
/** filter disabled state */
|
|
@@ -63,6 +66,7 @@
|
|
|
63
66
|
|
|
64
67
|
/** Filter standard variation */
|
|
65
68
|
.filterStandalone {
|
|
69
|
+
padding: 0;
|
|
66
70
|
width: auto;
|
|
67
71
|
color: var(--color-text-light);
|
|
68
72
|
z-index: var(--layout-xlow); /* show collapsed border */
|
|
@@ -95,16 +99,11 @@
|
|
|
95
99
|
overflow: auto;
|
|
96
100
|
}
|
|
97
101
|
|
|
98
|
-
.filterGroupItem {
|
|
99
|
-
padding-top: 2px;
|
|
100
|
-
padding-bottom: 2px;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
102
|
.filterGroupActions {
|
|
104
|
-
margin-top: var(--space-
|
|
103
|
+
margin-top: var(--space-xxxsmall);
|
|
105
104
|
padding-top: var(--space-xxxsmall);
|
|
106
105
|
padding-bottom: var(--space-xxxsmall);
|
|
107
|
-
margin-bottom: calc(0px - var(--space-
|
|
106
|
+
margin-bottom: calc(0px - var(--space-xxsmall));
|
|
108
107
|
border-top: 1px solid var(--color-outline);
|
|
109
108
|
}
|
|
110
109
|
|
|
@@ -21,6 +21,7 @@ const resolveComponent = (as, href) => {
|
|
|
21
21
|
export const HoverCard = props => {
|
|
22
22
|
const {
|
|
23
23
|
className,
|
|
24
|
+
anchorClassName,
|
|
24
25
|
hoverCardClassName,
|
|
25
26
|
href,
|
|
26
27
|
as,
|
|
@@ -28,7 +29,8 @@ export const HoverCard = props => {
|
|
|
28
29
|
children
|
|
29
30
|
} = props;
|
|
30
31
|
const state = useHovercardState({
|
|
31
|
-
gutter: 8
|
|
32
|
+
gutter: 8,
|
|
33
|
+
timeout: 700
|
|
32
34
|
});
|
|
33
35
|
const hoverCardProps = useHovercard({
|
|
34
36
|
state,
|
|
@@ -46,7 +48,7 @@ export const HoverCard = props => {
|
|
|
46
48
|
}, /*#__PURE__*/React.createElement(HovercardAnchor, {
|
|
47
49
|
state: state,
|
|
48
50
|
href: href,
|
|
49
|
-
className: css.anchor,
|
|
51
|
+
className: cx(css.anchor, anchorClassName),
|
|
50
52
|
as: Component
|
|
51
53
|
}, label), /*#__PURE__*/React.createElement(Hovercard, _extends({}, hoverCardProps, {
|
|
52
54
|
state: state,
|
|
@@ -68,6 +70,9 @@ HoverCard.propTypes = {
|
|
|
68
70
|
/** Adopted child class name for hover card */
|
|
69
71
|
hoverCardClassName: PropTypes.string,
|
|
70
72
|
|
|
73
|
+
/** Adopted child class name for anchor */
|
|
74
|
+
anchorClassName: PropTypes.string,
|
|
75
|
+
|
|
71
76
|
/** Anchor label */
|
|
72
77
|
label: PropTypes.node,
|
|
73
78
|
|
|
@@ -83,6 +88,7 @@ HoverCard.propTypes = {
|
|
|
83
88
|
HoverCard.defaultProps = {
|
|
84
89
|
className: '',
|
|
85
90
|
hoverCardClassName: '',
|
|
91
|
+
anchorClassName: '',
|
|
86
92
|
label: '',
|
|
87
93
|
as: '',
|
|
88
94
|
href: ''
|
|
@@ -7,16 +7,22 @@ import css from './skeleton.module.css';
|
|
|
7
7
|
export const Skeleton = props => {
|
|
8
8
|
const {
|
|
9
9
|
className,
|
|
10
|
+
as: Component,
|
|
11
|
+
block,
|
|
10
12
|
...restProps
|
|
11
13
|
} = props;
|
|
12
|
-
const rootClassName = cx(css.root, className);
|
|
13
|
-
return /*#__PURE__*/React.createElement(
|
|
14
|
+
const rootClassName = cx(css.root, className, block && css.block);
|
|
15
|
+
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
14
16
|
className: rootClassName
|
|
15
17
|
}, restProps));
|
|
16
18
|
};
|
|
17
19
|
Skeleton.propTypes = {
|
|
18
|
-
className: PropTypes.string
|
|
20
|
+
className: PropTypes.string,
|
|
21
|
+
as: PropTypes.elementType,
|
|
22
|
+
block: PropTypes.bool
|
|
19
23
|
};
|
|
20
24
|
Skeleton.defaultProps = {
|
|
21
|
-
className: ''
|
|
25
|
+
className: '',
|
|
26
|
+
as: 'span',
|
|
27
|
+
block: false
|
|
22
28
|
};
|