@bundle-stats/ui 4.13.0-beta.11 → 4.13.0-beta.13

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 (26) hide show
  1. package/lib/components/bundle-assets-totals/bundle-assets-totals.js +4 -4
  2. package/lib/components/bundle-assets-totals/bundle-assets-totals.js.map +1 -1
  3. package/lib/components/metrics-treemap/metrics-treemap.js +25 -25
  4. package/lib/components/metrics-treemap/metrics-treemap.js.map +1 -1
  5. package/lib/components/metrics-treemap/metrics-treemap.module.css +28 -23
  6. package/lib/css/variables.css +1 -0
  7. package/lib/layout/box/box.module.css +4 -2
  8. package/lib/ui/table/table.module.css +30 -0
  9. package/lib/ui/tag/tag.module.css +3 -3
  10. package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.js +4 -4
  11. package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.js.map +1 -1
  12. package/lib-esm/components/metrics-treemap/metrics-treemap.js +25 -25
  13. package/lib-esm/components/metrics-treemap/metrics-treemap.js.map +1 -1
  14. package/lib-esm/components/metrics-treemap/metrics-treemap.module.css +28 -23
  15. package/lib-esm/css/variables.css +1 -0
  16. package/lib-esm/layout/box/box.module.css +4 -2
  17. package/lib-esm/ui/table/table.module.css +30 -0
  18. package/lib-esm/ui/tag/tag.module.css +3 -3
  19. package/package.json +4 -4
  20. package/src/components/bundle-assets-totals/bundle-assets-totals.jsx +27 -22
  21. package/src/components/metrics-treemap/metrics-treemap.module.css +28 -23
  22. package/src/components/metrics-treemap/metrics-treemap.tsx +45 -45
  23. package/src/css/variables.css +1 -0
  24. package/src/layout/box/box.module.css +4 -2
  25. package/src/ui/table/table.module.css +30 -0
  26. package/src/ui/tag/tag.module.css +3 -3
@@ -22,7 +22,7 @@
22
22
  }
23
23
 
24
24
  /** Leaf wrapper button */
25
- .leaf {
25
+ .tile {
26
26
  position: absolute;
27
27
  appearance: none;
28
28
  border: 0;
@@ -35,9 +35,10 @@
35
35
  font-size: var(--size-small);
36
36
  line-height: var(--line-height-heading);
37
37
  text-align: left;
38
+ transition: var(--ui-transition-out);
38
39
  }
39
40
 
40
- .leaf::before {
41
+ .tile::before {
41
42
  content: "";
42
43
  display: block;
43
44
  position: absolute;
@@ -47,18 +48,22 @@
47
48
  width: 100%;
48
49
  height: 100%;
49
50
  background-color: currentColor;
50
- color: var(--color-background);
51
+ color: var(--color-highlight);
51
52
  transition: var(--ui-transition-out);
52
53
  transition-property: opacity;
53
- opacity: 0.6;
54
+ opacity: 0.75;
54
55
  }
55
56
 
56
- .leaf:hover::before {
57
+ .tile:hover {
57
58
  transition: var(--ui-transition-in);
58
- opacity: 0.4;
59
59
  }
60
60
 
61
- .leafContent {
61
+ .tile:hover::before {
62
+ transition: var(--ui-transition-in);
63
+ opacity: 0.5;
64
+ }
65
+
66
+ .tileContent {
62
67
  position: relative;
63
68
  z-index: 1;
64
69
  width: 100%;
@@ -71,8 +76,8 @@
71
76
  line-height: var(--line-height-heading);
72
77
  }
73
78
 
74
- /** Align label to other elements on the first column leafs */
75
- .leafFirstCol .leafContent {
79
+ /** Align label to other elements on the first column cells */
80
+ .tileFirstCol .tileContent {
76
81
  padding-left: var(--space-small);
77
82
  }
78
83
 
@@ -100,51 +105,51 @@
100
105
  }
101
106
 
102
107
  /** Tile size variation */
103
- .leafSmall .leafContent {
108
+ .tileSmall .tileContent {
104
109
  padding: var(--space-xxxsmall) var(--space-xxsmall);
105
110
  gap: 0;
106
111
  font-size: var(--size-xsmall);
107
112
  }
108
113
 
109
- .leafSmall .leadContentLabel {
114
+ .tileSmall .leadContentLabel {
110
115
  margin-top: 0;
111
116
  }
112
117
 
113
118
  /** Tile diff variation */
114
- .leaf-NO_CHANGE {
119
+ .tile-NO_CHANGE {
115
120
  color: var(--color-text-light);
116
121
  }
117
122
 
118
- .leaf-NO_CHANGE::before {
123
+ .tile-NO_CHANGE::before {
119
124
  color: var(--color-gray-50);
120
125
  opacity: 0.4;
121
126
  }
122
127
 
123
- .leaf-NO_CHANGE:hover::before {
128
+ .tile-NO_CHANGE:hover::before {
124
129
  opacity: 0.2;
125
130
  }
126
131
 
127
- .leaf-HIGH_NEGATIVE::before {
132
+ .tile-HIGH_NEGATIVE::before {
128
133
  color: var(--color-red-100);
129
134
  }
130
135
 
131
- .leaf-NEGATIVE::before {
136
+ .tile-NEGATIVE::before {
132
137
  color: var(--color-red-50);
133
138
  }
134
139
 
135
- .leaf-LOW_NEGATIVE::before {
140
+ .tile-LOW_NEGATIVE::before {
136
141
  color: var(--color-red-25);
137
142
  }
138
143
 
139
- .leaf-LOW_POSITIVE::before {
144
+ .tile-LOW_POSITIVE::before {
140
145
  color: var(--color-green-25);
141
146
  }
142
147
 
143
- .leaf-POSITIVE::before {
148
+ .tile-POSITIVE::before {
144
149
  color: var(--color-green-50);
145
150
  }
146
151
 
147
- .leaf-HIGH_POSITIVE::before {
152
+ .tile-HIGH_POSITIVE::before {
148
153
  color: var(--color-green-100);
149
154
  }
150
155
 
@@ -166,7 +171,7 @@
166
171
  }
167
172
 
168
173
  /** tooltip */
169
- .leafContentTooltipAnchor {
174
+ .tileContentTooltipAnchor {
170
175
  width: 100%;
171
176
  height: 100%;
172
177
  }
@@ -191,11 +196,11 @@ div[role="presentation"]:has(.tooltip) {
191
196
  }
192
197
 
193
198
 
194
- .leafTooltipArrow svg {
199
+ .tileTooltipArrow svg {
195
200
  display: block;
196
201
  fill: var(--color-background) !important;
197
202
  }
198
203
 
199
- .leafTooltipContentTitle {
204
+ .tileTooltipContentTitle {
200
205
  font-size: var(--size-medium);
201
206
  }
@@ -192,6 +192,7 @@
192
192
  --shadow-layer: 0 0 var(--space-xxxsmall) var(--color-shadow);
193
193
  --shadow-layer-high: 0 0 var(--space-xxsmall) var(--color-shadow);
194
194
 
195
+ --radius-xsmall: 3px;
195
196
  --radius-small: 5px;
196
197
  --radius-medium: 7px;
197
198
  --radius-large: 9px;
@@ -8,11 +8,13 @@
8
8
  }
9
9
 
10
10
  .outline > :first-child {
11
- border-radius: var(--radius-medium) var(--radius-medium) 0 0;
11
+ border-top-left-radius: var(--radius-medium);
12
+ border-top-right-radius: var(--radius-medium);
12
13
  }
13
14
 
14
15
  .outline > :last-child {
15
- border-radius: 0 0 var(--radius-medium) var(--radius-medium);
16
+ border-bottom-left-radius: var(--radius-medium);
17
+ border-bottom-right-radius: var(--radius-medium);
16
18
  }
17
19
 
18
20
  .outlineHover {
@@ -89,6 +89,36 @@
89
89
  border-width: 1px;
90
90
  }
91
91
 
92
+ /** cascade border radius */
93
+ .root thead,
94
+ .root thead tr:first-child {
95
+ border-top-left-radius: inherit;
96
+ border-top-right-radius: inherit;
97
+ }
98
+
99
+ .root thead tr:first-child th:first-child {
100
+ border-top-left-radius: inherit;
101
+ }
102
+
103
+ .root thead tr:first-child th:last-child {
104
+ border-top-right-radius: inherit;
105
+ }
106
+
107
+ .root tbody:last-child,
108
+ .root tbody:last-child tr:last-child {
109
+ border-bottom-left-radius: inherit;
110
+ border-bottom-right-radius: inherit;
111
+ }
112
+
113
+ .root tbody:last-child tr:last-child th:first-child,
114
+ .root tbody:last-child tr:last-child td:first-child {
115
+ border-bottom-left-radius: inherit;
116
+ }
117
+
118
+ .root tbody:last-child tr:last-child td:last-child {
119
+ border-bottom-right-radius: inherit;
120
+ }
121
+
92
122
  /* compact variation */
93
123
  .compact td,
94
124
  .compact th {
@@ -42,7 +42,7 @@ a.root:active {
42
42
  /** Size variation */
43
43
  /** default: medium */
44
44
  .root {
45
- border-radius: var(--radius-medium);
45
+ border-radius: var(--radius-small);
46
46
  padding: calc(var(--space-xxxsmall) / 2) var(--space-xxxsmall);
47
47
  min-width: var(--space-small);
48
48
  height: var(--space-small);
@@ -51,7 +51,7 @@ a.root:active {
51
51
  }
52
52
 
53
53
  .small {
54
- border-radius: var(--radius-small);
54
+ border-radius: var(--radius-xsmall);
55
55
  padding: calc(var(--space-xxxsmall) / 2);
56
56
  height: var(--space-xsmall);
57
57
  min-width: var(--space-xsmall);
@@ -60,7 +60,7 @@ a.root:active {
60
60
  }
61
61
 
62
62
  .large {
63
- border-radius: var(--radius-large);
63
+ border-radius: var(--radius-medium);
64
64
  padding: var(--space-xxxsmall) var(--space-xxsmall);
65
65
  min-width: var(--space-medium);
66
66
  height: var(--space-medium);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bundle-stats/ui",
3
- "version": "4.13.0-beta.11",
3
+ "version": "4.13.0-beta.13",
4
4
  "description": "UI components for BundleStats projects.",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",
@@ -43,7 +43,7 @@
43
43
  "@storybook/react": "7.6.17",
44
44
  "@storybook/react-webpack5": "7.6.17",
45
45
  "@types/d3": "7.4.3",
46
- "@types/react": "18.2.77",
46
+ "@types/react": "18.2.78",
47
47
  "@types/react-router-dom": "5.3.3",
48
48
  "babel-plugin-require-context-hook": "1.0.0",
49
49
  "classnames": "2.5.1",
@@ -73,12 +73,12 @@
73
73
  "react-router-dom": "^5.0.0"
74
74
  },
75
75
  "dependencies": {
76
- "@bundle-stats/utils": "4.13.0-beta.11",
76
+ "@bundle-stats/utils": "4.13.0-beta.13",
77
77
  "ariakit": "2.0.0-next.44",
78
78
  "d3": "^7.8.5",
79
79
  "modern-css-reset": "1.4.0",
80
80
  "react-use": "^17.5.0",
81
81
  "use-query-params": "2.2.1"
82
82
  },
83
- "gitHead": "e128789009e036ad306e3fb6095137b91b56111f"
83
+ "gitHead": "d906df430d706514c91458bdd363be9e9dc3e74e"
84
84
  }
@@ -22,6 +22,14 @@ import { MetricsTableHeader } from '../metrics-table-header';
22
22
  import { MetricsTreemap } from '../metrics-treemap';
23
23
  import { ComponentLink } from '../component-link';
24
24
 
25
+ const metricsTableTitle = (
26
+ <MetricsTableTitle
27
+ title={I18N.ASSET_TOTALS}
28
+ popoverInfo={I18N.ASSET_TOTALS_INFO}
29
+ popoverHref={config.documentation.assets}
30
+ />
31
+ );
32
+
25
33
  export const BundleAssetsTotals = ({
26
34
  className,
27
35
  jobs,
@@ -32,18 +40,21 @@ export const BundleAssetsTotals = ({
32
40
  const [displayType, setDisplayType] = useMetricsDisplayType();
33
41
  const history = useHistory();
34
42
 
35
- const items = webpack.compareBySection.sizes(jobs);
43
+ const items = useMemo(() => webpack.compareBySection.sizes(jobs), [jobs]);
36
44
 
37
- const renderRowHeader = (item) => {
38
- const fileType = ASSETS_SIZES_FILE_TYPE_MAP[item.key];
39
- const { section, title, params } = getBundleAssetsFileTypeComponentLink(fileType, item.label);
45
+ const renderRowHeader = useCallback(
46
+ (item) => {
47
+ const fileType = ASSETS_SIZES_FILE_TYPE_MAP[item.key];
48
+ const { section, title, params } = getBundleAssetsFileTypeComponentLink(fileType, item.label);
40
49
 
41
- return (
42
- <CustomComponentLink section={section} title={title} params={params}>
43
- {item.label}
44
- </CustomComponentLink>
45
- );
46
- };
50
+ return (
51
+ <CustomComponentLink section={section} title={title} params={params}>
52
+ {item.label}
53
+ </CustomComponentLink>
54
+ );
55
+ },
56
+ [CustomComponentLink],
57
+ );
47
58
 
48
59
  const handleMetricsTreemapItemClick = useCallback(
49
60
  (entryId) => {
@@ -57,17 +68,6 @@ export const BundleAssetsTotals = ({
57
68
  [history],
58
69
  );
59
70
 
60
- const metricsTableTitle = useMemo(
61
- () => (
62
- <MetricsTableTitle
63
- title={I18N.ASSET_TOTALS}
64
- popoverInfo={I18N.ASSET_TOTALS_INFO}
65
- popoverHref={config.documentation.assets}
66
- />
67
- ),
68
- [],
69
- );
70
-
71
71
  return (
72
72
  <Stack space="xsmall" as="section" className={className}>
73
73
  <Toolbar
@@ -89,7 +89,12 @@ export const BundleAssetsTotals = ({
89
89
  {displayType === MetricsDisplayType.TREEMAP && (
90
90
  <>
91
91
  <Table compact>
92
- <MetricsTableHeader metricTitle={metricsTableTitle} showSum jobs={jobs} rows={items} />
92
+ <MetricsTableHeader
93
+ metricTitle={metricsTableTitle}
94
+ showSum
95
+ jobs={jobs}
96
+ rows={items}
97
+ />
93
98
  </Table>
94
99
  <MetricsTreemap
95
100
  items={items}
@@ -22,7 +22,7 @@
22
22
  }
23
23
 
24
24
  /** Leaf wrapper button */
25
- .leaf {
25
+ .tile {
26
26
  position: absolute;
27
27
  appearance: none;
28
28
  border: 0;
@@ -35,9 +35,10 @@
35
35
  font-size: var(--size-small);
36
36
  line-height: var(--line-height-heading);
37
37
  text-align: left;
38
+ transition: var(--ui-transition-out);
38
39
  }
39
40
 
40
- .leaf::before {
41
+ .tile::before {
41
42
  content: "";
42
43
  display: block;
43
44
  position: absolute;
@@ -47,18 +48,22 @@
47
48
  width: 100%;
48
49
  height: 100%;
49
50
  background-color: currentColor;
50
- color: var(--color-background);
51
+ color: var(--color-highlight);
51
52
  transition: var(--ui-transition-out);
52
53
  transition-property: opacity;
53
- opacity: 0.6;
54
+ opacity: 0.75;
54
55
  }
55
56
 
56
- .leaf:hover::before {
57
+ .tile:hover {
57
58
  transition: var(--ui-transition-in);
58
- opacity: 0.4;
59
59
  }
60
60
 
61
- .leafContent {
61
+ .tile:hover::before {
62
+ transition: var(--ui-transition-in);
63
+ opacity: 0.5;
64
+ }
65
+
66
+ .tileContent {
62
67
  position: relative;
63
68
  z-index: 1;
64
69
  width: 100%;
@@ -71,8 +76,8 @@
71
76
  line-height: var(--line-height-heading);
72
77
  }
73
78
 
74
- /** Align label to other elements on the first column leafs */
75
- .leafFirstCol .leafContent {
79
+ /** Align label to other elements on the first column cells */
80
+ .tileFirstCol .tileContent {
76
81
  padding-left: var(--space-small);
77
82
  }
78
83
 
@@ -100,51 +105,51 @@
100
105
  }
101
106
 
102
107
  /** Tile size variation */
103
- .leafSmall .leafContent {
108
+ .tileSmall .tileContent {
104
109
  padding: var(--space-xxxsmall) var(--space-xxsmall);
105
110
  gap: 0;
106
111
  font-size: var(--size-xsmall);
107
112
  }
108
113
 
109
- .leafSmall .leadContentLabel {
114
+ .tileSmall .leadContentLabel {
110
115
  margin-top: 0;
111
116
  }
112
117
 
113
118
  /** Tile diff variation */
114
- .leaf-NO_CHANGE {
119
+ .tile-NO_CHANGE {
115
120
  color: var(--color-text-light);
116
121
  }
117
122
 
118
- .leaf-NO_CHANGE::before {
123
+ .tile-NO_CHANGE::before {
119
124
  color: var(--color-gray-50);
120
125
  opacity: 0.4;
121
126
  }
122
127
 
123
- .leaf-NO_CHANGE:hover::before {
128
+ .tile-NO_CHANGE:hover::before {
124
129
  opacity: 0.2;
125
130
  }
126
131
 
127
- .leaf-HIGH_NEGATIVE::before {
132
+ .tile-HIGH_NEGATIVE::before {
128
133
  color: var(--color-red-100);
129
134
  }
130
135
 
131
- .leaf-NEGATIVE::before {
136
+ .tile-NEGATIVE::before {
132
137
  color: var(--color-red-50);
133
138
  }
134
139
 
135
- .leaf-LOW_NEGATIVE::before {
140
+ .tile-LOW_NEGATIVE::before {
136
141
  color: var(--color-red-25);
137
142
  }
138
143
 
139
- .leaf-LOW_POSITIVE::before {
144
+ .tile-LOW_POSITIVE::before {
140
145
  color: var(--color-green-25);
141
146
  }
142
147
 
143
- .leaf-POSITIVE::before {
148
+ .tile-POSITIVE::before {
144
149
  color: var(--color-green-50);
145
150
  }
146
151
 
147
- .leaf-HIGH_POSITIVE::before {
152
+ .tile-HIGH_POSITIVE::before {
148
153
  color: var(--color-green-100);
149
154
  }
150
155
 
@@ -166,7 +171,7 @@
166
171
  }
167
172
 
168
173
  /** tooltip */
169
- .leafContentTooltipAnchor {
174
+ .tileContentTooltipAnchor {
170
175
  width: 100%;
171
176
  height: 100%;
172
177
  }
@@ -191,11 +196,11 @@ div[role="presentation"]:has(.tooltip) {
191
196
  }
192
197
 
193
198
 
194
- .leafTooltipArrow svg {
199
+ .tileTooltipArrow svg {
195
200
  display: block;
196
201
  fill: var(--color-background) !important;
197
202
  }
198
203
 
199
- .leafTooltipContentTitle {
204
+ .tileTooltipContentTitle {
200
205
  font-size: var(--size-medium);
201
206
  }