@bundle-stats/ui 4.0.0-alpha.7 → 4.0.0-rc.2

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.
Files changed (43) hide show
  1. package/lib/components/bundle-modules/bundle-modules.js +1 -2
  2. package/lib/components/bundle-packages/bundle-packages.js +2 -1
  3. package/lib/components/metrics-table-title/metrics-table-title.js +6 -4
  4. package/lib/components/metrics-table-title/metrics-table-title.module.css +17 -0
  5. package/lib/components/summary/summary.js +6 -3
  6. package/lib/components/summary/summary.module.css +6 -2
  7. package/lib/components/summary-item/summary-item.module.css +1 -1
  8. package/lib/components/total-size-type-title/total-size-type-title.js +6 -4
  9. package/lib/components/total-size-type-title/total-size-type-title.module.css +18 -0
  10. package/lib/css/variables.css +11 -11
  11. package/lib/i18n.js +4 -4
  12. package/lib/ui/filters/filters.js +15 -11
  13. package/lib/ui/filters/filters.module.css +1 -1
  14. package/lib/ui/hover-card/hover-card.module.css +1 -1
  15. package/lib-esm/components/bundle-modules/bundle-modules.js +1 -2
  16. package/lib-esm/components/bundle-packages/bundle-packages.js +2 -1
  17. package/lib-esm/components/metrics-table-title/metrics-table-title.js +4 -4
  18. package/lib-esm/components/metrics-table-title/metrics-table-title.module.css +17 -0
  19. package/lib-esm/components/summary/summary.js +6 -3
  20. package/lib-esm/components/summary/summary.module.css +6 -2
  21. package/lib-esm/components/summary-item/summary-item.module.css +1 -1
  22. package/lib-esm/components/total-size-type-title/total-size-type-title.js +4 -4
  23. package/lib-esm/components/total-size-type-title/total-size-type-title.module.css +18 -0
  24. package/lib-esm/css/variables.css +11 -11
  25. package/lib-esm/i18n.js +4 -4
  26. package/lib-esm/ui/filters/filters.js +9 -11
  27. package/lib-esm/ui/filters/filters.module.css +1 -1
  28. package/lib-esm/ui/hover-card/hover-card.module.css +1 -1
  29. package/package.json +14 -14
  30. package/src/components/bundle-modules/bundle-modules.jsx +0 -1
  31. package/src/components/bundle-packages/bundle-packages.jsx +2 -2
  32. package/src/components/metrics-table-title/metrics-table-title.jsx +2 -2
  33. package/src/components/metrics-table-title/metrics-table-title.module.css +17 -0
  34. package/src/components/summary/summary.jsx +16 -11
  35. package/src/components/summary/summary.module.css +6 -2
  36. package/src/components/summary-item/summary-item.module.css +1 -1
  37. package/src/components/total-size-type-title/total-size-type-title.jsx +6 -2
  38. package/src/components/total-size-type-title/total-size-type-title.module.css +18 -0
  39. package/src/css/variables.css +11 -11
  40. package/src/i18n.js +6 -4
  41. package/src/ui/filters/filters.jsx +9 -3
  42. package/src/ui/filters/filters.module.css +1 -1
  43. package/src/ui/hover-card/hover-card.module.css +1 -1
@@ -185,8 +185,7 @@ var BundleModules = function BundleModules(_ref2) {
185
185
  disabled: jobs.length <= 1
186
186
  }), _defineProperty(_objectSpread2, _utils.MODULE_FILTERS.DUPLICATED, {
187
187
  label: 'Duplicate',
188
- defaultValue: filters[_utils.MODULE_FILTERS.DUPLICATED],
189
- disabled: jobs.length <= 1
188
+ defaultValue: filters[_utils.MODULE_FILTERS.DUPLICATED]
190
189
  }), _defineProperty(_objectSpread2, _utils.MODULE_SOURCE_TYPE, (_MODULE_SOURCE_TYPE = {
191
190
  label: 'Source'
192
191
  }, _defineProperty(_MODULE_SOURCE_TYPE, _utils.MODULE_FILTERS.FIRST_PARTY, {
@@ -77,7 +77,8 @@ var PackagePopoverContent = function PackagePopoverContent(_ref) {
77
77
  path = _ref.path,
78
78
  duplicate = _ref.duplicate,
79
79
  CustomComponentLink = _ref.CustomComponentLink;
80
- var normalizedPackagePath = path || "node_modules/".concat(fullName.split(_utils.PACKAGES_SEPARATOR).join('/node_modules/'), "/");
80
+ var fallbackPackagePath = "node_modules/".concat(fullName.split(_utils.PACKAGES_SEPARATOR).join('/node_modules/'));
81
+ var normalizedPackagePath = "".concat(path || fallbackPackagePath, "/");
81
82
 
82
83
  var _name$split = name.split(_utils.PACKAGE_ID_SEPARATOR),
83
84
  _name$split2 = _slicedToArray(_name$split, 2),
@@ -43,10 +43,12 @@ var MetricsTableTitle = function MetricsTableTitle(props) {
43
43
  })
44
44
  }, /*#__PURE__*/_react["default"].createElement(_stack.Stack, {
45
45
  space: "xxxsmall"
46
- }, popoverInfo && /*#__PURE__*/_react["default"].createElement("p", null, popoverInfo), popoverHref && /*#__PURE__*/_react["default"].createElement("p", null, /*#__PURE__*/_react["default"].createElement("a", {
47
- href: popoverHref,
48
- target: "_blank",
49
- rel: "noreferrer"
46
+ }, popoverInfo && /*#__PURE__*/_react["default"].createElement("p", null, popoverInfo), popoverHref && /*#__PURE__*/_react["default"].createElement("p", null, /*#__PURE__*/_react["default"].createElement("button", {
47
+ type: "button",
48
+ onClick: function onClick() {
49
+ return window.open(popoverHref);
50
+ },
51
+ className: _metricsTableTitleModule["default"].readMoreLink
50
52
  }, _i18n["default"].READ_MORE)))));
51
53
  };
52
54
 
@@ -11,3 +11,20 @@
11
11
  text-transform: none;
12
12
  }
13
13
 
14
+ .readMoreLink {
15
+ appearance: none;
16
+ background: none;
17
+ margin: 0;
18
+ border: 0;
19
+ padding: 0;
20
+ color: var(--color-primary);
21
+ text-decoration: underline;
22
+ cursor: pointer;
23
+ }
24
+
25
+ .readMoreLink:hover,
26
+ .readMoreLink:active,
27
+ .readMoreLink:focus {
28
+ color: var(--color-primary-dark);
29
+ text-decoration: none;
30
+ }
@@ -54,9 +54,9 @@ var Summary = function Summary(_ref) {
54
54
  showSummaryItemDelta = _ref.showSummaryItemDelta,
55
55
  SummaryItemCustomLink = _ref.summaryItemLink;
56
56
  return /*#__PURE__*/_react["default"].createElement(_box.Box, {
57
- outline: true,
58
57
  className: (0, _classnames["default"])(_summaryModule["default"].root, className)
59
58
  }, /*#__PURE__*/_react["default"].createElement(_flexStack.FlexStack, {
59
+ space: "small",
60
60
  className: _summaryModule["default"].items
61
61
  }, Array.from(_utils.METRIC_COMPONENT_LINKS).filter(function (_ref2) {
62
62
  var _ref3 = _slicedToArray(_ref2, 1),
@@ -68,11 +68,14 @@ var Summary = function Summary(_ref) {
68
68
  metricId = _ref5[0],
69
69
  metricOptions = _ref5[1];
70
70
 
71
- return /*#__PURE__*/_react["default"].createElement(_summaryItem.SummaryItem, _extends({
71
+ return /*#__PURE__*/_react["default"].createElement(_box.Box, _extends({
72
72
  key: metricId,
73
- className: _summaryModule["default"].item,
73
+ outline: true,
74
+ padding: "small",
74
75
  as: SummaryItemCustomLink
75
76
  }, metricOptions.link, {
77
+ className: _summaryModule["default"].item
78
+ }), /*#__PURE__*/_react["default"].createElement(_summaryItem.SummaryItem, {
76
79
  size: size,
77
80
  id: metricId,
78
81
  data: (0, _get2["default"])(data, metricId),
@@ -4,7 +4,11 @@
4
4
  }
5
5
 
6
6
  .item {
7
- padding: var(--space-small);
8
- flex: 1 0 25%; /* force equal sizes */
7
+ flex: 1 0 10%; /* force equal sizes */
8
+ min-width: 16em;
9
9
  text-decoration: none;
10
10
  }
11
+
12
+ .item:hover {
13
+ border-color: var(--color-outline-dark);
14
+ }
@@ -10,7 +10,7 @@
10
10
  .currentMetric {
11
11
  display: block;
12
12
  color: var(--color-heading);
13
- font-size: var(--size-large);
13
+ font-size: var(--size-xlarge);
14
14
  line-height: var(--space-medium);
15
15
  white-space: nowrap;
16
16
  font-weight: bold;
@@ -38,10 +38,12 @@ var TotalSizeTypeTitle = function TotalSizeTypeTitle(_ref) {
38
38
  })
39
39
  }, /*#__PURE__*/_react["default"].createElement(_stack.Stack, {
40
40
  space: "xxxsmall"
41
- }, /*#__PURE__*/_react["default"].createElement("p", null, _i18n["default"].ASSET_TOTALS_INFO), /*#__PURE__*/_react["default"].createElement("p", null, /*#__PURE__*/_react["default"].createElement("a", {
42
- href: _config["default"].documentation.assets,
43
- target: "_blank",
44
- rel: "noreferrer"
41
+ }, /*#__PURE__*/_react["default"].createElement("p", null, _i18n["default"].ASSET_TOTALS_INFO), /*#__PURE__*/_react["default"].createElement("p", null, /*#__PURE__*/_react["default"].createElement("button", {
42
+ type: "button",
43
+ onClick: function onClick() {
44
+ return window.open(_config["default"].documentation.assets);
45
+ },
46
+ className: _totalSizeTypeTitleModule["default"].readMoreLink
45
47
  }, _i18n["default"].READ_MORE)))));
46
48
  };
47
49
 
@@ -5,3 +5,21 @@
5
5
  line-height: var(--space-medium);
6
6
  text-transform: uppercase;
7
7
  }
8
+
9
+ .readMoreLink {
10
+ appearance: none;
11
+ background: none;
12
+ margin: 0;
13
+ border: 0;
14
+ padding: 0;
15
+ color: var(--color-primary);
16
+ text-decoration: underline;
17
+ cursor: pointer;
18
+ }
19
+
20
+ .readMoreLink:hover,
21
+ .readMoreLink:active,
22
+ .readMoreLink:focus {
23
+ color: var(--color-primary-dark);
24
+ text-decoration: none;
25
+ }
@@ -28,19 +28,19 @@
28
28
  /*
29
29
  * Color scheme:
30
30
  * https://coolors.co/3385d6-dd555e-63bf5e-f7e37d-192339
31
- * http://mcg.mbitson.com/#!?mcgpalette0=%23dd555e&mcgpalette1=%2363bf5e&mcgpalette2=%23f7e37d&mcgpalette3=%235b5d60&mcgpalette4=%233385d6&themename=mcgtheme
31
+ * http://mcg.mbitson.com/#!?mcgpalette0=%23dd555e&mcgpalette1=%2363bf5e&mcgpalette2=%23f7e37d&mcgpalette3=%23535558&mcgpalette4=%233385d6&themename=mcgtheme
32
32
  */
33
33
  --color-gray-25: #fafafa;
34
- --color-gray-50: #e4e4e5;
35
- --color-gray-100: #cececf;
36
- --color-gray-200: #adaeb0;
37
- --color-gray-300: #8c8e90;
38
- --color-gray-400: #747578;
39
- --color-gray-500: #5b5d60;
40
- --color-gray-600: #535558;
41
- --color-gray-700: #494b4e;
42
- --color-gray-800: #404144;
43
- --color-gray-900: #2f3033;
34
+ --color-gray-50: #eaebeb;
35
+ --color-gray-100: #cbcccd;
36
+ --color-gray-200: #a9aaac;
37
+ --color-gray-300: #87888a;
38
+ --color-gray-400: #6d6f71;
39
+ --color-gray-500: #535558;
40
+ --color-gray-600: #4c4e50;
41
+ --color-gray-700: #424447;
42
+ --color-gray-800: #393b3d;
43
+ --color-gray-900: #292a2d;
44
44
 
45
45
  --color-gray-ultra-light: var(--color-gray-200);
46
46
  --color-gray-light: var(--color-gray-300);
package/lib/i18n.js CHANGED
@@ -14,10 +14,10 @@ var _default = {
14
14
  CURRENT: 'current',
15
15
  BASELINE: 'baseline',
16
16
  READ_MORE: 'Read more',
17
- ASSETS_INFO: 'Asset size is the disk file size',
18
- ASSET_TOTALS_INFO: 'Total file type size is the disk size of the corresponding assets.',
19
- MODULES_INFO: 'Module size is the estimated size (stat size) before any production optimization (eg: minification).',
20
- PACKAGES_INFO: 'Package size is the estimated size (stat size) of the contained modules before any production optimization(eg: minification).',
17
+ ASSETS_INFO: 'Asset size - the size of the file produced by webpack',
18
+ ASSET_TOTALS_INFO: 'The total size of the assets produced by webpack by type',
19
+ MODULES_INFO: 'Module size - module file size before any transformation(ex: babel, typescript) or before any production optimization(ex: terser minification)',
20
+ PACKAGES_INFO: "Package size - the total package's module size before any transformation(ex: babel, typescript) or before any production optimization(ex: terser minification)",
21
21
  RESET_FILTERS: 'Reset filters',
22
22
  VIEW_ALL: 'View all entries'
23
23
  };
@@ -1,5 +1,7 @@
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
  });
@@ -7,7 +9,7 @@ exports.Filters = void 0;
7
9
 
8
10
  var _get2 = _interopRequireDefault(require("lodash/get"));
9
11
 
10
- var _react = _interopRequireDefault(require("react"));
12
+ var _react = _interopRequireWildcard(require("react"));
11
13
 
12
14
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
15
 
@@ -24,6 +26,10 @@ var _filtersModule = _interopRequireDefault(require("./filters.module.css"));
24
26
  var _excluded = ["className", "buttonClassName", "label", "name", "getOnOnlyClick"],
25
27
  _excluded2 = ["label"];
26
28
 
29
+ 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); }
30
+
31
+ 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; }
32
+
27
33
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
28
34
 
29
35
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -216,22 +222,20 @@ var Filters = function Filters(props) {
216
222
  filters = props.filters,
217
223
  toggleFilter = props.toggleFilter,
218
224
  toggleFilters = props.toggleFilters;
219
-
220
- var onCheckboxChange = function onCheckboxChange(_ref10) {
221
- var target = _ref10.target;
222
- return toggleFilter(target.name, target.checked);
223
- };
224
-
225
+ var onCheckboxChange = (0, _react.useCallback)(function (event) {
226
+ var name = event.target.name;
227
+ toggleFilter(name, !values[name]);
228
+ }, [toggleFilter, values]);
225
229
  var rootClassName = (0, _classnames["default"])(_filtersModule["default"].root, className);
226
230
  return /*#__PURE__*/_react["default"].createElement("form", {
227
231
  className: rootClassName
228
232
  }, /*#__PURE__*/_react["default"].createElement(_flexStack.FlexStack, {
229
233
  space: "xxsmall",
230
234
  className: _filtersModule["default"].items
231
- }, Object.entries(filters).map(function (_ref11) {
232
- var _ref12 = _slicedToArray(_ref11, 2),
233
- name = _ref12[0],
234
- data = _ref12[1];
235
+ }, Object.entries(filters).map(function (_ref10) {
236
+ var _ref11 = _slicedToArray(_ref10, 2),
237
+ name = _ref11[0],
238
+ data = _ref11[1];
235
239
 
236
240
  if (typeof (data === null || data === void 0 ? void 0 : data.defaultValue) !== 'undefined') {
237
241
  return /*#__PURE__*/_react["default"].createElement(Filter, {
@@ -91,7 +91,7 @@
91
91
  }
92
92
 
93
93
  .filterGroupItems {
94
- max-height: calc(20 * (var(--space-small) + 2 * var(--space-xxxsmall)));
94
+ max-height: calc(10 * (var(--space-small) + 2 * var(--space-xxxsmall)));
95
95
  overflow: auto;
96
96
  }
97
97
 
@@ -20,7 +20,7 @@
20
20
  padding: var(--space-xsmall) var(--space-small);
21
21
  border-radius: var(--radius-medium);
22
22
  width: calc(100vw - 2 * var(--space-small));
23
- max-width: 360px;
23
+ max-width: 340px;
24
24
  outline: none;
25
25
  filter: drop-shadow(0 0 var(--space-xxsmall) var(--color-shadow));
26
26
  will-change: filter;
@@ -122,8 +122,7 @@ export const BundleModules = _ref2 => {
122
122
  },
123
123
  [MODULE_FILTERS.DUPLICATED]: {
124
124
  label: 'Duplicate',
125
- defaultValue: filters[MODULE_FILTERS.DUPLICATED],
126
- disabled: jobs.length <= 1
125
+ defaultValue: filters[MODULE_FILTERS.DUPLICATED]
127
126
  },
128
127
  [MODULE_SOURCE_TYPE]: {
129
128
  label: 'Source',
@@ -30,7 +30,8 @@ const PackagePopoverContent = _ref => {
30
30
  duplicate,
31
31
  CustomComponentLink
32
32
  } = _ref;
33
- const normalizedPackagePath = path || `node_modules/${fullName.split(PACKAGES_SEPARATOR).join('/node_modules/')}/`;
33
+ const fallbackPackagePath = `node_modules/${fullName.split(PACKAGES_SEPARATOR).join('/node_modules/')}`;
34
+ const normalizedPackagePath = `${path || fallbackPackagePath}/`;
34
35
  const [normalizedName, packageId] = name.split(PACKAGE_ID_SEPARATOR);
35
36
  return /*#__PURE__*/React.createElement(Stack, {
36
37
  space: "xsmall",
@@ -27,10 +27,10 @@ export const MetricsTableTitle = props => {
27
27
  })
28
28
  }, /*#__PURE__*/React.createElement(Stack, {
29
29
  space: "xxxsmall"
30
- }, popoverInfo && /*#__PURE__*/React.createElement("p", null, popoverInfo), popoverHref && /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("a", {
31
- href: popoverHref,
32
- target: "_blank",
33
- rel: "noreferrer"
30
+ }, popoverInfo && /*#__PURE__*/React.createElement("p", null, popoverInfo), popoverHref && /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("button", {
31
+ type: "button",
32
+ onClick: () => window.open(popoverHref),
33
+ className: css.readMoreLink
34
34
  }, I18N.READ_MORE)))));
35
35
  };
36
36
  MetricsTableTitle.propTypes = {
@@ -11,3 +11,20 @@
11
11
  text-transform: none;
12
12
  }
13
13
 
14
+ .readMoreLink {
15
+ appearance: none;
16
+ background: none;
17
+ margin: 0;
18
+ border: 0;
19
+ padding: 0;
20
+ color: var(--color-primary);
21
+ text-decoration: underline;
22
+ cursor: pointer;
23
+ }
24
+
25
+ .readMoreLink:hover,
26
+ .readMoreLink:active,
27
+ .readMoreLink:focus {
28
+ color: var(--color-primary-dark);
29
+ text-decoration: none;
30
+ }
@@ -24,20 +24,23 @@ export const Summary = _ref => {
24
24
  summaryItemLink: SummaryItemCustomLink
25
25
  } = _ref;
26
26
  return /*#__PURE__*/React.createElement(Box, {
27
- outline: true,
28
27
  className: cx(css.root, className)
29
28
  }, /*#__PURE__*/React.createElement(FlexStack, {
29
+ space: "small",
30
30
  className: css.items
31
31
  }, Array.from(METRIC_COMPONENT_LINKS).filter(_ref2 => {
32
32
  let [metricId] = _ref2;
33
33
  return keys.includes(metricId);
34
34
  }).map(_ref3 => {
35
35
  let [metricId, metricOptions] = _ref3;
36
- return /*#__PURE__*/React.createElement(SummaryItem, _extends({
36
+ return /*#__PURE__*/React.createElement(Box, _extends({
37
37
  key: metricId,
38
- className: css.item,
38
+ outline: true,
39
+ padding: "small",
39
40
  as: SummaryItemCustomLink
40
41
  }, metricOptions.link, {
42
+ className: css.item
43
+ }), /*#__PURE__*/React.createElement(SummaryItem, {
41
44
  size: size,
42
45
  id: metricId,
43
46
  data: _get(data, metricId),
@@ -4,7 +4,11 @@
4
4
  }
5
5
 
6
6
  .item {
7
- padding: var(--space-small);
8
- flex: 1 0 25%; /* force equal sizes */
7
+ flex: 1 0 10%; /* force equal sizes */
8
+ min-width: 16em;
9
9
  text-decoration: none;
10
10
  }
11
+
12
+ .item:hover {
13
+ border-color: var(--color-outline-dark);
14
+ }
@@ -10,7 +10,7 @@
10
10
  .currentMetric {
11
11
  display: block;
12
12
  color: var(--color-heading);
13
- font-size: var(--size-large);
13
+ font-size: var(--size-xlarge);
14
14
  line-height: var(--space-medium);
15
15
  white-space: nowrap;
16
16
  font-weight: bold;
@@ -21,10 +21,10 @@ export const TotalSizeTypeTitle = _ref => {
21
21
  })
22
22
  }, /*#__PURE__*/React.createElement(Stack, {
23
23
  space: "xxxsmall"
24
- }, /*#__PURE__*/React.createElement("p", null, I18N.ASSET_TOTALS_INFO), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("a", {
25
- href: config.documentation.assets,
26
- target: "_blank",
27
- rel: "noreferrer"
24
+ }, /*#__PURE__*/React.createElement("p", null, I18N.ASSET_TOTALS_INFO), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("button", {
25
+ type: "button",
26
+ onClick: () => window.open(config.documentation.assets),
27
+ className: css.readMoreLink
28
28
  }, I18N.READ_MORE)))));
29
29
  };
30
30
  TotalSizeTypeTitle.propTypes = {
@@ -5,3 +5,21 @@
5
5
  line-height: var(--space-medium);
6
6
  text-transform: uppercase;
7
7
  }
8
+
9
+ .readMoreLink {
10
+ appearance: none;
11
+ background: none;
12
+ margin: 0;
13
+ border: 0;
14
+ padding: 0;
15
+ color: var(--color-primary);
16
+ text-decoration: underline;
17
+ cursor: pointer;
18
+ }
19
+
20
+ .readMoreLink:hover,
21
+ .readMoreLink:active,
22
+ .readMoreLink:focus {
23
+ color: var(--color-primary-dark);
24
+ text-decoration: none;
25
+ }
@@ -28,19 +28,19 @@
28
28
  /*
29
29
  * Color scheme:
30
30
  * https://coolors.co/3385d6-dd555e-63bf5e-f7e37d-192339
31
- * http://mcg.mbitson.com/#!?mcgpalette0=%23dd555e&mcgpalette1=%2363bf5e&mcgpalette2=%23f7e37d&mcgpalette3=%235b5d60&mcgpalette4=%233385d6&themename=mcgtheme
31
+ * http://mcg.mbitson.com/#!?mcgpalette0=%23dd555e&mcgpalette1=%2363bf5e&mcgpalette2=%23f7e37d&mcgpalette3=%23535558&mcgpalette4=%233385d6&themename=mcgtheme
32
32
  */
33
33
  --color-gray-25: #fafafa;
34
- --color-gray-50: #e4e4e5;
35
- --color-gray-100: #cececf;
36
- --color-gray-200: #adaeb0;
37
- --color-gray-300: #8c8e90;
38
- --color-gray-400: #747578;
39
- --color-gray-500: #5b5d60;
40
- --color-gray-600: #535558;
41
- --color-gray-700: #494b4e;
42
- --color-gray-800: #404144;
43
- --color-gray-900: #2f3033;
34
+ --color-gray-50: #eaebeb;
35
+ --color-gray-100: #cbcccd;
36
+ --color-gray-200: #a9aaac;
37
+ --color-gray-300: #87888a;
38
+ --color-gray-400: #6d6f71;
39
+ --color-gray-500: #535558;
40
+ --color-gray-600: #4c4e50;
41
+ --color-gray-700: #424447;
42
+ --color-gray-800: #393b3d;
43
+ --color-gray-900: #292a2d;
44
44
 
45
45
  --color-gray-ultra-light: var(--color-gray-200);
46
46
  --color-gray-light: var(--color-gray-300);
package/lib-esm/i18n.js CHANGED
@@ -8,10 +8,10 @@ export default {
8
8
  CURRENT: 'current',
9
9
  BASELINE: 'baseline',
10
10
  READ_MORE: 'Read more',
11
- ASSETS_INFO: 'Asset size is the disk file size',
12
- ASSET_TOTALS_INFO: 'Total file type size is the disk size of the corresponding assets.',
13
- MODULES_INFO: 'Module size is the estimated size (stat size) before any production optimization (eg: minification).',
14
- PACKAGES_INFO: 'Package size is the estimated size (stat size) of the contained modules before any production optimization(eg: minification).',
11
+ ASSETS_INFO: 'Asset size - the size of the file produced by webpack',
12
+ ASSET_TOTALS_INFO: 'The total size of the assets produced by webpack by type',
13
+ MODULES_INFO: 'Module size - module file size before any transformation(ex: babel, typescript) or before any production optimization(ex: terser minification)',
14
+ PACKAGES_INFO: "Package size - the total package's module size before any transformation(ex: babel, typescript) or before any production optimization(ex: terser minification)",
15
15
  RESET_FILTERS: 'Reset filters',
16
16
  VIEW_ALL: 'View all entries'
17
17
  };
@@ -3,7 +3,7 @@ import "core-js/modules/es.array.includes.js";
3
3
 
4
4
  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); }
5
5
 
6
- import React from 'react';
6
+ import React, { useCallback } from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import cx from 'classnames';
9
9
  import { FlexStack } from '../../layout/flex-stack';
@@ -177,22 +177,20 @@ export const Filters = props => {
177
177
  toggleFilter,
178
178
  toggleFilters
179
179
  } = props;
180
-
181
- const onCheckboxChange = _ref6 => {
182
- let {
183
- target
184
- } = _ref6;
185
- return toggleFilter(target.name, target.checked);
186
- };
187
-
180
+ const onCheckboxChange = useCallback(event => {
181
+ const {
182
+ name
183
+ } = event.target;
184
+ toggleFilter(name, !values[name]);
185
+ }, [toggleFilter, values]);
188
186
  const rootClassName = cx(css.root, className);
189
187
  return /*#__PURE__*/React.createElement("form", {
190
188
  className: rootClassName
191
189
  }, /*#__PURE__*/React.createElement(FlexStack, {
192
190
  space: "xxsmall",
193
191
  className: css.items
194
- }, Object.entries(filters).map(_ref7 => {
195
- let [name, data] = _ref7;
192
+ }, Object.entries(filters).map(_ref6 => {
193
+ let [name, data] = _ref6;
196
194
 
197
195
  if (typeof (data == null ? void 0 : data.defaultValue) !== 'undefined') {
198
196
  return /*#__PURE__*/React.createElement(Filter, {
@@ -91,7 +91,7 @@
91
91
  }
92
92
 
93
93
  .filterGroupItems {
94
- max-height: calc(20 * (var(--space-small) + 2 * var(--space-xxxsmall)));
94
+ max-height: calc(10 * (var(--space-small) + 2 * var(--space-xxxsmall)));
95
95
  overflow: auto;
96
96
  }
97
97
 
@@ -20,7 +20,7 @@
20
20
  padding: var(--space-xsmall) var(--space-small);
21
21
  border-radius: var(--radius-medium);
22
22
  width: calc(100vw - 2 * var(--space-small));
23
- max-width: 360px;
23
+ max-width: 340px;
24
24
  outline: none;
25
25
  filter: drop-shadow(0 0 var(--space-xxsmall) var(--color-shadow));
26
26
  will-change: filter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bundle-stats/ui",
3
- "version": "4.0.0-alpha.7",
3
+ "version": "4.0.0-rc.2",
4
4
  "description": "UI components for BundleStats projects.",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",
@@ -36,11 +36,11 @@
36
36
  },
37
37
  "homepage": "https://github.com/relative-ci/bundle-stats/blob/master/packages/ui#readme",
38
38
  "devDependencies": {
39
- "@babel/cli": "7.17.10",
40
- "@babel/core": "7.18.5",
41
- "@babel/plugin-proposal-class-properties": "7.17.12",
42
- "@babel/preset-env": "7.18.2",
43
- "@babel/preset-react": "7.17.12",
39
+ "@babel/cli": "7.18.6",
40
+ "@babel/core": "7.18.6",
41
+ "@babel/plugin-proposal-class-properties": "7.18.6",
42
+ "@babel/preset-env": "7.18.6",
43
+ "@babel/preset-react": "7.18.6",
44
44
  "@simplyianm/babel-plugin-inline-react-svg": "1.2.0",
45
45
  "@storybook/addon-essentials": "6.5.9",
46
46
  "@storybook/addon-knobs": "6.4.0",
@@ -51,13 +51,13 @@
51
51
  "@storybook/manager-webpack5": "6.5.9",
52
52
  "@storybook/react": "6.5.9",
53
53
  "babel-core": "7.0.0-bridge.0",
54
- "babel-jest": "28.1.1",
54
+ "babel-jest": "28.1.2",
55
55
  "babel-plugin-lodash": "3.3.4",
56
56
  "babel-plugin-require-context-hook": "1.0.0",
57
- "chromatic": "6.6.3",
57
+ "chromatic": "6.7.0",
58
58
  "classnames": "2.3.1",
59
59
  "colormap": "2.3.2",
60
- "core-js": "3.23.1",
60
+ "core-js": "3.23.3",
61
61
  "cross-env": "7.0.3",
62
62
  "enzyme": "3.11.0",
63
63
  "enzyme-adapter-react-16": "1.15.6",
@@ -80,17 +80,17 @@
80
80
  "core-js": "^3.0.0",
81
81
  "lodash": "^4.0.0",
82
82
  "prop-types": "^15.0.0",
83
- "react": "^16.0.0 | ^17.0.0",
84
- "react-dom": "^16.0.0 | ^17.0.0",
83
+ "react": "^16.0.0 || ^17.0.0",
84
+ "react-dom": "^16.0.0 || ^17.0.0",
85
85
  "react-router-dom": "^5.0.0"
86
86
  },
87
87
  "dependencies": {
88
- "@bundle-stats/utils": "^4.0.0-alpha.7",
89
- "ariakit": "2.0.0-next.30",
88
+ "@bundle-stats/utils": "^4.0.0-rc.2",
89
+ "ariakit": "2.0.0-next.31",
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": "89c6eeff0863047a918468600104854fa073617a"
95
+ "gitHead": "652db51eb69d0398d0925a469afa20bccc25d346"
96
96
  }
@@ -133,7 +133,6 @@ export const BundleModules = ({
133
133
  [MODULE_FILTERS.DUPLICATED]: {
134
134
  label: 'Duplicate',
135
135
  defaultValue: filters[MODULE_FILTERS.DUPLICATED],
136
- disabled: jobs.length <= 1,
137
136
  },
138
137
  [MODULE_SOURCE_TYPE]: {
139
138
  label: 'Source',
@@ -28,8 +28,8 @@ import { MetricsTableTitle } from '../metrics-table-title';
28
28
  import css from './bundle-packages.module.css';
29
29
 
30
30
  const PackagePopoverContent = ({ name, fullName, path, duplicate, CustomComponentLink }) => {
31
- const normalizedPackagePath =
32
- path || `node_modules/${fullName.split(PACKAGES_SEPARATOR).join('/node_modules/')}/`;
31
+ const fallbackPackagePath = `node_modules/${fullName.split(PACKAGES_SEPARATOR).join('/node_modules/')}`;
32
+ const normalizedPackagePath = `${path || fallbackPackagePath}/`;
33
33
  const [normalizedName, packageId] = name.split(PACKAGE_ID_SEPARATOR);
34
34
 
35
35
  return (
@@ -23,9 +23,9 @@ export const MetricsTableTitle = (props) => {
23
23
  {popoverInfo && <p>{popoverInfo}</p>}
24
24
  {popoverHref && (
25
25
  <p>
26
- <a href={popoverHref} target="_blank" rel="noreferrer">
26
+ <button type="button" onClick={() => window.open(popoverHref)} className={css.readMoreLink}>
27
27
  {I18N.READ_MORE}
28
- </a>
28
+ </button>
29
29
  </p>
30
30
  )}
31
31
  </Stack>
@@ -11,3 +11,20 @@
11
11
  text-transform: none;
12
12
  }
13
13
 
14
+ .readMoreLink {
15
+ appearance: none;
16
+ background: none;
17
+ margin: 0;
18
+ border: 0;
19
+ padding: 0;
20
+ color: var(--color-primary);
21
+ text-decoration: underline;
22
+ cursor: pointer;
23
+ }
24
+
25
+ .readMoreLink:hover,
26
+ .readMoreLink:active,
27
+ .readMoreLink:focus {
28
+ color: var(--color-primary-dark);
29
+ text-decoration: none;
30
+ }
@@ -20,23 +20,28 @@ export const Summary = ({
20
20
  showSummaryItemDelta,
21
21
  summaryItemLink: SummaryItemCustomLink,
22
22
  }) => (
23
- <Box outline className={cx(css.root, className)}>
24
- <FlexStack className={css.items}>
23
+ <Box className={cx(css.root, className)}>
24
+ <FlexStack space="small" className={css.items}>
25
25
  {Array.from(METRIC_COMPONENT_LINKS)
26
26
  .filter(([metricId]) => keys.includes(metricId))
27
27
  .map(([metricId, metricOptions]) => (
28
- <SummaryItem
28
+ <Box
29
29
  key={metricId}
30
- className={css.item}
30
+ outline
31
+ padding="small"
31
32
  as={SummaryItemCustomLink}
32
33
  {...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
- />
34
+ className={css.item}
35
+ >
36
+ <SummaryItem
37
+ size={size}
38
+ id={metricId}
39
+ data={get(data, metricId)}
40
+ loading={loading}
41
+ showMetricDescription
42
+ showDelta={showSummaryItemDelta && metricOptions.showDelta !== false}
43
+ />
44
+ </Box>
40
45
  ))}
41
46
  </FlexStack>
42
47
  </Box>
@@ -4,7 +4,11 @@
4
4
  }
5
5
 
6
6
  .item {
7
- padding: var(--space-small);
8
- flex: 1 0 25%; /* force equal sizes */
7
+ flex: 1 0 10%; /* force equal sizes */
8
+ min-width: 16em;
9
9
  text-decoration: none;
10
10
  }
11
+
12
+ .item:hover {
13
+ border-color: var(--color-outline-dark);
14
+ }
@@ -10,7 +10,7 @@
10
10
  .currentMetric {
11
11
  display: block;
12
12
  color: var(--color-heading);
13
- font-size: var(--size-large);
13
+ font-size: var(--size-xlarge);
14
14
  line-height: var(--space-medium);
15
15
  white-space: nowrap;
16
16
  font-weight: bold;
@@ -17,9 +17,13 @@ export const TotalSizeTypeTitle = ({ className }) => (
17
17
  <Stack space="xxxsmall">
18
18
  <p>{I18N.ASSET_TOTALS_INFO}</p>
19
19
  <p>
20
- <a href={config.documentation.assets} target="_blank" rel="noreferrer">
20
+ <button
21
+ type="button"
22
+ onClick={() => window.open(config.documentation.assets)}
23
+ className={css.readMoreLink}
24
+ >
21
25
  {I18N.READ_MORE}
22
- </a>
26
+ </button>
23
27
  </p>
24
28
  </Stack>
25
29
  </HoverCard>
@@ -5,3 +5,21 @@
5
5
  line-height: var(--space-medium);
6
6
  text-transform: uppercase;
7
7
  }
8
+
9
+ .readMoreLink {
10
+ appearance: none;
11
+ background: none;
12
+ margin: 0;
13
+ border: 0;
14
+ padding: 0;
15
+ color: var(--color-primary);
16
+ text-decoration: underline;
17
+ cursor: pointer;
18
+ }
19
+
20
+ .readMoreLink:hover,
21
+ .readMoreLink:active,
22
+ .readMoreLink:focus {
23
+ color: var(--color-primary-dark);
24
+ text-decoration: none;
25
+ }
@@ -28,19 +28,19 @@
28
28
  /*
29
29
  * Color scheme:
30
30
  * https://coolors.co/3385d6-dd555e-63bf5e-f7e37d-192339
31
- * http://mcg.mbitson.com/#!?mcgpalette0=%23dd555e&mcgpalette1=%2363bf5e&mcgpalette2=%23f7e37d&mcgpalette3=%235b5d60&mcgpalette4=%233385d6&themename=mcgtheme
31
+ * http://mcg.mbitson.com/#!?mcgpalette0=%23dd555e&mcgpalette1=%2363bf5e&mcgpalette2=%23f7e37d&mcgpalette3=%23535558&mcgpalette4=%233385d6&themename=mcgtheme
32
32
  */
33
33
  --color-gray-25: #fafafa;
34
- --color-gray-50: #e4e4e5;
35
- --color-gray-100: #cececf;
36
- --color-gray-200: #adaeb0;
37
- --color-gray-300: #8c8e90;
38
- --color-gray-400: #747578;
39
- --color-gray-500: #5b5d60;
40
- --color-gray-600: #535558;
41
- --color-gray-700: #494b4e;
42
- --color-gray-800: #404144;
43
- --color-gray-900: #2f3033;
34
+ --color-gray-50: #eaebeb;
35
+ --color-gray-100: #cbcccd;
36
+ --color-gray-200: #a9aaac;
37
+ --color-gray-300: #87888a;
38
+ --color-gray-400: #6d6f71;
39
+ --color-gray-500: #535558;
40
+ --color-gray-600: #4c4e50;
41
+ --color-gray-700: #424447;
42
+ --color-gray-800: #393b3d;
43
+ --color-gray-900: #292a2d;
44
44
 
45
45
  --color-gray-ultra-light: var(--color-gray-200);
46
46
  --color-gray-light: var(--color-gray-300);
package/src/i18n.js CHANGED
@@ -12,10 +12,12 @@ export default {
12
12
 
13
13
  READ_MORE: 'Read more',
14
14
 
15
- ASSETS_INFO: 'Asset size is the disk file size',
16
- ASSET_TOTALS_INFO: 'Total file type size is the disk size of the corresponding assets.',
17
- MODULES_INFO: 'Module size is the estimated size (stat size) before any production optimization (eg: minification).',
18
- PACKAGES_INFO: 'Package size is the estimated size (stat size) of the contained modules before any production optimization(eg: minification).',
15
+ ASSETS_INFO: 'Asset size - the size of the file produced by webpack',
16
+ ASSET_TOTALS_INFO: 'The total size of the assets produced by webpack by type',
17
+ MODULES_INFO:
18
+ 'Module size - module file size before any transformation(ex: babel, typescript) or before any production optimization(ex: terser minification)',
19
+ PACKAGES_INFO:
20
+ "Package size - the total package's module size before any transformation(ex: babel, typescript) or before any production optimization(ex: terser minification)",
19
21
 
20
22
  RESET_FILTERS: 'Reset filters',
21
23
  VIEW_ALL: 'View all entries',
@@ -1,7 +1,7 @@
1
- import React from 'react';
1
+ import React, { useCallback } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import cx from 'classnames';
4
- import { get } from 'lodash';
4
+ import { get, map } from 'lodash';
5
5
 
6
6
  import { FlexStack } from '../../layout/flex-stack';
7
7
  import { Dropdown } from '../dropdown';
@@ -170,7 +170,13 @@ FilterGroup.defaultProps = {
170
170
  export const Filters = (props) => {
171
171
  const { className, values, filters, toggleFilter, toggleFilters } = props;
172
172
 
173
- const onCheckboxChange = ({ target }) => toggleFilter(target.name, target.checked);
173
+ const onCheckboxChange = useCallback(
174
+ (event) => {
175
+ const { name } = event.target;
176
+ toggleFilter(name, !values[name]);
177
+ },
178
+ [toggleFilter, values]
179
+ );
174
180
  const rootClassName = cx(css.root, className);
175
181
 
176
182
  return (
@@ -91,7 +91,7 @@
91
91
  }
92
92
 
93
93
  .filterGroupItems {
94
- max-height: calc(20 * (var(--space-small) + 2 * var(--space-xxxsmall)));
94
+ max-height: calc(10 * (var(--space-small) + 2 * var(--space-xxxsmall)));
95
95
  overflow: auto;
96
96
  }
97
97
 
@@ -20,7 +20,7 @@
20
20
  padding: var(--space-xsmall) var(--space-small);
21
21
  border-radius: var(--radius-medium);
22
22
  width: calc(100vw - 2 * var(--space-small));
23
- max-width: 360px;
23
+ max-width: 340px;
24
24
  outline: none;
25
25
  filter: drop-shadow(0 0 var(--space-xxsmall) var(--color-shadow));
26
26
  will-change: filter;