@bundle-stats/ui 3.4.0-beta.0 → 4.0.0-alpha.3

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 (139) hide show
  1. package/lib/app/app.js +6 -21
  2. package/lib/app/app.stories.js +1 -22
  3. package/lib/assets/icons.svg +0 -8
  4. package/lib/components/asset-info/asset-info.js +1 -1
  5. package/lib/components/bundle-assets/bundle-assets.js +1 -1
  6. package/lib/components/bundle-assets/index.js +1 -1
  7. package/lib/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js +1 -1
  8. package/lib/components/bundle-assets-totals-table/bundle-assets-totals-table.js +8 -43
  9. package/lib/components/bundle-assets-totals-table/bundle-assets-totals-table.module.css +2 -2
  10. package/lib/components/bundle-assets-totals-table/bundle-assets-totals-table.stories.js +1 -20
  11. package/lib/components/bundle-modules/bundle-modules.js +1 -1
  12. package/lib/components/bundle-modules/index.js +1 -1
  13. package/lib/components/bundle-packages/bundle-packages.js +1 -1
  14. package/lib/components/bundle-packages/index.js +1 -1
  15. package/lib/components/component-link.js +1 -1
  16. package/lib/components/index.js +0 -8
  17. package/lib/components/job-meta/job-meta.js +1 -1
  18. package/lib/components/job-name/job-name.js +1 -1
  19. package/lib/components/metrics-table/metrics-table.js +1 -1
  20. package/lib/components/metrics-table-options/metrics-table-options.js +1 -1
  21. package/lib/components/module-info/module-info.js +1 -1
  22. package/lib/components/summary/summary.js +8 -13
  23. package/lib/components/summary/summary.stories.js +1 -58
  24. package/lib/components/summary-item/summary-item.js +6 -21
  25. package/lib/components/summary-item/summary-item.module.css +0 -6
  26. package/lib/components/summary-item/summary-item.stories.js +53 -65
  27. package/lib/constants.js +4 -4
  28. package/lib/layout/box/box.js +1 -1
  29. package/lib/layout/flex-stack/flex-stack.js +1 -1
  30. package/lib/layout/footer/footer.js +1 -1
  31. package/lib/layout/separator.js +1 -1
  32. package/lib/layout/stack/stack.js +1 -1
  33. package/lib/query-state.js +1 -1
  34. package/lib/ui/alert/alert.js +3 -13
  35. package/lib/ui/container/container.js +1 -1
  36. package/lib/ui/filters/filters.container.js +3 -3
  37. package/lib/ui/filters/filters.js +1 -1
  38. package/lib/ui/horizontal-bar-chart/horizontal-bar-chart.js +2 -2
  39. package/lib/ui/hover-card/hover-card.js +1 -1
  40. package/lib/ui/hover-card/hover-card.stories.js +1 -1
  41. package/lib/ui/icon/icon.js +1 -3
  42. package/lib/ui/input/input.js +1 -1
  43. package/lib/ui/loader/loader.js +1 -1
  44. package/lib/ui/logo/logo.js +1 -1
  45. package/lib/ui/panels/panels.js +1 -1
  46. package/lib/ui/skeleton/skeleton.js +1 -1
  47. package/lib/ui/sort-dropdown/sort-dropdown.js +1 -1
  48. package/lib/ui/tag/tag.js +1 -1
  49. package/lib/ui/tooltip/tooltip.js +1 -1
  50. package/lib-esm/app/app.js +6 -20
  51. package/lib-esm/app/app.stories.js +1 -22
  52. package/lib-esm/assets/icons.svg +0 -8
  53. package/lib-esm/components/asset-info/asset-info.js +1 -1
  54. package/lib-esm/components/bundle-assets/bundle-assets.js +1 -1
  55. package/lib-esm/components/bundle-assets/bundle-assets.utils.js +1 -0
  56. package/lib-esm/components/bundle-assets/index.js +1 -1
  57. package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js +1 -1
  58. package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.js +8 -24
  59. package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.module.css +2 -2
  60. package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.stories.js +0 -18
  61. package/lib-esm/components/bundle-modules/bundle-modules.js +1 -1
  62. package/lib-esm/components/bundle-modules/index.js +1 -1
  63. package/lib-esm/components/bundle-packages/bundle-packages.js +1 -1
  64. package/lib-esm/components/bundle-packages/bundle-packages.utils.js +1 -0
  65. package/lib-esm/components/bundle-packages/index.js +1 -1
  66. package/lib-esm/components/component-link.js +1 -1
  67. package/lib-esm/components/index.js +0 -1
  68. package/lib-esm/components/job-meta/job-meta.js +1 -1
  69. package/lib-esm/components/job-name/job-name.js +1 -1
  70. package/lib-esm/components/metrics-table/metrics-table.js +1 -1
  71. package/lib-esm/components/metrics-table-options/metrics-table-options.js +1 -1
  72. package/lib-esm/components/module-info/module-info.js +1 -1
  73. package/lib-esm/components/summary/summary.js +9 -12
  74. package/lib-esm/components/summary/summary.stories.js +1 -56
  75. package/lib-esm/components/summary-item/summary-item.js +5 -18
  76. package/lib-esm/components/summary-item/summary-item.module.css +0 -6
  77. package/lib-esm/components/summary-item/summary-item.stories.js +38 -64
  78. package/lib-esm/constants.js +4 -4
  79. package/lib-esm/layout/box/box.js +1 -1
  80. package/lib-esm/layout/flex-stack/flex-stack.js +1 -1
  81. package/lib-esm/layout/footer/footer.js +1 -1
  82. package/lib-esm/layout/separator.js +1 -1
  83. package/lib-esm/layout/stack/stack.js +1 -1
  84. package/lib-esm/query-state.js +1 -1
  85. package/lib-esm/ui/alert/alert.js +3 -6
  86. package/lib-esm/ui/container/container.js +1 -1
  87. package/lib-esm/ui/filters/filters.container.js +1 -1
  88. package/lib-esm/ui/filters/filters.js +2 -1
  89. package/lib-esm/ui/hover-card/hover-card.js +1 -1
  90. package/lib-esm/ui/hover-card/hover-card.stories.js +1 -1
  91. package/lib-esm/ui/icon/icon.js +1 -3
  92. package/lib-esm/ui/input/input.js +1 -1
  93. package/lib-esm/ui/loader/loader.js +1 -1
  94. package/lib-esm/ui/logo/logo.js +1 -1
  95. package/lib-esm/ui/panels/panels.js +1 -1
  96. package/lib-esm/ui/skeleton/skeleton.js +1 -1
  97. package/lib-esm/ui/sort-dropdown/sort-dropdown.js +1 -1
  98. package/lib-esm/ui/tag/tag.js +1 -1
  99. package/lib-esm/ui/tooltip/tooltip.js +1 -1
  100. package/package.json +20 -20
  101. package/src/app/app.jsx +5 -12
  102. package/src/assets/icons.svg +0 -8
  103. package/src/components/bundle-assets-totals-table/bundle-assets-totals-table.jsx +13 -27
  104. package/src/components/bundle-assets-totals-table/bundle-assets-totals-table.module.css +2 -2
  105. package/src/components/index.js +0 -1
  106. package/src/components/summary/summary.jsx +7 -8
  107. package/src/components/summary-item/summary-item.jsx +3 -10
  108. package/src/components/summary-item/summary-item.module.css +0 -6
  109. package/src/constants.js +11 -7
  110. package/src/ui/alert/alert.jsx +2 -7
  111. package/src/ui/icon/icon.jsx +0 -2
  112. package/lib/assets/icons/alert-circle.svg +0 -1
  113. package/lib/assets/icons/check-circle.svg +0 -1
  114. package/lib/components/budget-info/budget-info.js +0 -74
  115. package/lib/components/budget-info/budget-info.module.css +0 -40
  116. package/lib/components/budget-info/budget-info.stories.js +0 -59
  117. package/lib/components/budget-info/index.js +0 -18
  118. package/lib/components/budget-insights/budget-insights.js +0 -162
  119. package/lib/components/budget-insights/budget-insights.module.css +0 -61
  120. package/lib/components/budget-insights/budget-insights.stories.js +0 -165
  121. package/lib/components/budget-insights/index.js +0 -18
  122. package/lib-esm/assets/icons/alert-circle.svg +0 -1
  123. package/lib-esm/assets/icons/check-circle.svg +0 -1
  124. package/lib-esm/components/budget-info/budget-info.js +0 -57
  125. package/lib-esm/components/budget-info/budget-info.module.css +0 -40
  126. package/lib-esm/components/budget-info/budget-info.stories.js +0 -45
  127. package/lib-esm/components/budget-info/index.js +0 -1
  128. package/lib-esm/components/budget-insights/budget-insights.js +0 -112
  129. package/lib-esm/components/budget-insights/budget-insights.module.css +0 -61
  130. package/lib-esm/components/budget-insights/budget-insights.stories.js +0 -144
  131. package/lib-esm/components/budget-insights/index.js +0 -1
  132. package/src/assets/icons/alert-circle.svg +0 -1
  133. package/src/assets/icons/check-circle.svg +0 -1
  134. package/src/components/budget-info/budget-info.jsx +0 -55
  135. package/src/components/budget-info/budget-info.module.css +0 -40
  136. package/src/components/budget-info/index.js +0 -1
  137. package/src/components/budget-insights/budget-insights.jsx +0 -124
  138. package/src/components/budget-insights/budget-insights.module.css +0 -61
  139. package/src/components/budget-insights/index.js +0 -1
@@ -1,165 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = exports.WarnedBudgets = exports.FailedBudgets = exports.Default = void 0;
7
-
8
- var _merge2 = _interopRequireDefault(require("lodash/merge"));
9
-
10
- var _react = _interopRequireDefault(require("react"));
11
-
12
- var _reactRouterDom = require("react-router-dom");
13
-
14
- var _ = require(".");
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
-
18
- var BUDGETS = {
19
- type: 'SUCCESS',
20
- message: {
21
- text: '8 budget checks passed',
22
- md: '**8** budget checks passed'
23
- },
24
- data: {
25
- totalSizeByTypeALL: {
26
- type: 'ERROR',
27
- message: {
28
- text: 'Bundle Size is above the budget',
29
- md: 'Bundle Size is above the budget'
30
- },
31
- data: {
32
- currentValue: 2097917,
33
- budgetValue: 2097152,
34
- failed: true
35
- }
36
- },
37
- totalInitialSizeJS: {
38
- type: 'ERROR',
39
- message: {
40
- text: 'Initial JS is above the budget',
41
- md: 'Initial JS is above the budget'
42
- },
43
- data: {
44
- currentValue: 1265645,
45
- budgetValue: 524288,
46
- failed: true
47
- }
48
- },
49
- totalInitialSizeCSS: {
50
- type: 'SUCCESS',
51
- message: {
52
- text: 'Initial CSS is below the budget',
53
- md: 'Initial CSS is below the budget'
54
- },
55
- data: {
56
- currentValue: 48866,
57
- budgetValue: 51200,
58
- failed: false
59
- }
60
- },
61
- chunkCount: {
62
- type: 'SUCCESS',
63
- message: {
64
- text: 'Chunks is below the budget',
65
- md: 'Chunks is below the budget'
66
- },
67
- data: {
68
- currentValue: 12,
69
- budgetValue: 50,
70
- failed: false
71
- }
72
- },
73
- moduleCount: {
74
- type: 'SUCCESS',
75
- message: {
76
- text: 'Modules is below the budget',
77
- md: 'Modules is below the budget'
78
- },
79
- data: {
80
- currentValue: 1059,
81
- budgetValue: 2000,
82
- failed: false
83
- }
84
- },
85
- duplicatePackagesCount: {
86
- type: 'ERROR',
87
- message: {
88
- text: 'Duplicate packages is above the budget',
89
- md: 'Duplicate packages is above the budget'
90
- },
91
- data: {
92
- currentValue: 13,
93
- budgetValue: 5,
94
- failed: true
95
- }
96
- },
97
- 'sizes.totalSizeByTypeJS': {
98
- type: 'SUCCESS',
99
- message: {
100
- text: 'JS is below the budget',
101
- md: 'JS is below the budget'
102
- },
103
- data: {
104
- currentValue: 1981470,
105
- budgetValue: 2097152,
106
- failed: false
107
- }
108
- },
109
- 'sizes.totalSizeByTypeCSS': {
110
- type: 'SUCCESS',
111
- message: {
112
- text: 'CSS is below the budget',
113
- md: 'CSS is below the budget'
114
- },
115
- data: {
116
- currentValue: 56091,
117
- budgetValue: 20480,
118
- failed: true
119
- }
120
- }
121
- }
122
- };
123
- var _default = {
124
- title: 'Components/BudgetInsights',
125
- component: _.BudgetInsights,
126
- decorators: [function (Story) {
127
- return /*#__PURE__*/_react["default"].createElement(_reactRouterDom.MemoryRouter, null, /*#__PURE__*/_react["default"].createElement(Story, null));
128
- }]
129
- };
130
- exports["default"] = _default;
131
-
132
- var Template = function Template(args) {
133
- return /*#__PURE__*/_react["default"].createElement(_.BudgetInsights, args);
134
- };
135
-
136
- var Default = Template.bind();
137
- exports.Default = Default;
138
- Default.args = {
139
- source: 'webpack',
140
- budgets: BUDGETS
141
- };
142
- var FailedBudgets = Template.bind();
143
- exports.FailedBudgets = FailedBudgets;
144
- FailedBudgets.args = {
145
- source: 'webpack',
146
- budgets: (0, _merge2["default"])({}, BUDGETS, {
147
- type: 'ERROR',
148
- message: {
149
- text: '2/8 budget checks failed',
150
- md: '**2/8** budget checks failed'
151
- }
152
- })
153
- };
154
- var WarnedBudgets = Template.bind();
155
- exports.WarnedBudgets = WarnedBudgets;
156
- WarnedBudgets.args = {
157
- source: 'webpack',
158
- budgets: (0, _merge2["default"])({}, BUDGETS, {
159
- type: 'WARNING',
160
- message: {
161
- text: '2/8 budget checks warned',
162
- md: '**2/8** budget checks warned'
163
- }
164
- })
165
- };
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- var _budgetInsights = require("./budget-insights");
8
-
9
- Object.keys(_budgetInsights).forEach(function (key) {
10
- if (key === "default" || key === "__esModule") return;
11
- if (key in exports && exports[key] === _budgetInsights[key]) return;
12
- Object.defineProperty(exports, key, {
13
- enumerable: true,
14
- get: function get() {
15
- return _budgetInsights[key];
16
- }
17
- });
18
- });
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-alert-circle"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check-circle"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path><polyline points="22 4 12 14.01 9 11.01"></polyline></svg>
@@ -1,57 +0,0 @@
1
- import React from 'react';
2
- import cx from 'classnames';
3
- import PropTypes from 'prop-types';
4
- import { InsightType } from '@bundle-stats/utils';
5
- import { Icon } from '../../ui/icon';
6
- import { Tooltip } from '../../ui/tooltip';
7
- import css from './budget-info.module.css';
8
- const INSIGHT_TYPE_MAP = {
9
- [InsightType.SUCCESS]: {
10
- className: css.success,
11
- glyph: Icon.ICONS.CHECK_CIRCLE
12
- },
13
- [InsightType.ERROR]: {
14
- className: css.error,
15
- glyph: Icon.ICONS.ALERT_CIRCLE
16
- },
17
- [InsightType.WARNING]: {
18
- className: css.warning,
19
- glyph: Icon.ICONS.WARNING
20
- }
21
- };
22
- export const BudgetInfo = _ref => {
23
- let {
24
- className = '',
25
- budgetInsight
26
- } = _ref;
27
- const {
28
- className: insightTypeClassName,
29
- glyph
30
- } = INSIGHT_TYPE_MAP[budgetInsight.type];
31
- const rootClassName = cx(css.root, insightTypeClassName, className);
32
- return /*#__PURE__*/React.createElement(Tooltip, {
33
- className: rootClassName,
34
- title: budgetInsight.message.text
35
- }, /*#__PURE__*/React.createElement(Icon, {
36
- className: css.icon,
37
- glyph: glyph,
38
- size: "medium"
39
- }));
40
- };
41
- BudgetInfo.propTypes = {
42
- budgetInsight: PropTypes.shape({
43
- type: PropTypes.string,
44
- message: PropTypes.shape({
45
- text: PropTypes.string
46
- }),
47
- data: PropTypes.shape({
48
- currentValue: PropTypes.number,
49
- budgetValue: PropTypes.number,
50
- failed: PropTypes.bool
51
- })
52
- }).isRequired,
53
- className: PropTypes.string
54
- };
55
- BudgetInfo.defaultProps = {
56
- className: ''
57
- };
@@ -1,40 +0,0 @@
1
- .root {
2
- display: inline-block;
3
- line-height: 1em;
4
- }
5
-
6
- /* Budget error */
7
- .error .icon {
8
- color: var(--color-danger);
9
- }
10
-
11
- .error .icon:hover,
12
- .error .icon:focus,
13
- .error .icon:active
14
- {
15
- color: var(--color-danger-light);
16
- }
17
-
18
- /* Budget success */
19
- .success .icon {
20
- color: var(--color-success);
21
- }
22
-
23
- .success .icon:hover,
24
- .success .icon:focus,
25
- .success .icon:active
26
- {
27
- color: var(--color-success-light);
28
- }
29
-
30
- /* Budget warning */
31
- .warning .icon {
32
- color: var(--color-warning-dark);
33
- }
34
-
35
- .warning .icon:hover,
36
- .warning .icon:focus,
37
- .warning .icon:active
38
- {
39
- color: var(--color-warning);
40
- }
@@ -1,45 +0,0 @@
1
- import React from 'react';
2
- import { storiesOf } from '@storybook/react';
3
- import { getWrapperDecorator } from '../../stories';
4
- import { BudgetInfo } from '.';
5
- const stories = storiesOf('Components/BudgetInfo', module);
6
- stories.addDecorator(getWrapperDecorator());
7
- stories.add('default', () => /*#__PURE__*/React.createElement(BudgetInfo, {
8
- budgetInsight: {
9
- type: 'SUCCESS',
10
- message: {
11
- text: 'Metric is under the budget'
12
- },
13
- data: {
14
- budgetValue: 300,
15
- currentValue: 250,
16
- failed: false
17
- }
18
- }
19
- }));
20
- stories.add('error', () => /*#__PURE__*/React.createElement(BudgetInfo, {
21
- budgetInsight: {
22
- type: 'ERROR',
23
- message: {
24
- text: 'Metric is over the budget'
25
- },
26
- data: {
27
- budgetValue: 300,
28
- currentValue: 250,
29
- failed: false
30
- }
31
- }
32
- }));
33
- stories.add('warning', () => /*#__PURE__*/React.createElement(BudgetInfo, {
34
- budgetInsight: {
35
- type: 'WARNING',
36
- message: {
37
- text: 'Metric is equal the budget'
38
- },
39
- data: {
40
- budgetValue: 300,
41
- currentValue: 250,
42
- failed: false
43
- }
44
- }
45
- }));
@@ -1 +0,0 @@
1
- export * from './budget-info';
@@ -1,112 +0,0 @@
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
-
3
- import React, { useMemo, useState } from 'react';
4
- import PropTypes from 'prop-types';
5
- import cx from 'classnames';
6
- import { METRIC_COMPONENT_LINKS } from '@bundle-stats/utils';
7
- import { Box } from '../../layout/box';
8
- import { Stack } from '../../layout/stack';
9
- import { FlexStack } from '../../layout/flex-stack';
10
- import { Alert } from '../../ui/alert';
11
- import { Icon } from '../../ui/icon';
12
- import { ComponentLink } from '../component-link';
13
- import css from './budget-insights.module.css';
14
-
15
- const Budget = props => {
16
- const {
17
- className,
18
- metricId,
19
- budget,
20
- CustomLink
21
- } = props;
22
- const componentLinkOptions = METRIC_COMPONENT_LINKS.get(metricId);
23
- return /*#__PURE__*/React.createElement(CustomLink, _extends({
24
- className: cx(css.budget, className, budget.type === 'SUCCESS' && css.budgetSuccess)
25
- }, componentLinkOptions == null ? void 0 : componentLinkOptions.link), budget.message.text);
26
- };
27
-
28
- Budget.propTypes = {
29
- className: PropTypes.string,
30
- metricId: PropTypes.string.isRequired,
31
- budget: PropTypes.shape({
32
- type: PropTypes.string,
33
- message: PropTypes.shape({
34
- text: PropTypes.string
35
- }),
36
- data: PropTypes.shape({
37
- currentValue: PropTypes.number.isRequired,
38
- budgetValue: PropTypes.number.isRequired,
39
- failed: PropTypes.bool.isRequired
40
- })
41
- }).isRequired,
42
- CustomLink: PropTypes.elementType.isRequired
43
- };
44
- Budget.defaultProps = {
45
- className: ''
46
- };
47
- const BUDGET_ALERT_KIND = new Map([['ERROR', 'danger'], ['WARNING', 'warning'], ['SUCCESS', 'success']]);
48
- const BUDGET_ICON = new Map([['ERROR', Icon.ICONS.ALERT_CIRCLE], ['WARNING', Icon.ICONS.WARNING], ['SUCCESS', Icon.ICONS.CHECK_CIRCLE]]);
49
- export const BudgetInsights = props => {
50
- const {
51
- className,
52
- source,
53
- budgets,
54
- CustomLink
55
- } = props;
56
- const [showBudgets, setShowBudgets] = useState(false);
57
- const iconGlyph = BUDGET_ICON.get(budgets.type);
58
- const alertKind = BUDGET_ALERT_KIND.get(budgets.type);
59
- const rootClassName = cx(css.group, className, css[`group-${alertKind}`]);
60
- const budgetItems = useMemo(() => {
61
- const items = Object.entries(budgets.data); // When there are errors/warnings, sort budget items first
62
-
63
- if (['ERROR', 'WARNING'].includes(budgets.type)) {
64
- items.sort(a => a[1].type === budgets.type ? -1 : 1);
65
- }
66
-
67
- return items;
68
- }, [budgets]);
69
- return /*#__PURE__*/React.createElement(Alert, {
70
- kind: alertKind,
71
- padding: "none",
72
- className: rootClassName
73
- }, /*#__PURE__*/React.createElement(Box, {
74
- padding: ['xsmall', 'small'],
75
- className: css.groupHeader,
76
- as: "button",
77
- type: "button",
78
- onClick: () => setShowBudgets(!showBudgets)
79
- }, /*#__PURE__*/React.createElement(FlexStack, {
80
- space: "xxsmall",
81
- className: css.groupTitle
82
- }, iconGlyph && /*#__PURE__*/React.createElement(Icon, {
83
- className: css.groupIcon,
84
- glyph: iconGlyph
85
- }), /*#__PURE__*/React.createElement("span", null, budgets.message.text), /*#__PURE__*/React.createElement("span", {
86
- className: css.groupTitleToggle
87
- }, showBudgets ? 'hide' : 'show', " all"))), showBudgets && /*#__PURE__*/React.createElement(Box, {
88
- padding: ['xsmall', 'small'],
89
- className: css.groupContent
90
- }, /*#__PURE__*/React.createElement(Stack, {
91
- space: "none"
92
- }, budgetItems.map(_ref => {
93
- let [key, budget] = _ref;
94
- return /*#__PURE__*/React.createElement(Budget, {
95
- key: key,
96
- metricId: `${source}.${key}`,
97
- budget: budget,
98
- CustomLink: CustomLink
99
- });
100
- }))));
101
- };
102
- BudgetInsights.propTypes = {
103
- className: PropTypes.string,
104
- source: PropTypes.string.isRequired,
105
- budgets: PropTypes.object.isRequired,
106
- // eslint-disable-line react/forbid-prop-types
107
- CustomLink: PropTypes.elementType
108
- };
109
- BudgetInsights.defaultProps = {
110
- className: '',
111
- CustomLink: ComponentLink
112
- };
@@ -1,61 +0,0 @@
1
- .groupHeader {
2
- width: 100%;
3
- border: none;
4
- background: none;
5
- cursor: pointer;
6
- color: inherit;
7
- }
8
-
9
- .groupTitle {
10
- width: 100%;
11
- align-items: center;
12
- }
13
-
14
- .groupTitle:hover {
15
- color: var(--color-text-dark);
16
- text-decoration: underline;
17
- }
18
-
19
- .groupTitleToggle {
20
- margin: 0 0 0 auto !important;
21
- }
22
-
23
- .group-danger .groupIcon {
24
- color: var(--color-danger);
25
- }
26
-
27
- .group-warning .groupIcon {
28
- color: var(--color-warning);
29
- }
30
-
31
- .group-success .groupIcon {
32
- color: var(--color-success);
33
- }
34
-
35
- .groupContent {
36
- padding-top: 0px;
37
- background: transparent;
38
- }
39
-
40
- .budget {
41
- display: block;
42
- color: var(--color-text);
43
- text-decoration: none;
44
- }
45
-
46
- .budgetSuccess {
47
- color: var(--color-text-light);
48
- }
49
-
50
- .budgetLabel,
51
- .budgetValue {
52
- color: var(--color-text-dark);
53
- font-weight: 500;
54
- }
55
-
56
- .budget:hover,
57
- .budget:focus,
58
- .budget:active {
59
- color: var(--color-text);
60
- text-decoration: underline;
61
- }
@@ -1,144 +0,0 @@
1
- import _merge from "lodash/merge";
2
- import React from 'react';
3
- import { MemoryRouter } from 'react-router-dom';
4
- import { BudgetInsights } from '.';
5
- const BUDGETS = {
6
- type: 'SUCCESS',
7
- message: {
8
- text: '8 budget checks passed',
9
- md: '**8** budget checks passed'
10
- },
11
- data: {
12
- totalSizeByTypeALL: {
13
- type: 'ERROR',
14
- message: {
15
- text: 'Bundle Size is above the budget',
16
- md: 'Bundle Size is above the budget'
17
- },
18
- data: {
19
- currentValue: 2097917,
20
- budgetValue: 2097152,
21
- failed: true
22
- }
23
- },
24
- totalInitialSizeJS: {
25
- type: 'ERROR',
26
- message: {
27
- text: 'Initial JS is above the budget',
28
- md: 'Initial JS is above the budget'
29
- },
30
- data: {
31
- currentValue: 1265645,
32
- budgetValue: 524288,
33
- failed: true
34
- }
35
- },
36
- totalInitialSizeCSS: {
37
- type: 'SUCCESS',
38
- message: {
39
- text: 'Initial CSS is below the budget',
40
- md: 'Initial CSS is below the budget'
41
- },
42
- data: {
43
- currentValue: 48866,
44
- budgetValue: 51200,
45
- failed: false
46
- }
47
- },
48
- chunkCount: {
49
- type: 'SUCCESS',
50
- message: {
51
- text: 'Chunks is below the budget',
52
- md: 'Chunks is below the budget'
53
- },
54
- data: {
55
- currentValue: 12,
56
- budgetValue: 50,
57
- failed: false
58
- }
59
- },
60
- moduleCount: {
61
- type: 'SUCCESS',
62
- message: {
63
- text: 'Modules is below the budget',
64
- md: 'Modules is below the budget'
65
- },
66
- data: {
67
- currentValue: 1059,
68
- budgetValue: 2000,
69
- failed: false
70
- }
71
- },
72
- duplicatePackagesCount: {
73
- type: 'ERROR',
74
- message: {
75
- text: 'Duplicate packages is above the budget',
76
- md: 'Duplicate packages is above the budget'
77
- },
78
- data: {
79
- currentValue: 13,
80
- budgetValue: 5,
81
- failed: true
82
- }
83
- },
84
- 'sizes.totalSizeByTypeJS': {
85
- type: 'SUCCESS',
86
- message: {
87
- text: 'JS is below the budget',
88
- md: 'JS is below the budget'
89
- },
90
- data: {
91
- currentValue: 1981470,
92
- budgetValue: 2097152,
93
- failed: false
94
- }
95
- },
96
- 'sizes.totalSizeByTypeCSS': {
97
- type: 'SUCCESS',
98
- message: {
99
- text: 'CSS is below the budget',
100
- md: 'CSS is below the budget'
101
- },
102
- data: {
103
- currentValue: 56091,
104
- budgetValue: 20480,
105
- failed: true
106
- }
107
- }
108
- }
109
- };
110
- export default {
111
- title: 'Components/BudgetInsights',
112
- component: BudgetInsights,
113
- decorators: [Story => /*#__PURE__*/React.createElement(MemoryRouter, null, /*#__PURE__*/React.createElement(Story, null))]
114
- };
115
-
116
- const Template = args => /*#__PURE__*/React.createElement(BudgetInsights, args);
117
-
118
- export const Default = Template.bind();
119
- Default.args = {
120
- source: 'webpack',
121
- budgets: BUDGETS
122
- };
123
- export const FailedBudgets = Template.bind();
124
- FailedBudgets.args = {
125
- source: 'webpack',
126
- budgets: _merge({}, BUDGETS, {
127
- type: 'ERROR',
128
- message: {
129
- text: '2/8 budget checks failed',
130
- md: '**2/8** budget checks failed'
131
- }
132
- })
133
- };
134
- export const WarnedBudgets = Template.bind();
135
- WarnedBudgets.args = {
136
- source: 'webpack',
137
- budgets: _merge({}, BUDGETS, {
138
- type: 'WARNING',
139
- message: {
140
- text: '2/8 budget checks warned',
141
- md: '**2/8** budget checks warned'
142
- }
143
- })
144
- };
@@ -1 +0,0 @@
1
- export * from './budget-insights';
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-alert-circle"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check-circle"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path><polyline points="22 4 12 14.01 9 11.01"></polyline></svg>