@bundle-stats/ui 4.22.3 → 4.23.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/app/app.js +3 -0
- package/lib/app/app.js.map +1 -1
- package/lib/app/app.module.css +11 -1
- package/lib/components/delta/delta.js +3 -13
- package/lib/components/delta/delta.js.map +1 -1
- package/lib/components/delta/delta.module.css +13 -12
- package/lib/components/delta/index.js.map +1 -1
- package/lib/components/index.js +3 -1
- package/lib/components/index.js.map +1 -1
- package/lib/components/insight-icon/insight-icon.module.css +6 -6
- package/lib/components/job-name/job-name.js +1 -2
- package/lib/components/job-name/job-name.js.map +1 -1
- package/lib/components/metric-change-legend/index.js +18 -0
- package/lib/components/metric-change-legend/index.js.map +1 -0
- package/lib/components/metric-change-legend/metric-change-legend.js +91 -0
- package/lib/components/metric-change-legend/metric-change-legend.js.map +1 -0
- package/lib/components/metric-change-legend/metric-change-legend.module.css +69 -0
- package/lib/components/metric-run-info/metric-run-info.js +30 -7
- package/lib/components/metric-run-info/metric-run-info.js.map +1 -1
- package/lib/components/metrics-display-selector/metrics-display-selector.js +7 -9
- package/lib/components/metrics-display-selector/metrics-display-selector.js.map +1 -1
- package/lib/components/metrics-display-selector/metrics-display-selector.module.css +0 -25
- package/lib/components/metrics-table-header/metrics-table-header.js +6 -6
- package/lib/components/metrics-table-header/metrics-table-header.js.map +1 -1
- package/lib/components/metrics-table-header/metrics-table-header.module.css +8 -12
- package/lib/components/metrics-table-options/metrics-table-options.js +1 -1
- package/lib/components/metrics-table-options/metrics-table-options.js.map +1 -1
- package/lib/components/metrics-table-title/metrics-table-title.js +1 -1
- package/lib/components/metrics-table-title/metrics-table-title.js.map +1 -1
- package/lib/components/run-info/run-info.js +26 -14
- package/lib/components/run-info/run-info.js.map +1 -1
- package/lib/components/run-info/run-info.module.css +35 -26
- package/lib/components/summary/summary.js +9 -10
- package/lib/components/summary/summary.js.map +1 -1
- package/lib/components/summary/summary.module.css +60 -10
- package/lib/constants.js +13 -1
- package/lib/constants.js.map +1 -1
- package/lib/css/variables.css +71 -58
- package/lib/ui/dialog/dialog.js +4 -2
- package/lib/ui/dialog/dialog.js.map +1 -1
- package/lib/ui/dialog/dialog.module.css +22 -0
- package/lib/ui/dropdown/dropdown.js +4 -3
- package/lib/ui/dropdown/dropdown.js.map +1 -1
- package/lib/ui/dropdown/dropdown.module.css +11 -0
- package/lib/ui/hover-card/hover-card.js +1 -1
- package/lib/ui/hover-card/hover-card.js.map +1 -1
- package/lib/ui/hover-card/hover-card.module.css +14 -0
- package/lib/ui/table/table.module.css +0 -1
- package/lib/ui/tooltip/tooltip.js +1 -1
- package/lib/ui/tooltip/tooltip.js.map +1 -1
- package/lib/ui/tooltip/tooltip.module.css +11 -0
- package/lib-esm/app/app.js +4 -1
- package/lib-esm/app/app.js.map +1 -1
- package/lib-esm/app/app.module.css +11 -1
- package/lib-esm/components/delta/delta.js +3 -13
- package/lib-esm/components/delta/delta.js.map +1 -1
- package/lib-esm/components/delta/delta.module.css +13 -12
- package/lib-esm/components/delta/index.js.map +1 -1
- package/lib-esm/components/index.js +1 -0
- package/lib-esm/components/index.js.map +1 -1
- package/lib-esm/components/insight-icon/insight-icon.module.css +6 -6
- package/lib-esm/components/job-name/job-name.js +1 -2
- package/lib-esm/components/job-name/job-name.js.map +1 -1
- package/lib-esm/components/metric-change-legend/index.js +2 -0
- package/lib-esm/components/metric-change-legend/index.js.map +1 -0
- package/lib-esm/components/metric-change-legend/metric-change-legend.js +84 -0
- package/lib-esm/components/metric-change-legend/metric-change-legend.js.map +1 -0
- package/lib-esm/components/metric-change-legend/metric-change-legend.module.css +69 -0
- package/lib-esm/components/metric-run-info/metric-run-info.js +31 -8
- package/lib-esm/components/metric-run-info/metric-run-info.js.map +1 -1
- package/lib-esm/components/metrics-display-selector/metrics-display-selector.js +7 -9
- package/lib-esm/components/metrics-display-selector/metrics-display-selector.js.map +1 -1
- package/lib-esm/components/metrics-display-selector/metrics-display-selector.module.css +0 -25
- package/lib-esm/components/metrics-table-header/metrics-table-header.js +6 -6
- package/lib-esm/components/metrics-table-header/metrics-table-header.js.map +1 -1
- package/lib-esm/components/metrics-table-header/metrics-table-header.module.css +8 -12
- package/lib-esm/components/metrics-table-options/metrics-table-options.js +1 -1
- package/lib-esm/components/metrics-table-options/metrics-table-options.js.map +1 -1
- package/lib-esm/components/metrics-table-title/metrics-table-title.js +1 -1
- package/lib-esm/components/metrics-table-title/metrics-table-title.js.map +1 -1
- package/lib-esm/components/run-info/run-info.js +26 -14
- package/lib-esm/components/run-info/run-info.js.map +1 -1
- package/lib-esm/components/run-info/run-info.module.css +35 -26
- package/lib-esm/components/summary/summary.js +10 -11
- package/lib-esm/components/summary/summary.js.map +1 -1
- package/lib-esm/components/summary/summary.module.css +60 -10
- package/lib-esm/constants.js +12 -0
- package/lib-esm/constants.js.map +1 -1
- package/lib-esm/css/variables.css +71 -58
- package/lib-esm/ui/dialog/dialog.js +4 -2
- package/lib-esm/ui/dialog/dialog.js.map +1 -1
- package/lib-esm/ui/dialog/dialog.module.css +22 -0
- package/lib-esm/ui/dropdown/dropdown.js +4 -3
- package/lib-esm/ui/dropdown/dropdown.js.map +1 -1
- package/lib-esm/ui/dropdown/dropdown.module.css +11 -0
- package/lib-esm/ui/hover-card/hover-card.js +1 -1
- package/lib-esm/ui/hover-card/hover-card.js.map +1 -1
- package/lib-esm/ui/hover-card/hover-card.module.css +14 -0
- package/lib-esm/ui/table/table.module.css +0 -1
- package/lib-esm/ui/tooltip/tooltip.js +1 -1
- package/lib-esm/ui/tooltip/tooltip.js.map +1 -1
- package/lib-esm/ui/tooltip/tooltip.module.css +11 -0
- package/package.json +12 -12
- package/src/app/app.jsx +6 -1
- package/src/app/app.module.css +11 -1
- package/src/components/delta/delta.module.css +13 -12
- package/src/components/delta/delta.tsx +32 -0
- package/src/components/index.ts +3 -0
- package/src/components/insight-icon/insight-icon.module.css +6 -6
- package/src/components/job-name/job-name.jsx +2 -3
- package/src/components/metric-change-legend/index.ts +1 -0
- package/src/components/metric-change-legend/metric-change-legend.module.css +69 -0
- package/src/components/metric-change-legend/metric-change-legend.stories.tsx +13 -0
- package/src/components/metric-change-legend/metric-change-legend.tsx +148 -0
- package/src/components/metric-run-info/metric-run-info.tsx +41 -17
- package/src/components/metrics-display-selector/metrics-display-selector.module.css +0 -25
- package/src/components/metrics-display-selector/metrics-display-selector.tsx +25 -37
- package/src/components/metrics-table-header/metrics-table-header.module.css +8 -12
- package/src/components/metrics-table-header/metrics-table-header.tsx +5 -6
- package/src/components/metrics-table-options/metrics-table-options.tsx +1 -1
- package/src/components/metrics-table-title/metrics-table-title.jsx +1 -1
- package/src/components/run-info/run-info.module.css +35 -26
- package/src/components/run-info/run-info.stories.tsx +16 -10
- package/src/components/run-info/run-info.tsx +132 -73
- package/src/components/summary/summary.module.css +60 -10
- package/src/components/summary/summary.tsx +47 -50
- package/src/constants.ts +13 -0
- package/src/css/variables.css +71 -58
- package/src/ui/dialog/dialog.module.css +22 -0
- package/src/ui/dialog/dialog.tsx +9 -2
- package/src/ui/dropdown/dropdown.module.css +11 -0
- package/src/ui/dropdown/dropdown.tsx +5 -1
- package/src/ui/hover-card/hover-card.module.css +14 -0
- package/src/ui/hover-card/hover-card.tsx +1 -1
- package/src/ui/table/table.module.css +0 -1
- package/src/ui/tooltip/tooltip.module.css +11 -0
- package/src/ui/tooltip/tooltip.tsx +1 -1
- package/types/components/delta/delta.d.ts +7 -21
- package/types/components/delta/index.d.ts +1 -1
- package/types/components/index.d.ts +3 -0
- package/types/components/metric-change-legend/index.d.ts +1 -0
- package/types/components/metric-change-legend/metric-change-legend.d.ts +4 -0
- package/types/components/metric-run-info/metric-run-info.d.ts +2 -6
- package/types/components/run-info/run-info.d.ts +16 -7
- package/types/constants.d.ts +12 -0
- package/types/ui/dialog/dialog.d.ts +3 -2
- package/types/ui/dropdown/dropdown.d.ts +1 -0
- package/src/components/delta/delta.jsx +0 -22
- /package/src/components/delta/{index.js → index.ts} +0 -0
|
@@ -90,44 +90,32 @@ export const MetricsDisplaySelector = (
|
|
|
90
90
|
);
|
|
91
91
|
|
|
92
92
|
return (
|
|
93
|
-
<
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
glyph={Icon.ICONS.CHEVRON_DOWN}
|
|
104
|
-
placement="bottom-end"
|
|
105
|
-
shift={-1}
|
|
106
|
-
className={css.dropdownGroupAnchor}
|
|
107
|
-
>
|
|
108
|
-
{displayGroupsData.map((displayGroupData) => {
|
|
109
|
-
const isGroupActive = isActive && displayGroupData.value === groupBy;
|
|
93
|
+
<Dropdown
|
|
94
|
+
label={displayProps.label}
|
|
95
|
+
glyph={displayProps.glyph}
|
|
96
|
+
placement="bottom-end"
|
|
97
|
+
shift={-1}
|
|
98
|
+
className={itemClassName}
|
|
99
|
+
key={displayType}
|
|
100
|
+
>
|
|
101
|
+
{displayGroupsData.map((displayGroupData) => {
|
|
102
|
+
const isGroupActive = isActive && displayGroupData.value === groupBy;
|
|
110
103
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
</DropdownItem>
|
|
127
|
-
);
|
|
128
|
-
})}
|
|
129
|
-
</Dropdown>
|
|
130
|
-
</FlexStack>
|
|
104
|
+
return (
|
|
105
|
+
<DropdownItem
|
|
106
|
+
onClick={() => onSelect(displayType, displayGroupData.value)}
|
|
107
|
+
isActive={isGroupActive}
|
|
108
|
+
className={cx(css.dropdownItem, isGroupActive && css.dropdownItemActive)}
|
|
109
|
+
key={displayGroupData.value}
|
|
110
|
+
>
|
|
111
|
+
<FlexStack space="xxxsmall" alignItems="center">
|
|
112
|
+
<Icon glyph={Icon.ICONS.CHECK} size="small" className={css.dropdownItemIcon} />
|
|
113
|
+
<span>{displayGroupData.label}</span>
|
|
114
|
+
</FlexStack>
|
|
115
|
+
</DropdownItem>
|
|
116
|
+
);
|
|
117
|
+
})}
|
|
118
|
+
</Dropdown>
|
|
131
119
|
);
|
|
132
120
|
})}
|
|
133
121
|
</ControlGroup>
|
|
@@ -4,23 +4,23 @@
|
|
|
4
4
|
padding-bottom: var(--space-xxsmall);
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
.root .
|
|
7
|
+
.root .colMetric {
|
|
8
8
|
width: 55%;
|
|
9
9
|
vertical-align: middle;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
.root .
|
|
12
|
+
.root .colJob {
|
|
13
13
|
padding-top: var(--space-xxsmall);
|
|
14
14
|
text-align: right;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
.root .
|
|
17
|
+
.root .colValue {
|
|
18
18
|
text-align: right;
|
|
19
19
|
vertical-align: baseline;
|
|
20
20
|
width: 15%;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
.root .
|
|
23
|
+
.root .colDelta {
|
|
24
24
|
text-align: right;
|
|
25
25
|
font-size: var(--size-xsmall);
|
|
26
26
|
vertical-align: baseline;
|
|
@@ -28,21 +28,17 @@
|
|
|
28
28
|
color: pink;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.root .
|
|
31
|
+
.root .colDeltaPercentage {
|
|
32
32
|
width: 5%;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
.jobName {
|
|
36
|
-
white-space: nowrap;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
35
|
/* columns overrides for showHeaderSum */
|
|
40
|
-
.showHeaderSum .
|
|
36
|
+
.showHeaderSum .colJob {
|
|
41
37
|
border-bottom: 0;
|
|
42
|
-
padding-bottom:
|
|
38
|
+
padding-bottom: var(--space-xxxsmall);
|
|
43
39
|
}
|
|
44
40
|
|
|
45
|
-
.showHeaderSum .
|
|
41
|
+
.showHeaderSum .colSum {
|
|
46
42
|
padding-top: 0;
|
|
47
43
|
font-size: var(--size-small);
|
|
48
44
|
vertical-align: middle;
|
|
@@ -34,11 +34,10 @@ const JobColumn = ({ job, isBaseline }: JobColumnProps) => {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
return (
|
|
37
|
-
<Table.Th className={cx(css.col, css.
|
|
37
|
+
<Table.Th className={cx(css.col, css.colJob)} colSpan={colSpan}>
|
|
38
38
|
<JobName
|
|
39
39
|
title={isBaseline ? I18N.BASELINE_TITLE : I18N.CURRENT_TITLE}
|
|
40
40
|
internalBuildNumber={internalBuildNumber}
|
|
41
|
-
className={css.jobName}
|
|
42
41
|
>
|
|
43
42
|
{label}
|
|
44
43
|
</JobName>
|
|
@@ -65,7 +64,7 @@ const SumColumn = ({ rows, isBaseline, runIndex, updateSort, sort }: ColumnSumPr
|
|
|
65
64
|
|
|
66
65
|
return (
|
|
67
66
|
<>
|
|
68
|
-
<Table.Th className={cx(css.col, css.
|
|
67
|
+
<Table.Th className={cx(css.col, css.colValue, css.colSum)}>
|
|
69
68
|
<SortButton
|
|
70
69
|
fieldPath={fieldPath}
|
|
71
70
|
fieldName="value"
|
|
@@ -78,7 +77,7 @@ const SumColumn = ({ rows, isBaseline, runIndex, updateSort, sort }: ColumnSumPr
|
|
|
78
77
|
</Table.Th>
|
|
79
78
|
{!isBaseline && (
|
|
80
79
|
<>
|
|
81
|
-
<Table.Th className={cx(css.col, css.
|
|
80
|
+
<Table.Th className={cx(css.col, css.colDelta, css.colSum)}>
|
|
82
81
|
<SortButton
|
|
83
82
|
fieldPath={fieldPath}
|
|
84
83
|
fieldName="delta"
|
|
@@ -91,7 +90,7 @@ const SumColumn = ({ rows, isBaseline, runIndex, updateSort, sort }: ColumnSumPr
|
|
|
91
90
|
)}
|
|
92
91
|
</SortButton>
|
|
93
92
|
</Table.Th>
|
|
94
|
-
<Table.Th className={cx(css.col, css.
|
|
93
|
+
<Table.Th className={cx(css.col, css.colDelta, css.colDeltaPercentage, css.colSum)}>
|
|
95
94
|
<SortButton
|
|
96
95
|
fieldPath={fieldPath}
|
|
97
96
|
fieldName="deltaPercentage"
|
|
@@ -147,7 +146,7 @@ export const MetricsTableHeader = (
|
|
|
147
146
|
return (
|
|
148
147
|
<Table.THead className={rootClassName}>
|
|
149
148
|
<Table.Tr>
|
|
150
|
-
<Table.Th className={cx(css.col, css.
|
|
149
|
+
<Table.Th className={cx(css.col, css.colMetric)} rowSpan={showSum ? 2 : 1}>
|
|
151
150
|
{metricTitle || ' '}
|
|
152
151
|
</Table.Th>
|
|
153
152
|
{jobs.map((job, runIndex) => (
|
|
@@ -15,7 +15,7 @@ export const MetricsTableOptions = (props: MetricsTableOptionsProps) => {
|
|
|
15
15
|
const { onViewAllClick, onResetClick, onExportClick, ...restProps } = props;
|
|
16
16
|
|
|
17
17
|
return (
|
|
18
|
-
<Dropdown glyph="more-vertical" placement="bottom-end" {...restProps}>
|
|
18
|
+
<Dropdown glyph="more-vertical" placement="bottom-end" showChevron={false} {...restProps}>
|
|
19
19
|
<div className={css.group}>
|
|
20
20
|
{onResetClick && <DropdownItem onClick={onResetClick}>{I18N.RESET_FILTERS}</DropdownItem>}
|
|
21
21
|
{onViewAllClick && <DropdownItem onClick={onViewAllClick}>{I18N.VIEW_ALL}</DropdownItem>}
|
|
@@ -15,7 +15,7 @@ export const MetricsTableTitle = (props) => {
|
|
|
15
15
|
const rootClassName = cx(css.root, className);
|
|
16
16
|
|
|
17
17
|
return (
|
|
18
|
-
<Stack space="
|
|
18
|
+
<Stack space="xxxsmall" className={rootClassName}>
|
|
19
19
|
<FlexStack space="xxxsmall" alignItems="center" as="h3" className={css.title}>
|
|
20
20
|
<span>{title}</span>
|
|
21
21
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.title {
|
|
2
|
-
color: var(--color-text-
|
|
2
|
+
color: var(--color-text-light);
|
|
3
3
|
font-weight: bold;
|
|
4
4
|
font-size: var(--size-xsmall);
|
|
5
5
|
text-transform: uppercase;
|
|
@@ -16,14 +16,11 @@
|
|
|
16
16
|
|
|
17
17
|
.titleIcon {
|
|
18
18
|
flex: 0 0 var(--space-small);
|
|
19
|
+
/* compensate for the button icon spacing */
|
|
19
20
|
margin-top: -3px !important;
|
|
20
21
|
margin-bottom: -3px !important;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
.title + .info {
|
|
24
|
-
margin-top: var(--space-xxsmall);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
24
|
.currentMetric {
|
|
28
25
|
color: var(--color-heading);
|
|
29
26
|
white-space: nowrap;
|
|
@@ -32,33 +29,32 @@
|
|
|
32
29
|
height: var(--line-height-number);
|
|
33
30
|
}
|
|
34
31
|
|
|
35
|
-
.delta {
|
|
36
|
-
font-weight: bold;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.deltaValue + .deltaValue::before {
|
|
40
|
-
margin-left: calc(var(--space-xxxsmall) / 2);
|
|
41
|
-
margin-right: calc(var(--space-xxxsmall) / 2);
|
|
42
|
-
content: '/';
|
|
43
|
-
color: var(--color-text-ultra-light);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
32
|
.baselineMetric {
|
|
47
33
|
color: var(--color-text-ultra-light);
|
|
48
34
|
font-size: var(--size-small);
|
|
35
|
+
font-family: var(--font-family-fixed);
|
|
36
|
+
font-weight: normal;
|
|
49
37
|
line-height: var(--line-height-number);
|
|
50
38
|
height: var(--line-height-number);
|
|
51
39
|
}
|
|
52
40
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
max-width: 8em;
|
|
41
|
+
.baselineMetricValue {
|
|
42
|
+
color: var(--color-text-light);
|
|
43
|
+
line-height: inherit;
|
|
57
44
|
}
|
|
58
45
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
46
|
+
|
|
47
|
+
.delta {
|
|
48
|
+
font-weight: bold;
|
|
49
|
+
font-size: var(--size-small);
|
|
50
|
+
line-height: var(--line-height-number);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.deltaValue + .deltaValue::before {
|
|
54
|
+
margin-left: var(--space-xxxsmall);
|
|
55
|
+
margin-right: var(--space-xxxsmall);
|
|
56
|
+
content: '/';
|
|
57
|
+
color: var(--color-outline-dark);
|
|
62
58
|
}
|
|
63
59
|
|
|
64
60
|
/* Hover state */
|
|
@@ -82,15 +78,28 @@
|
|
|
82
78
|
visibility 0s;
|
|
83
79
|
}
|
|
84
80
|
|
|
85
|
-
/*
|
|
86
|
-
.currentMetric {
|
|
87
|
-
|
|
81
|
+
/* Loading state */
|
|
82
|
+
.loading .currentMetric {
|
|
83
|
+
max-width: 6em;
|
|
88
84
|
}
|
|
89
85
|
|
|
86
|
+
.loading .baselineMetric {
|
|
87
|
+
max-width: 6em;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.loading .delta {
|
|
91
|
+
max-width: 12em;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* Size variation */
|
|
90
95
|
.small .currentMetric {
|
|
91
96
|
font-size: var(--size-medium);
|
|
92
97
|
}
|
|
93
98
|
|
|
99
|
+
.currentMetric {
|
|
100
|
+
font-size: var(--size-xxlarge);
|
|
101
|
+
}
|
|
102
|
+
|
|
94
103
|
.large .currentMetric {
|
|
95
104
|
font-size: var(--size-xxxlarge);
|
|
96
105
|
}
|
|
@@ -8,12 +8,24 @@ const meta = {
|
|
|
8
8
|
args: {
|
|
9
9
|
id: 'webpack.totalSizeByTypeALL',
|
|
10
10
|
size: 'medium',
|
|
11
|
+
loading: false,
|
|
12
|
+
showBaseline: true,
|
|
13
|
+
showDelta: true,
|
|
11
14
|
},
|
|
12
15
|
argTypes: {
|
|
13
16
|
size: {
|
|
14
17
|
options: ['small', 'medium', 'large', 'xlarge'],
|
|
15
18
|
control: { type: 'select' },
|
|
16
19
|
},
|
|
20
|
+
loading: {
|
|
21
|
+
control: { type: 'boolean' },
|
|
22
|
+
},
|
|
23
|
+
showBaseline: {
|
|
24
|
+
control: { type: 'boolean' },
|
|
25
|
+
},
|
|
26
|
+
showDelta: {
|
|
27
|
+
control: { type: 'boolean' },
|
|
28
|
+
},
|
|
17
29
|
},
|
|
18
30
|
} satisfies Meta<typeof RunInfo>;
|
|
19
31
|
|
|
@@ -24,20 +36,14 @@ type Story = StoryObj<typeof meta>;
|
|
|
24
36
|
export const Default: Story = {
|
|
25
37
|
args: {
|
|
26
38
|
title: 'Bundle Size',
|
|
27
|
-
current: '
|
|
28
|
-
baseline: '
|
|
29
|
-
delta: '+
|
|
39
|
+
current: '678.91MiB',
|
|
40
|
+
baseline: '123.45MiB',
|
|
41
|
+
delta: '+555.46MiB',
|
|
42
|
+
deltaPercentage: '+549.94%',
|
|
30
43
|
deltaType: 'HIGH_NEGATIVE',
|
|
31
44
|
},
|
|
32
45
|
};
|
|
33
46
|
|
|
34
|
-
export const DeltaPercentage: Story = {
|
|
35
|
-
args: {
|
|
36
|
-
...Default.args,
|
|
37
|
-
deltaPercentage: '+20KiB',
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
|
|
41
47
|
export const SizeLarge: Story = {
|
|
42
48
|
args: {
|
|
43
49
|
...Default.args,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { type ReactNode, useMemo } from 'react';
|
|
2
2
|
import cx from 'classnames';
|
|
3
|
+
import type { MetricRunInfoDeltaType } from '@bundle-stats/utils';
|
|
3
4
|
|
|
4
5
|
import { Icon } from '../../ui/icon';
|
|
5
6
|
import { HoverCard } from '../../ui/hover-card';
|
|
@@ -24,23 +25,125 @@ const getMetricParams = (value: string): [string, string?] => {
|
|
|
24
25
|
return [matches[1], matches[2]];
|
|
25
26
|
};
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
type RunInfoTitleProps = {
|
|
29
|
+
className?: string;
|
|
28
30
|
title?: ReactNode;
|
|
29
31
|
titleHoverCard?: ReactNode;
|
|
30
32
|
titleTooltip?: ReactNode;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const RunInfoTitle = ({ className, title, titleHoverCard, titleTooltip }: RunInfoTitleProps) => (
|
|
36
|
+
<FlexStack space="xxxsmall" alignItems="center" as="h3" className={cx(css.title, className)}>
|
|
37
|
+
<span className={css.titleText}>{title}</span>
|
|
38
|
+
{titleHoverCard && (
|
|
39
|
+
<HoverCard
|
|
40
|
+
label={<Icon glyph={Icon.ICONS.HELP} />}
|
|
41
|
+
className={cx(css.titleIcon, css.titleHoverCardIcon)}
|
|
42
|
+
>
|
|
43
|
+
{titleHoverCard}
|
|
44
|
+
</HoverCard>
|
|
45
|
+
)}
|
|
46
|
+
{titleTooltip && (
|
|
47
|
+
<Tooltip title={titleTooltip} className={cx(css.titleIcon, css.titleTooltipIcon)}>
|
|
48
|
+
<Icon glyph={Icon.ICONS.HELP} />
|
|
49
|
+
</Tooltip>
|
|
50
|
+
)}
|
|
51
|
+
</FlexStack>
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
type RunInfoContentProps = {
|
|
55
|
+
className?: string;
|
|
56
|
+
loading?: boolean;
|
|
31
57
|
current?: ReactNode;
|
|
58
|
+
enhance?: boolean;
|
|
32
59
|
baseline?: string;
|
|
33
60
|
delta?: string;
|
|
34
61
|
deltaPercentage?: string;
|
|
35
|
-
deltaType?:
|
|
62
|
+
deltaType?: MetricRunInfoDeltaType;
|
|
63
|
+
showBaseline?: boolean;
|
|
64
|
+
showDelta?: boolean;
|
|
65
|
+
};
|
|
36
66
|
|
|
37
|
-
|
|
38
|
-
|
|
67
|
+
const RunInfoContent = ({
|
|
68
|
+
className,
|
|
69
|
+
loading = false,
|
|
70
|
+
current = '',
|
|
71
|
+
enhance = false,
|
|
72
|
+
baseline = '',
|
|
73
|
+
delta = '',
|
|
74
|
+
deltaPercentage = '',
|
|
75
|
+
deltaType = 'NO_CHANGE',
|
|
76
|
+
showBaseline = true,
|
|
77
|
+
showDelta = true,
|
|
78
|
+
}: RunInfoContentProps) => {
|
|
79
|
+
const currentValueParams: [ReactNode, string?] = useMemo(() => {
|
|
80
|
+
if (!enhance || typeof current !== 'string') {
|
|
81
|
+
return [current];
|
|
82
|
+
}
|
|
39
83
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
84
|
+
return getMetricParams(current);
|
|
85
|
+
}, [current, enhance]);
|
|
86
|
+
|
|
87
|
+
const contentClassName = cx(css.content, className);
|
|
88
|
+
|
|
89
|
+
if (loading) {
|
|
90
|
+
return (
|
|
91
|
+
<Stack space="xxxsmall" className={contentClassName}>
|
|
92
|
+
<Skeleton className={css.currentMetric} />
|
|
93
|
+
{showBaseline && <Skeleton className={css.baselineMetric} />}
|
|
94
|
+
</Stack>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<Stack space="xxxsmall" className={contentClassName}>
|
|
100
|
+
<Metric
|
|
101
|
+
value={currentValueParams[0]}
|
|
102
|
+
unit={currentValueParams[1]}
|
|
103
|
+
inline
|
|
104
|
+
className={css.currentMetric}
|
|
105
|
+
>
|
|
106
|
+
{showDelta && (
|
|
107
|
+
<div className={css.delta}>
|
|
108
|
+
{deltaPercentage && (
|
|
109
|
+
<Delta
|
|
110
|
+
displayValue={deltaPercentage}
|
|
111
|
+
deltaType={deltaType}
|
|
112
|
+
className={css.deltaValue}
|
|
113
|
+
/>
|
|
114
|
+
)}
|
|
115
|
+
{delta && (
|
|
116
|
+
<Delta displayValue={delta} deltaType={deltaType} className={css.deltaValue} />
|
|
117
|
+
)}
|
|
118
|
+
</div>
|
|
119
|
+
)}
|
|
120
|
+
</Metric>
|
|
121
|
+
{showBaseline && (
|
|
122
|
+
<FlexStack alignItems="center" space="xxxsmall" className={css.baselineMetric}>
|
|
123
|
+
<span className={css.baselineMetricLabel}>vs</span>
|
|
124
|
+
<Metric value={baseline} inline className={css.baselineMetricValue} />
|
|
125
|
+
</FlexStack>
|
|
126
|
+
)}
|
|
127
|
+
</Stack>
|
|
128
|
+
);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export type RunInfoProps = Pick<RunInfoTitleProps, 'title' | 'titleHoverCard' | 'titleTooltip'> &
|
|
132
|
+
Pick<
|
|
133
|
+
RunInfoContentProps,
|
|
134
|
+
| 'current'
|
|
135
|
+
| 'baseline'
|
|
136
|
+
| 'delta'
|
|
137
|
+
| 'deltaPercentage'
|
|
138
|
+
| 'deltaType'
|
|
139
|
+
| 'showBaseline'
|
|
140
|
+
| 'showDelta'
|
|
141
|
+
| 'loading'
|
|
142
|
+
| 'enhance'
|
|
143
|
+
> & {
|
|
144
|
+
as?: React.ElementType;
|
|
145
|
+
size?: 'small' | 'medium' | 'large' | 'xlarge';
|
|
146
|
+
};
|
|
44
147
|
|
|
45
148
|
export const RunInfo = ({
|
|
46
149
|
className = '',
|
|
@@ -51,81 +154,37 @@ export const RunInfo = ({
|
|
|
51
154
|
baseline = '',
|
|
52
155
|
delta = '',
|
|
53
156
|
deltaPercentage = '',
|
|
54
|
-
deltaType = '',
|
|
157
|
+
deltaType = 'NO_CHANGE',
|
|
55
158
|
as: Component = 'div',
|
|
56
159
|
size = 'medium',
|
|
57
160
|
showBaseline = true,
|
|
161
|
+
showDelta = true,
|
|
58
162
|
loading = false,
|
|
59
163
|
enhance = false,
|
|
164
|
+
children,
|
|
60
165
|
...restProps
|
|
61
166
|
}: RunInfoProps & Omit<React.ComponentProps<'div'>, 'title'>) => {
|
|
62
|
-
const rootClassName = cx(
|
|
63
|
-
css.root,
|
|
64
|
-
className,
|
|
65
|
-
css[size],
|
|
66
|
-
(delta || deltaPercentage) && css.showDelta,
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
const currentValueParams: [ReactNode, string?] = useMemo(() => {
|
|
70
|
-
if (!enhance || typeof current !== 'string') {
|
|
71
|
-
return [current];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return getMetricParams(current);
|
|
75
|
-
}, [current, enhance]);
|
|
167
|
+
const rootClassName = cx(css.root, loading && css.loading, css[size], className);
|
|
76
168
|
|
|
77
169
|
return (
|
|
78
170
|
<Component className={rootClassName} {...restProps}>
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
{
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
)}
|
|
97
|
-
|
|
98
|
-
{!loading ? (
|
|
99
|
-
<Stack space="xxxsmall" className={css.info}>
|
|
100
|
-
<Metric
|
|
101
|
-
value={currentValueParams[0]}
|
|
102
|
-
unit={currentValueParams[1]}
|
|
103
|
-
inline
|
|
104
|
-
className={css.currentMetric}
|
|
105
|
-
>
|
|
106
|
-
{(delta || deltaPercentage) && (
|
|
107
|
-
<span className={css.delta}>
|
|
108
|
-
{deltaPercentage && (
|
|
109
|
-
<Delta
|
|
110
|
-
displayValue={deltaPercentage}
|
|
111
|
-
deltaType={deltaType}
|
|
112
|
-
className={css.deltaValue}
|
|
113
|
-
/>
|
|
114
|
-
)}
|
|
115
|
-
{delta && (
|
|
116
|
-
<Delta displayValue={delta} deltaType={deltaType} className={css.deltaValue} />
|
|
117
|
-
)}
|
|
118
|
-
</span>
|
|
119
|
-
)}
|
|
120
|
-
</Metric>
|
|
121
|
-
{showBaseline && <Metric className={css.baselineMetric} value={baseline} />}
|
|
122
|
-
</Stack>
|
|
123
|
-
) : (
|
|
124
|
-
<Stack space="xxxsmall" className={css.info}>
|
|
125
|
-
<Skeleton className={cx(css.currentMetric, css.loading)} />
|
|
126
|
-
{showBaseline && <Skeleton as="p" className={cx(css.baselineMetric, css.loading)} />}
|
|
127
|
-
</Stack>
|
|
128
|
-
)}
|
|
171
|
+
<Stack space="xsmall">
|
|
172
|
+
{title && (
|
|
173
|
+
<RunInfoTitle title={title} titleHoverCard={titleHoverCard} titleTooltip={titleTooltip} />
|
|
174
|
+
)}
|
|
175
|
+
<RunInfoContent
|
|
176
|
+
loading={loading}
|
|
177
|
+
current={current}
|
|
178
|
+
enhance={enhance}
|
|
179
|
+
baseline={baseline}
|
|
180
|
+
delta={delta}
|
|
181
|
+
deltaPercentage={deltaPercentage}
|
|
182
|
+
deltaType={deltaType}
|
|
183
|
+
showBaseline={showBaseline}
|
|
184
|
+
showDelta={showDelta}
|
|
185
|
+
/>
|
|
186
|
+
{children}
|
|
187
|
+
</Stack>
|
|
129
188
|
</Component>
|
|
130
189
|
);
|
|
131
190
|
};
|
|
@@ -3,29 +3,79 @@
|
|
|
3
3
|
width: 100%;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
.
|
|
6
|
+
.row {
|
|
7
7
|
width: 100%;
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: stretch;
|
|
10
|
+
flex-wrap: wrap;
|
|
11
|
+
gap: var(--space-small);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.rowGroup {
|
|
15
|
+
flex: 1 1 auto;
|
|
8
16
|
}
|
|
9
17
|
|
|
10
|
-
.
|
|
18
|
+
.rowGroupTitle {
|
|
19
|
+
position: absolute;
|
|
20
|
+
font-size: 0;
|
|
21
|
+
width: 0;
|
|
22
|
+
left: -99999px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.row + .row {
|
|
11
26
|
margin-top: var(--summary-gap);
|
|
12
27
|
}
|
|
13
28
|
|
|
14
29
|
.items {
|
|
15
30
|
display: flex;
|
|
31
|
+
align-items: stretch;
|
|
16
32
|
flex-wrap: wrap;
|
|
17
|
-
|
|
18
|
-
margin-top: calc(0px - var(--summary-gap));
|
|
19
|
-
margin-left: calc(0px - var(--summary-gap));
|
|
33
|
+
gap: var(--space-medium);
|
|
20
34
|
}
|
|
21
35
|
|
|
22
36
|
.item {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
min-width: 12em;
|
|
37
|
+
flex: 1 1 10%; /* force equal sizes */
|
|
38
|
+
min-width: 8em;
|
|
26
39
|
text-decoration: none;
|
|
40
|
+
position: relative;
|
|
41
|
+
z-index: 0;
|
|
27
42
|
}
|
|
28
43
|
|
|
29
|
-
.
|
|
30
|
-
|
|
44
|
+
.item::before {
|
|
45
|
+
content: "";
|
|
46
|
+
border-radius: var(--radius-medium);
|
|
47
|
+
background: var(--color-highlight);
|
|
48
|
+
display: block;
|
|
49
|
+
position: absolute;
|
|
50
|
+
z-index: -1;
|
|
51
|
+
top: calc(0px - var(--space-xsmall));
|
|
52
|
+
right: calc(0px - var(--space-xsmall));
|
|
53
|
+
bottom: calc(0px - var(--space-xsmall));
|
|
54
|
+
left: calc(0px - var(--space-xsmall));
|
|
55
|
+
opacity: 0;
|
|
56
|
+
transition: var(--transition-out);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.item:hover::before {
|
|
60
|
+
opacity: 1;
|
|
61
|
+
transition: var(--transition-in);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.item + .item::after {
|
|
65
|
+
content: "";
|
|
66
|
+
border-radius: var(--radius-medium);
|
|
67
|
+
background: var(--color-outline);
|
|
68
|
+
display: block;
|
|
69
|
+
width: 1px;
|
|
70
|
+
position: absolute;
|
|
71
|
+
left: calc(0px - var(--space-xsmall));
|
|
72
|
+
top: var(--space-xxsmall);
|
|
73
|
+
bottom: var(--space-xxsmall);
|
|
74
|
+
opacity: 1;
|
|
75
|
+
transition: var(--transition-out);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.item:hover::after, .item:hover + .item::after {
|
|
79
|
+
opacity: 0;
|
|
80
|
+
transition: var(--transition-in);
|
|
31
81
|
}
|