@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.
Files changed (149) hide show
  1. package/lib/app/app.js +3 -0
  2. package/lib/app/app.js.map +1 -1
  3. package/lib/app/app.module.css +11 -1
  4. package/lib/components/delta/delta.js +3 -13
  5. package/lib/components/delta/delta.js.map +1 -1
  6. package/lib/components/delta/delta.module.css +13 -12
  7. package/lib/components/delta/index.js.map +1 -1
  8. package/lib/components/index.js +3 -1
  9. package/lib/components/index.js.map +1 -1
  10. package/lib/components/insight-icon/insight-icon.module.css +6 -6
  11. package/lib/components/job-name/job-name.js +1 -2
  12. package/lib/components/job-name/job-name.js.map +1 -1
  13. package/lib/components/metric-change-legend/index.js +18 -0
  14. package/lib/components/metric-change-legend/index.js.map +1 -0
  15. package/lib/components/metric-change-legend/metric-change-legend.js +91 -0
  16. package/lib/components/metric-change-legend/metric-change-legend.js.map +1 -0
  17. package/lib/components/metric-change-legend/metric-change-legend.module.css +69 -0
  18. package/lib/components/metric-run-info/metric-run-info.js +30 -7
  19. package/lib/components/metric-run-info/metric-run-info.js.map +1 -1
  20. package/lib/components/metrics-display-selector/metrics-display-selector.js +7 -9
  21. package/lib/components/metrics-display-selector/metrics-display-selector.js.map +1 -1
  22. package/lib/components/metrics-display-selector/metrics-display-selector.module.css +0 -25
  23. package/lib/components/metrics-table-header/metrics-table-header.js +6 -6
  24. package/lib/components/metrics-table-header/metrics-table-header.js.map +1 -1
  25. package/lib/components/metrics-table-header/metrics-table-header.module.css +8 -12
  26. package/lib/components/metrics-table-options/metrics-table-options.js +1 -1
  27. package/lib/components/metrics-table-options/metrics-table-options.js.map +1 -1
  28. package/lib/components/metrics-table-title/metrics-table-title.js +1 -1
  29. package/lib/components/metrics-table-title/metrics-table-title.js.map +1 -1
  30. package/lib/components/run-info/run-info.js +26 -14
  31. package/lib/components/run-info/run-info.js.map +1 -1
  32. package/lib/components/run-info/run-info.module.css +35 -26
  33. package/lib/components/summary/summary.js +9 -10
  34. package/lib/components/summary/summary.js.map +1 -1
  35. package/lib/components/summary/summary.module.css +60 -10
  36. package/lib/constants.js +13 -1
  37. package/lib/constants.js.map +1 -1
  38. package/lib/css/variables.css +71 -58
  39. package/lib/ui/dialog/dialog.js +4 -2
  40. package/lib/ui/dialog/dialog.js.map +1 -1
  41. package/lib/ui/dialog/dialog.module.css +22 -0
  42. package/lib/ui/dropdown/dropdown.js +4 -3
  43. package/lib/ui/dropdown/dropdown.js.map +1 -1
  44. package/lib/ui/dropdown/dropdown.module.css +11 -0
  45. package/lib/ui/hover-card/hover-card.js +1 -1
  46. package/lib/ui/hover-card/hover-card.js.map +1 -1
  47. package/lib/ui/hover-card/hover-card.module.css +14 -0
  48. package/lib/ui/table/table.module.css +0 -1
  49. package/lib/ui/tooltip/tooltip.js +1 -1
  50. package/lib/ui/tooltip/tooltip.js.map +1 -1
  51. package/lib/ui/tooltip/tooltip.module.css +11 -0
  52. package/lib-esm/app/app.js +4 -1
  53. package/lib-esm/app/app.js.map +1 -1
  54. package/lib-esm/app/app.module.css +11 -1
  55. package/lib-esm/components/delta/delta.js +3 -13
  56. package/lib-esm/components/delta/delta.js.map +1 -1
  57. package/lib-esm/components/delta/delta.module.css +13 -12
  58. package/lib-esm/components/delta/index.js.map +1 -1
  59. package/lib-esm/components/index.js +1 -0
  60. package/lib-esm/components/index.js.map +1 -1
  61. package/lib-esm/components/insight-icon/insight-icon.module.css +6 -6
  62. package/lib-esm/components/job-name/job-name.js +1 -2
  63. package/lib-esm/components/job-name/job-name.js.map +1 -1
  64. package/lib-esm/components/metric-change-legend/index.js +2 -0
  65. package/lib-esm/components/metric-change-legend/index.js.map +1 -0
  66. package/lib-esm/components/metric-change-legend/metric-change-legend.js +84 -0
  67. package/lib-esm/components/metric-change-legend/metric-change-legend.js.map +1 -0
  68. package/lib-esm/components/metric-change-legend/metric-change-legend.module.css +69 -0
  69. package/lib-esm/components/metric-run-info/metric-run-info.js +31 -8
  70. package/lib-esm/components/metric-run-info/metric-run-info.js.map +1 -1
  71. package/lib-esm/components/metrics-display-selector/metrics-display-selector.js +7 -9
  72. package/lib-esm/components/metrics-display-selector/metrics-display-selector.js.map +1 -1
  73. package/lib-esm/components/metrics-display-selector/metrics-display-selector.module.css +0 -25
  74. package/lib-esm/components/metrics-table-header/metrics-table-header.js +6 -6
  75. package/lib-esm/components/metrics-table-header/metrics-table-header.js.map +1 -1
  76. package/lib-esm/components/metrics-table-header/metrics-table-header.module.css +8 -12
  77. package/lib-esm/components/metrics-table-options/metrics-table-options.js +1 -1
  78. package/lib-esm/components/metrics-table-options/metrics-table-options.js.map +1 -1
  79. package/lib-esm/components/metrics-table-title/metrics-table-title.js +1 -1
  80. package/lib-esm/components/metrics-table-title/metrics-table-title.js.map +1 -1
  81. package/lib-esm/components/run-info/run-info.js +26 -14
  82. package/lib-esm/components/run-info/run-info.js.map +1 -1
  83. package/lib-esm/components/run-info/run-info.module.css +35 -26
  84. package/lib-esm/components/summary/summary.js +10 -11
  85. package/lib-esm/components/summary/summary.js.map +1 -1
  86. package/lib-esm/components/summary/summary.module.css +60 -10
  87. package/lib-esm/constants.js +12 -0
  88. package/lib-esm/constants.js.map +1 -1
  89. package/lib-esm/css/variables.css +71 -58
  90. package/lib-esm/ui/dialog/dialog.js +4 -2
  91. package/lib-esm/ui/dialog/dialog.js.map +1 -1
  92. package/lib-esm/ui/dialog/dialog.module.css +22 -0
  93. package/lib-esm/ui/dropdown/dropdown.js +4 -3
  94. package/lib-esm/ui/dropdown/dropdown.js.map +1 -1
  95. package/lib-esm/ui/dropdown/dropdown.module.css +11 -0
  96. package/lib-esm/ui/hover-card/hover-card.js +1 -1
  97. package/lib-esm/ui/hover-card/hover-card.js.map +1 -1
  98. package/lib-esm/ui/hover-card/hover-card.module.css +14 -0
  99. package/lib-esm/ui/table/table.module.css +0 -1
  100. package/lib-esm/ui/tooltip/tooltip.js +1 -1
  101. package/lib-esm/ui/tooltip/tooltip.js.map +1 -1
  102. package/lib-esm/ui/tooltip/tooltip.module.css +11 -0
  103. package/package.json +12 -12
  104. package/src/app/app.jsx +6 -1
  105. package/src/app/app.module.css +11 -1
  106. package/src/components/delta/delta.module.css +13 -12
  107. package/src/components/delta/delta.tsx +32 -0
  108. package/src/components/index.ts +3 -0
  109. package/src/components/insight-icon/insight-icon.module.css +6 -6
  110. package/src/components/job-name/job-name.jsx +2 -3
  111. package/src/components/metric-change-legend/index.ts +1 -0
  112. package/src/components/metric-change-legend/metric-change-legend.module.css +69 -0
  113. package/src/components/metric-change-legend/metric-change-legend.stories.tsx +13 -0
  114. package/src/components/metric-change-legend/metric-change-legend.tsx +148 -0
  115. package/src/components/metric-run-info/metric-run-info.tsx +41 -17
  116. package/src/components/metrics-display-selector/metrics-display-selector.module.css +0 -25
  117. package/src/components/metrics-display-selector/metrics-display-selector.tsx +25 -37
  118. package/src/components/metrics-table-header/metrics-table-header.module.css +8 -12
  119. package/src/components/metrics-table-header/metrics-table-header.tsx +5 -6
  120. package/src/components/metrics-table-options/metrics-table-options.tsx +1 -1
  121. package/src/components/metrics-table-title/metrics-table-title.jsx +1 -1
  122. package/src/components/run-info/run-info.module.css +35 -26
  123. package/src/components/run-info/run-info.stories.tsx +16 -10
  124. package/src/components/run-info/run-info.tsx +132 -73
  125. package/src/components/summary/summary.module.css +60 -10
  126. package/src/components/summary/summary.tsx +47 -50
  127. package/src/constants.ts +13 -0
  128. package/src/css/variables.css +71 -58
  129. package/src/ui/dialog/dialog.module.css +22 -0
  130. package/src/ui/dialog/dialog.tsx +9 -2
  131. package/src/ui/dropdown/dropdown.module.css +11 -0
  132. package/src/ui/dropdown/dropdown.tsx +5 -1
  133. package/src/ui/hover-card/hover-card.module.css +14 -0
  134. package/src/ui/hover-card/hover-card.tsx +1 -1
  135. package/src/ui/table/table.module.css +0 -1
  136. package/src/ui/tooltip/tooltip.module.css +11 -0
  137. package/src/ui/tooltip/tooltip.tsx +1 -1
  138. package/types/components/delta/delta.d.ts +7 -21
  139. package/types/components/delta/index.d.ts +1 -1
  140. package/types/components/index.d.ts +3 -0
  141. package/types/components/metric-change-legend/index.d.ts +1 -0
  142. package/types/components/metric-change-legend/metric-change-legend.d.ts +4 -0
  143. package/types/components/metric-run-info/metric-run-info.d.ts +2 -6
  144. package/types/components/run-info/run-info.d.ts +16 -7
  145. package/types/constants.d.ts +12 -0
  146. package/types/ui/dialog/dialog.d.ts +3 -2
  147. package/types/ui/dropdown/dropdown.d.ts +1 -0
  148. package/src/components/delta/delta.jsx +0 -22
  149. /package/src/components/delta/{index.js → index.ts} +0 -0
@@ -4,21 +4,16 @@ import get from 'lodash/get';
4
4
  import { METRIC_COMPONENT_LINKS } from '@bundle-stats/utils';
5
5
 
6
6
  import {
7
- METRICS_WEBPACK_ASSETS,
7
+ METRICS_GROUP_ASSETS,
8
+ METRICS_GROUP_MODULES,
9
+ METRICS_GROUP_PACKAGES,
8
10
  METRICS_WEBPACK_GENERAL,
9
- METRICS_WEBPACK_MODULES,
10
- METRICS_WEBPACK_PACKAGES,
11
11
  } from '../../constants';
12
12
  import { Box } from '../../layout/box';
13
13
  import { ComponentLink } from '../component-link';
14
14
  import { MetricRunInfo, MetricRunInfoProps } from '../metric-run-info';
15
15
  import css from './summary.module.css';
16
-
17
- const METRICS_WEBPACK_OTHERS = [
18
- ...METRICS_WEBPACK_ASSETS,
19
- ...METRICS_WEBPACK_MODULES,
20
- ...METRICS_WEBPACK_PACKAGES,
21
- ];
16
+ import { Stack } from '../../layout';
22
17
 
23
18
  interface SummaryItemProps {
24
19
  metricId: string;
@@ -46,15 +41,7 @@ const SummaryItem = (props: SummaryItemProps & React.ComponentProps<'div'>) => {
46
41
  const metricData = get(data, metricId, { current: 0, baseline: 0 });
47
42
 
48
43
  return (
49
- <Box
50
- key={metricId}
51
- outline
52
- outlineHover
53
- padding="small"
54
- as={SummaryItemCustomLink}
55
- {...componentLink?.link}
56
- className={className}
57
- >
44
+ <SummaryItemCustomLink key={metricId} {...componentLink?.link} className={className}>
58
45
  <MetricRunInfo
59
46
  metricId={metricId}
60
47
  current={metricData.current}
@@ -64,7 +51,7 @@ const SummaryItem = (props: SummaryItemProps & React.ComponentProps<'div'>) => {
64
51
  size={size}
65
52
  loading={loading}
66
53
  />
67
- </Box>
54
+ </SummaryItemCustomLink>
68
55
  );
69
56
  };
70
57
 
@@ -90,38 +77,48 @@ export const Summary = ({
90
77
  summaryItemLink = ComponentLink,
91
78
  }: SummaryProps & React.ComponentProps<'div'>) => (
92
79
  <Box className={cx(css.root, className)}>
93
- <div className={css.wrapper}>
94
- <div className={css.items}>
95
- {METRICS_WEBPACK_GENERAL.map((metricId) => (
96
- <SummaryItem
97
- key={metricId}
98
- className={css.item}
99
- metricId={metricId}
100
- data={data}
101
- size="large"
102
- loading={loading}
103
- customLink={summaryItemLink}
104
- showDelta={showSummaryItemDelta}
105
- showBaseline={showSummaryItemBaseline}
106
- />
107
- ))}
108
- </div>
80
+ <div className={css.row}>
81
+ <Box outline padding="small" className={css.rowGroup}>
82
+ <div className={css.items}>
83
+ {METRICS_WEBPACK_GENERAL.map((metricId) => (
84
+ <SummaryItem
85
+ key={metricId}
86
+ className={css.item}
87
+ metricId={metricId}
88
+ data={data}
89
+ size="xlarge"
90
+ loading={loading}
91
+ customLink={summaryItemLink}
92
+ showDelta={showSummaryItemDelta}
93
+ showBaseline={showSummaryItemBaseline}
94
+ />
95
+ ))}
96
+ </div>
97
+ </Box>
109
98
  </div>
110
- <div className={css.wrapper}>
111
- <div className={css.items}>
112
- {METRICS_WEBPACK_OTHERS.map((metricId) => (
113
- <SummaryItem
114
- key={metricId}
115
- className={cx(css.item, css.itemSmall)}
116
- metricId={metricId}
117
- data={data}
118
- customLink={summaryItemLink}
119
- loading={loading}
120
- showDelta={showSummaryItemDelta}
121
- showBaseline={false}
122
- />
123
- ))}
124
- </div>
99
+ <div className={css.row}>
100
+ {[METRICS_GROUP_ASSETS, METRICS_GROUP_MODULES, METRICS_GROUP_PACKAGES].map((metricGroup) => (
101
+ <Stack className={css.rowGroup} key={metricGroup.title}>
102
+ <h3 className={css.rowGroupTitle}>{metricGroup.title}</h3>
103
+ <Box outline padding="small">
104
+ <div className={css.items}>
105
+ {metricGroup.metrics.map((metricId) => (
106
+ <SummaryItem
107
+ key={metricId}
108
+ className={css.item}
109
+ metricId={metricId}
110
+ data={data}
111
+ size="large"
112
+ loading={loading}
113
+ customLink={summaryItemLink}
114
+ showDelta={showSummaryItemDelta}
115
+ showBaseline={showSummaryItemBaseline}
116
+ />
117
+ ))}
118
+ </div>
119
+ </Box>
120
+ </Stack>
121
+ ))}
125
122
  </div>
126
123
  </Box>
127
124
  );
package/src/constants.ts CHANGED
@@ -36,6 +36,19 @@ export const METRICS_WEBPACK_MODULES = [
36
36
  ];
37
37
  export const METRICS_WEBPACK_PACKAGES = ['webpack.packageCount', 'webpack.duplicatePackagesCount'];
38
38
 
39
+ export const METRICS_GROUP_ASSETS = {
40
+ title: 'Assets',
41
+ metrics: METRICS_WEBPACK_ASSETS,
42
+ };
43
+ export const METRICS_GROUP_MODULES = {
44
+ title: 'Modules',
45
+ metrics: METRICS_WEBPACK_MODULES,
46
+ };
47
+ export const METRICS_GROUP_PACKAGES = {
48
+ title: 'Packages',
49
+ metrics: METRICS_WEBPACK_PACKAGES,
50
+ };
51
+
39
52
  export const SORT = {
40
53
  ASC: 'asc',
41
54
  DESC: 'desc',
@@ -32,22 +32,21 @@
32
32
  --line-height-number: 1.2em;
33
33
 
34
34
  /*
35
- * Color scheme:
36
- * https://coolors.co/287acc-da444e-55b950-efcc1a-192339
37
- * http://mcg.mbitson.com/#!?mcgpalette0=%23da444e&mcgpalette1=%2355b950&mcgpalette2=%23ebc013&mcgpalette3=%232a2933&mcgpalette4=%23287acc&themename=bundle-stats
38
- * https://hihayk.github.io/scale/#4/5/50/90/-51/0/0/14/353138/53/49/56/white
35
+ * Color scheme: https://coolors.co/287acc-da444e-55b950-e5c110-192339-353538
39
36
  */
40
- --color-gray-25: #f9f9f9;
41
- --color-gray-50: #e5e5e7;
42
- --color-gray-100: #d2d2d4;
43
- --color-gray-200: #959499;
44
- --color-gray-300: #6a6970;
45
- --color-gray-400: #4a4952;
46
- --color-gray-500: #2a2933;
47
- --color-gray-600: #25242e;
48
- --color-gray-700: #1f1f27;
49
- --color-gray-800: #191920;
50
- --color-gray-900: #0f0f14;
37
+
38
+ --color-gray-25: #f9f9f9;
39
+ /** https://hihayk.github.io/scale/#4/5/60/90/0/-0/0/0/3F3F47/63/63/71/white */
40
+ --color-gray-50: #ececed;
41
+ --color-gray-100: #c9c9cc;
42
+ --color-gray-200: #a7a7aa;
43
+ --color-gray-300: #848489;
44
+ --color-gray-400: #626268;
45
+ --color-gray-500: #3f3f47;
46
+ --color-gray-600: #36363c;
47
+ --color-gray-700: #2c2c32;
48
+ --color-gray-800: #232327;
49
+ --color-gray-900: #19191c;
51
50
 
52
51
  --color-gray-ultra-light: var(--color-gray-200);
53
52
  --color-gray-light: var(--color-gray-300);
@@ -56,16 +55,17 @@
56
55
  --color-gray-ultra-dark: var(--color-gray-900);
57
56
 
58
57
  --color-red-25: #fdf5f6;
59
- --color-red-50: #fbe9ea;
60
- --color-red-100: #f4c7ca;
61
- --color-red-200: #eda2a7;
62
- --color-red-300: #e57c83;
63
- --color-red-400: #e06069;
58
+ /* https://hihayk.github.io/scale/#4/5/60/90/0/-0/0/100/DA444E/218/68/78/white */
59
+ --color-red-50: #fbeced;
60
+ --color-red-100: #f5cbcd;
61
+ --color-red-200: #eea9ae;
62
+ --color-red-300: #e7878e;
63
+ --color-red-400: #e1666e;
64
64
  --color-red-500: #da444e;
65
- --color-red-600: #d63e47;
66
- --color-red-700: #d0353d;
67
- --color-red-800: #cb2d35;
68
- --color-red-900: #c21f25;
65
+ --color-red-600: #c92a35;
66
+ --color-red-700: #b31520;
67
+ --color-red-800: #8c0710;
68
+ --color-red-900: #660005;
69
69
  --color-red-ultra-light: var(--color-red-100);
70
70
  --color-red-light: var(--color-red-300);
71
71
  --color-red: var(--color-red-500);
@@ -73,16 +73,17 @@
73
73
  --color-red-ultra-dark: var(--color-red-900);
74
74
 
75
75
  --color-blue-25: #f3f8fd;
76
- --color-blue-50: #e5eff9;
77
- --color-blue-100: #bfd7f0;
78
- --color-blue-200: #94bde6;
79
- --color-blue-300: #69a2db;
80
- --color-blue-400: #488ed4;
76
+ /* https://hihayk.github.io/scale/#4/5/60/90/0/-0/0/100/287ACC/40/122/204/white */
77
+ --color-blue-50: #eaf2fa;
78
+ --color-blue-100: #c3daf1;
79
+ --color-blue-200: #9cc2e8;
80
+ --color-blue-300: #75aade;
81
+ --color-blue-400: #4f92d5;
81
82
  --color-blue-500: #287acc;
82
- --color-blue-600: #2472c7;
83
- --color-blue-700: #1e67c0;
84
- --color-blue-800: #185db9;
85
- --color-blue-900: #0f4aad;
83
+ --color-blue-600: #1168bf;
84
+ --color-blue-700: #0055ac;
85
+ --color-blue-800: #00438c;
86
+ --color-blue-900: #003166;
86
87
 
87
88
  --color-blue-ultra-light: var(--color-blue-100);
88
89
  --color-blue-light: var(--color-blue-300);
@@ -91,16 +92,17 @@
91
92
  --color-blue-ultra-dark: var(--color-blue-900);
92
93
 
93
94
  --color-green-25: #f6fbf6;
94
- --color-green-50: #ebf7ea;
95
- --color-green-100: #cceacb;
96
- --color-green-200: #aadca8;
97
- --color-green-300: #88ce85;
98
- --color-green-400: #6fc46a;
99
- --color-green-500: #55b950;
100
- --color-green-600: #4eb249;
101
- --color-green-700: #44aa40;
102
- --color-green-800: #3ba237;
103
- --color-green-900: #2a9327;
95
+ /* https://hihayk.github.io/scale/#4/5/60/90/0/-0/0/100/55b950/85/185/80/white */
96
+ --color-green-50: #eef8ee;
97
+ --color-green-100: #cfebce;
98
+ --color-green-200: #b1dfaf;
99
+ --color-green-300: #92d28f;
100
+ --color-green-400: #74c670;
101
+ --color-green-500: #55B950;
102
+ --color-green-600: #3ea839;
103
+ --color-green-700: #2b9426;
104
+ --color-green-800: #1b7b16;
105
+ --color-green-900: #0f5f0b;
104
106
 
105
107
  --color-green-ultra-light: var(--color-green-100);
106
108
  --color-green-light: var(--color-green-300);
@@ -109,18 +111,18 @@
109
111
  --color-green-ultra-dark: var(--color-green-900);
110
112
 
111
113
  --color-yellow-25: #fffdf2;
112
- --color-yellow-50: #fdf7e3;
113
- --color-yellow-100: #f9ecb8;
114
- --color-yellow-200: #f5e089;
115
- --color-yellow-300: #f1d35a;
116
- --color-yellow-400: #eec936;
117
- --color-yellow-500: #ebc013;
118
- --color-yellow-600: #e9ba11;
119
- --color-yellow-700: #e5b20e;
120
- --color-yellow-800: #e2aa0b;
121
- --color-yellow-900: #dd9c06;
122
-
123
- --color-yellow-light-background: var(--color-yellow-25);
114
+ /* https://hihayk.github.io/scale/#4/5/40/80/0/-0/0/0/E5C110/229/193/16/white */
115
+ --color-yellow-50: #faf3cf;
116
+ --color-yellow-100: #f6e9a9;
117
+ --color-yellow-200: #f2df83;
118
+ --color-yellow-300: #edd55d;
119
+ --color-yellow-400: #e9cb36;
120
+ --color-yellow-500: #e5c110;
121
+ --color-yellow-600: #ceae0e;
122
+ --color-yellow-700: #b79a0d;
123
+ --color-yellow-800: #a0870b;
124
+ --color-yellow-900: #89740a;
125
+
124
126
  --color-yellow-ultra-light: var(--color-yellow-100);
125
127
  --color-yellow-light: var(--color-yellow-300);
126
128
  --color-yellow: var(--color-yellow-500);
@@ -130,11 +132,13 @@
130
132
  --color-dark: #111;
131
133
  --color-light: #fff;
132
134
 
133
- /* Functional color variables */
134
135
  --color-branding-light: #2b76d4;
135
136
  --color-branding: #1a477f;
136
137
  --color-branding-dark: #09182a;
138
+ }
137
139
 
140
+ body {
141
+ /* Functional color variables */
138
142
  --color-text-ultra-light: var(--color-gray-ultra-light);
139
143
  --color-text-light: var(--color-gray-light);
140
144
  --color-text: var(--color-gray);
@@ -183,8 +187,8 @@
183
187
  --color-backdrop: rgba(0, 0, 0, 0.05);
184
188
  --color-shadow: rgba(0, 0, 0, 0.25);
185
189
 
186
- --transition-duration-in: 0.2s;
187
- --transition-duration-out: 0.17s;
190
+ --transition-duration-in: 0.16s;
191
+ --transition-duration-out: 0.10s;
188
192
  --transition-in: all var(--transition-duration-in) ease-in;
189
193
  --transition-out: all var(--transition-duration-out) ease-out;
190
194
 
@@ -219,3 +223,12 @@
219
223
  --entry-info-width: 64rem;
220
224
  --entry-info-top: var(--header-height);
221
225
  }
226
+
227
+ @media (prefers-reduced-motion: reduce) {
228
+ * {
229
+ animation-duration: 0s !important;
230
+ animation-delay: 0s !important;
231
+ transition-duration: 0s !important;
232
+ transition-delay: 0s !important;
233
+ }
234
+ }
@@ -3,6 +3,17 @@
3
3
  align-items: center;
4
4
  justify-content: center;
5
5
  z-index: var(--layer-xxhigh);
6
+ opacity: 0;
7
+ transition: var(--transition-out);
8
+ }
9
+
10
+ .backdrop[data-enter] {
11
+ opacity: 1;
12
+ transition: var(--transition-in);
13
+ }
14
+
15
+ .backdrop[data-leave] {
16
+ pointer-events: none;
6
17
  }
7
18
 
8
19
  .backdrop::before {
@@ -27,6 +38,17 @@
27
38
  background: var(--color-background);
28
39
  box-shadow: 0 0 var(--space-medium) var(--color-shadow);
29
40
  z-index: var(--layer-xxhigh);
41
+ opacity: 0;
42
+ transition: var(--transition-out);
43
+ }
44
+
45
+ .dialog[data-enter] {
46
+ opacity: 1;
47
+ transition: var(--transition-in);
48
+ }
49
+
50
+ .digalog[data-leave] {
51
+ pointer-events: none;
30
52
  }
31
53
 
32
54
  .header {
@@ -1,13 +1,20 @@
1
1
  import type { ComponentProps, ReactNode } from 'react';
2
2
  import React from 'react';
3
3
  import cx from 'classnames';
4
- import { Dialog as AriakitDialog, DialogDismiss as AriakitDialogDismiss } from 'ariakit/dialog';
4
+ import {
5
+ Dialog as AriakitDialog,
6
+ DialogDismiss as AriakitDialogDismiss,
7
+ useDialogState as useAriakitDialogState,
8
+ type DialogStateProps,
9
+ } from 'ariakit/dialog';
5
10
 
6
11
  import { Stack } from '../../layout/stack';
7
12
  import { BUTTON_GLYPHS, Button } from '../button';
8
13
  import css from './dialog.module.css';
9
14
 
10
- export { useDialogState } from 'ariakit/dialog';
15
+ export const useDialogState = (options: DialogStateProps = {}) => {
16
+ return useAriakitDialogState({ animated: true, ...options });
17
+ };
11
18
 
12
19
  type AriakitDialogProps = ComponentProps<typeof AriakitDialog>;
13
20
 
@@ -16,6 +16,17 @@
16
16
  min-width: 12em;
17
17
  z-index: var(--layer-high);
18
18
  padding: calc(var(--space-xxxsmall) / 2);
19
+ opacity: 0;
20
+ transition: var(--transition-out);
21
+ }
22
+
23
+ .dropdown[data-enter] {
24
+ opacity: 1;
25
+ transition: var(--transition-in);
26
+ }
27
+
28
+ .dropdown[data-leave] {
29
+ pointer-events: none;
19
30
  }
20
31
 
21
32
  .dropdown:focus {
@@ -4,6 +4,7 @@ import { Menu, MenuButton, MenuItem, MenuStateProps, useMenuState } from 'ariaki
4
4
 
5
5
  import { Button, BUTTON_SIZE } from '../button';
6
6
  import css from './dropdown.module.css';
7
+ import { Icon } from '../icon';
7
8
 
8
9
  interface DropdownItemProps {
9
10
  isActive?: boolean;
@@ -26,6 +27,7 @@ interface DropdownProps {
26
27
  placement?: MenuStateProps['placement'];
27
28
  gutter?: MenuStateProps['gutter'];
28
29
  shift?: MenuStateProps['shift'];
30
+ showChevron?: boolean;
29
31
  }
30
32
 
31
33
  export const Dropdown = (props: DropdownProps & React.ComponentProps<'div'>) => {
@@ -35,6 +37,7 @@ export const Dropdown = (props: DropdownProps & React.ComponentProps<'div'>) =>
35
37
  label = null,
36
38
  ariaLabel = '',
37
39
  glyph = '',
40
+ showChevron = true,
38
41
  disabled = false,
39
42
  placement,
40
43
  gutter = 4,
@@ -43,7 +46,7 @@ export const Dropdown = (props: DropdownProps & React.ComponentProps<'div'>) =>
43
46
  } = props;
44
47
 
45
48
  const dropdownAriaLabel = ariaLabel || (typeof label === 'string' ? label : '');
46
- const menuState = useMenuState({ placement, gutter, shift });
49
+ const menuState = useMenuState({ animated: true, placement, gutter, shift });
47
50
 
48
51
  return (
49
52
  <>
@@ -52,6 +55,7 @@ export const Dropdown = (props: DropdownProps & React.ComponentProps<'div'>) =>
52
55
  outline
53
56
  size={BUTTON_SIZE.SMALL}
54
57
  glyph={glyph}
58
+ rightGlyph={showChevron ? Icon.ICONS.CHEVRON_DOWN : undefined}
55
59
  disabled={disabled}
56
60
  state={menuState}
57
61
  tabIndex={null}
@@ -5,11 +5,14 @@
5
5
  .anchor {
6
6
  display: inline-block;
7
7
  color: inherit;
8
+ cursor: default;
8
9
  text-decoration: none;
10
+ transition: var(--transition-out);
9
11
  }
10
12
 
11
13
  .anchor:hover {
12
14
  color: var(--color-primary);
15
+ transition: var(--transition-in);
13
16
  }
14
17
 
15
18
  .anchor:focus {
@@ -27,4 +30,15 @@
27
30
  will-change: filter;
28
31
  background: var(--color-light);
29
32
  font-size: var(--size-small);
33
+ opacity: 0;
34
+ transition: var(--transition-out);
35
+ }
36
+
37
+ .hoverCard[data-enter] {
38
+ opacity: 1;
39
+ transition: var(--transition-in);
40
+ }
41
+
42
+ .hoverCard[data-leave] {
43
+ pointer-events: none;
30
44
  }
@@ -31,7 +31,7 @@ export const HoverCard = (props: HoverCardProps) => {
31
31
  children,
32
32
  } = props;
33
33
 
34
- const state = useHovercardState({ gutter: 8, timeout: 300, placement: 'top' });
34
+ const state = useHovercardState({ animated: true, gutter: 8, timeout: 300, placement: 'top' });
35
35
  const hovercardProps = useHovercard({ state, portal: true });
36
36
 
37
37
  // Fallback to span if no href
@@ -16,7 +16,6 @@
16
16
 
17
17
  .root thead th {
18
18
  border-width: 0 0 1px;
19
- text-transform: uppercase;
20
19
  vertical-align: top;
21
20
  background: var(--color-highlight);
22
21
  }
@@ -21,6 +21,17 @@
21
21
  text-align: center;
22
22
  filter: drop-shadow(var(--shadow-layer));
23
23
  will-change: filter;
24
+ opacity: 0;
25
+ transition: var(--transition-out);
26
+ }
27
+
28
+ .tooltip[data-enter] {
29
+ opacity: 1;
30
+ transition: var(--transition-in);
31
+ }
32
+
33
+ .tooltip[data-leave] {
34
+ pointer-events: none;
24
35
  }
25
36
 
26
37
  .arrow svg {
@@ -29,7 +29,7 @@ export const Tooltip = <T extends React.ElementType = 'span'>(
29
29
  ...restProps
30
30
  } = props;
31
31
 
32
- const tooltip = useTooltipState({ placement: 'top', timeout: 300 });
32
+ const tooltip = useTooltipState({ animated: true, placement: 'top', timeout: 300 });
33
33
 
34
34
  return (
35
35
  <>
@@ -1,22 +1,8 @@
1
- export function Delta({ className, displayValue, deltaType, inverted }: {
2
- className?: string | undefined;
3
- displayValue: any;
4
- deltaType: any;
5
- inverted?: boolean | undefined;
6
- }): React.JSX.Element;
7
- export namespace Delta {
8
- namespace defaultProps {
9
- let className: string;
10
- let inverted: boolean;
11
- }
12
- namespace propTypes {
13
- let className_1: PropTypes.Requireable<string>;
14
- export { className_1 as className };
15
- export let displayValue: PropTypes.Validator<string>;
16
- export let deltaType: PropTypes.Validator<string>;
17
- let inverted_1: PropTypes.Requireable<boolean>;
18
- export { inverted_1 as inverted };
19
- }
20
- }
21
1
  import React from 'react';
22
- import PropTypes from 'prop-types';
2
+ import type { MetricRunInfoDeltaType } from '@bundle-stats/utils';
3
+ export interface DeltaProps {
4
+ displayValue: string;
5
+ deltaType: MetricRunInfoDeltaType;
6
+ inverted?: boolean;
7
+ }
8
+ export declare const Delta: (props: DeltaProps & React.ComponentProps<"span">) => React.JSX.Element;
@@ -1 +1 @@
1
- export * from "./delta";
1
+ export * from './delta';
@@ -5,12 +5,15 @@ export { BundlePackages } from './bundle-packages';
5
5
  export { BundleModules } from './bundle-modules';
6
6
  export { ComponentLink } from './component-link';
7
7
  export { Delta } from './delta';
8
+ export type { DeltaProps } from './delta';
8
9
  export { InsightIcon } from './insight-icon';
9
10
  export { Insights } from './insights';
10
11
  export { JobName } from './job-name';
11
12
  export { JobsHeader } from './jobs-header';
12
13
  export { LighthouseTable } from './lighthouse-table';
13
14
  export { Metric } from './metric';
15
+ export { MetricChangeLegend } from './metric-change-legend';
16
+ export type { MetricChangeLegendProps } from './metric-change-legend';
14
17
  export { MetricRunInfo } from './metric-run-info';
15
18
  export type { MetricRunInfoProps } from './metric-run-info';
16
19
  export { MetricsTable } from './metrics-table';
@@ -0,0 +1 @@
1
+ export * from './metric-change-legend';
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export interface MetricChangeLegendProps extends React.ComponentProps<'div'> {
3
+ }
4
+ export declare const MetricChangeLegend: (props: MetricChangeLegendProps) => React.JSX.Element;
@@ -1,14 +1,10 @@
1
1
  import React, { ElementType } from 'react';
2
2
  import { RunInfoProps } from '../run-info';
3
- export interface MetricRunInfoProps {
3
+ export type MetricRunInfoProps = {
4
4
  metricId: string;
5
5
  current: number;
6
6
  baseline?: number;
7
- showDelta?: boolean;
8
7
  showMetricDescription?: boolean;
9
- showBaseline?: boolean;
10
8
  titleWrapper?: ElementType;
11
- size?: RunInfoProps['size'];
12
- loading?: RunInfoProps['loading'];
13
- }
9
+ } & Pick<RunInfoProps, 'showDelta' | 'showBaseline' | 'size' | 'loading'>;
14
10
  export declare const MetricRunInfo: (props: MetricRunInfoProps & React.ComponentProps<"div">) => React.JSX.Element;
@@ -1,17 +1,26 @@
1
1
  import React, { type ReactNode } from 'react';
2
- export interface RunInfoProps {
2
+ import type { MetricRunInfoDeltaType } from '@bundle-stats/utils';
3
+ type RunInfoTitleProps = {
4
+ className?: string;
3
5
  title?: ReactNode;
4
6
  titleHoverCard?: ReactNode;
5
7
  titleTooltip?: ReactNode;
8
+ };
9
+ type RunInfoContentProps = {
10
+ className?: string;
11
+ loading?: boolean;
6
12
  current?: ReactNode;
13
+ enhance?: boolean;
7
14
  baseline?: string;
8
15
  delta?: string;
9
16
  deltaPercentage?: string;
10
- deltaType?: string;
17
+ deltaType?: MetricRunInfoDeltaType;
18
+ showBaseline?: boolean;
19
+ showDelta?: boolean;
20
+ };
21
+ export type RunInfoProps = Pick<RunInfoTitleProps, 'title' | 'titleHoverCard' | 'titleTooltip'> & Pick<RunInfoContentProps, 'current' | 'baseline' | 'delta' | 'deltaPercentage' | 'deltaType' | 'showBaseline' | 'showDelta' | 'loading' | 'enhance'> & {
11
22
  as?: React.ElementType;
12
23
  size?: 'small' | 'medium' | 'large' | 'xlarge';
13
- showBaseline?: boolean;
14
- loading?: boolean;
15
- enhance?: boolean;
16
- }
17
- export declare const RunInfo: ({ className, title, titleHoverCard, titleTooltip, current, baseline, delta, deltaPercentage, deltaType, as: Component, size, showBaseline, loading, enhance, ...restProps }: RunInfoProps & Omit<React.ComponentProps<"div">, "title">) => React.JSX.Element;
24
+ };
25
+ export declare const RunInfo: ({ className, title, titleHoverCard, titleTooltip, current, baseline, delta, deltaPercentage, deltaType, as: Component, size, showBaseline, showDelta, loading, enhance, children, ...restProps }: RunInfoProps & Omit<React.ComponentProps<"div">, "title">) => React.JSX.Element;
26
+ export {};