@bundle-stats/ui 4.13.0-beta.0 → 4.13.0-beta.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 (54) hide show
  1. package/lib/components/bundle-assets/index.js +2 -2
  2. package/lib/components/bundle-assets/index.js.map +1 -1
  3. package/lib/components/bundle-modules/bundle-modules.js +4 -2
  4. package/lib/components/bundle-modules/bundle-modules.js.map +1 -1
  5. package/lib/components/bundle-modules/index.js +2 -2
  6. package/lib/components/bundle-modules/index.js.map +1 -1
  7. package/lib/components/bundle-packages/index.js +2 -2
  8. package/lib/components/bundle-packages/index.js.map +1 -1
  9. package/lib/components/metrics-display-selector/metrics-display-selector.js +2 -8
  10. package/lib/components/metrics-display-selector/metrics-display-selector.js.map +1 -1
  11. package/lib/components/metrics-treemap/metrics-treemap.js +68 -49
  12. package/lib/components/metrics-treemap/metrics-treemap.js.map +1 -1
  13. package/lib/components/metrics-treemap/metrics-treemap.module.css +58 -42
  14. package/lib/hooks/entry-info.js +12 -0
  15. package/lib/hooks/entry-info.js.map +1 -0
  16. package/lib/query-state.js +1 -1
  17. package/lib/query-state.js.map +1 -1
  18. package/lib/ui/button/button.module.css +1 -0
  19. package/lib-esm/components/bundle-assets/index.js +3 -3
  20. package/lib-esm/components/bundle-assets/index.js.map +1 -1
  21. package/lib-esm/components/bundle-modules/bundle-modules.js +4 -2
  22. package/lib-esm/components/bundle-modules/bundle-modules.js.map +1 -1
  23. package/lib-esm/components/bundle-modules/index.js +2 -2
  24. package/lib-esm/components/bundle-modules/index.js.map +1 -1
  25. package/lib-esm/components/bundle-packages/index.js +3 -3
  26. package/lib-esm/components/bundle-packages/index.js.map +1 -1
  27. package/lib-esm/components/metrics-display-selector/metrics-display-selector.js +2 -8
  28. package/lib-esm/components/metrics-display-selector/metrics-display-selector.js.map +1 -1
  29. package/lib-esm/components/metrics-treemap/metrics-treemap.js +71 -51
  30. package/lib-esm/components/metrics-treemap/metrics-treemap.js.map +1 -1
  31. package/lib-esm/components/metrics-treemap/metrics-treemap.module.css +58 -42
  32. package/lib-esm/hooks/entry-info.js +8 -0
  33. package/lib-esm/hooks/entry-info.js.map +1 -0
  34. package/lib-esm/query-state.js +1 -1
  35. package/lib-esm/query-state.js.map +1 -1
  36. package/lib-esm/ui/button/button.module.css +1 -0
  37. package/package.json +7 -9
  38. package/src/components/bundle-assets/index.jsx +8 -3
  39. package/src/components/bundle-modules/bundle-modules.tsx +4 -2
  40. package/src/components/bundle-modules/index.tsx +2 -2
  41. package/src/components/bundle-packages/index.jsx +8 -3
  42. package/src/components/metrics-display-selector/metrics-display-selector.tsx +4 -8
  43. package/src/components/metrics-treemap/metrics-treemap.module.css +58 -42
  44. package/src/components/metrics-treemap/metrics-treemap.tsx +141 -105
  45. package/src/hooks/entry-info.ts +19 -0
  46. package/src/query-state.tsx +1 -1
  47. package/src/ui/button/button.module.css +1 -0
  48. package/types/hooks/entry-info.d.ts +8 -0
  49. package/lib/hooks/show-entry.js +0 -13
  50. package/lib/hooks/show-entry.js.map +0 -1
  51. package/lib-esm/hooks/show-entry.js +0 -9
  52. package/lib-esm/hooks/show-entry.js.map +0 -1
  53. package/src/hooks/show-entry.ts +0 -17
  54. package/types/hooks/show-entry.d.ts +0 -10
@@ -12,6 +12,7 @@
12
12
  height: 100%;
13
13
  fill: var(--color-text);
14
14
  font-family: var(--font-family);
15
+ background: var(--color-background);
15
16
  }
16
17
 
17
18
  /** Tile overlay fill background transition */
@@ -20,29 +21,27 @@
20
21
  transition-property: opacity;
21
22
  }
22
23
 
23
- .tileOverlay {
24
- fill: var(--color-outline);
24
+ .leafBackdrop {
25
+ fill: var(--color-background);
25
26
  transition: var(--ui-transition-out);
26
27
  transition-property: opacity;
27
- opacity: 0.4;
28
+ opacity: 0.6;
28
29
  }
29
30
 
30
- .root .tile:hover .tileOverlay {
31
+ .leaf:hover .leafBackdrop {
31
32
  transition: var(--ui-transition-in);
32
- opacity: 0.8;
33
+ opacity: 0.4;
33
34
  }
34
35
 
35
- /** Tile content */
36
- .tileContent {
36
+ /** Leaf wrapper button */
37
+ .leafAction {
37
38
  appearance: none;
38
39
  border: 0;
39
- border-radius: none;
40
+ border-radius: 0;
40
41
  padding: 0;
41
42
  background: none;
42
-
43
43
  width: 100%;
44
44
  height: 100%;
45
- padding: var(--space-xxsmall) var(--space-small);
46
45
  display: flex;
47
46
  align-items: center;
48
47
  font-family: var(--font-family-fixed);
@@ -51,78 +50,94 @@
51
50
  text-align: left;
52
51
  }
53
52
 
54
- .tileContentWrapper {
53
+ .leafContent {
55
54
  width: 100%;
56
- max-height: 100%;
55
+ height: 100%;
57
56
  display: flex;
58
57
  flex-flow: column;
59
- gap: 4px;
58
+ justify-content: center;
59
+ padding: var(--space-xxsmall) var(--space-xxsmall);
60
+ gap: var(--space-xxxsmall);
61
+ line-height: var(--line-height-heading);
62
+ }
63
+
64
+ /** Align label to other elements on the first column leafs */
65
+ .leafWrapper[x="0"] .leafContent {
66
+ padding-left: var(--space-small);
60
67
  }
61
68
 
62
- .tileContentLabel {
63
- margin-right: calc(0px - var(--space-xxsmall)); /* take more space if necessary */
64
- margin-bottom: calc(0px - 2px);
65
- flex: 1 1 auto;
66
- max-width: calc(100% + var(--space-xxsmall)); /* take more space if necessary */
69
+ .leadContentLabel {
70
+ flex: 0 1 auto;
71
+ width: 100%;
72
+ min-width: 0;
73
+ max-height: calc(2em * var(--line-height-heading));
67
74
  overflow: hidden;
68
- word-break: break-word;
69
75
  }
70
76
 
71
- .tileContentValue {
77
+ .leadContentValue {
72
78
  flex: 0 0 auto;
73
79
  max-width: calc(100% + var(--space-xxsmall));
74
- margin-right: calc(0px - var(--space-xxsmall)); /* take more space if necessary */
75
80
  white-space: nowrap;
76
81
  overflow: hidden;
77
82
  }
78
83
 
79
- .tileContentMetric {
84
+ .leadContentMetric {
80
85
  font-weight: bold;
81
86
  }
82
87
 
83
- .tileContentDelta {
88
+ .leadContentDelta {
84
89
  margin-left: var(--space-xxxsmall);
85
90
  }
86
91
 
87
92
  /** Tile size variation */
88
- .tileSmall .tileContent {
93
+ .leafSmall .leafContent {
94
+ padding: var(--space-xxxsmall) var(--space-xxsmall);
95
+ gap: 0;
89
96
  font-size: var(--size-xsmall);
90
97
  }
91
98
 
92
- .tileSmall .tileContentLabel {
99
+ .leafSmall .leadContentLabel {
93
100
  margin-top: 0;
94
101
  }
95
102
 
96
103
  /** Tile diff variation */
97
- .tile-NO_CHANGE .tileContent {
104
+ .leaf-NO_CHANGE .leafBackdrop {
105
+ fill: var(--color-gray-50);
106
+ opacity: 0.4;
107
+ }
108
+
109
+ .leaf-NO_CHANGE:hover .leafBackdrop {
110
+ opacity: 0.2;
111
+ }
112
+
113
+ .leaf-NO_CHANGE .leafAction {
98
114
  color: var(--color-text-light);
99
115
  }
100
116
 
101
- .tile-HIGH_NEGATIVE .tileOverlay {
117
+ .leaf-HIGH_NEGATIVE .leafBackdrop {
102
118
  fill: var(--color-red-100);
103
119
  }
104
120
 
105
- .tile-NEGATIVE .tileOverlay {
121
+ .leaf-NEGATIVE .leafBackdrop {
106
122
  fill: var(--color-red-50);
107
123
  }
108
124
 
109
- .tile-LOW_NEGATIVE .tileOverlay {
125
+ .leaf-LOW_NEGATIVE .leafBackdrop {
110
126
  fill: var(--color-red-25);
111
127
  }
112
128
 
113
- .tile-LOW_POSITIVE .tileOverlay {
129
+ .leaf-LOW_POSITIVE .leafBackdrop {
114
130
  fill: var(--color-green-25);
115
131
  }
116
132
 
117
- .tile-POSITIVE .tileOverlay {
133
+ .leaf-POSITIVE .leafBackdrop {
118
134
  fill: var(--color-green-50);
119
135
  }
120
136
 
121
- .tile-HIGH_POSITIVE .tileOverlay {
137
+ .leaf-HIGH_POSITIVE .leafBackdrop {
122
138
  fill: var(--color-green-100);
123
139
  }
124
140
 
125
-
126
141
  /** empty message */
127
142
  .emptyMessage {
128
143
  position: absolute;
@@ -140,7 +155,12 @@
140
155
  text-align: center;
141
156
  }
142
157
 
143
- /** tooltip content */
158
+ /** tooltip */
159
+ .leafContentTooltipAnchor {
160
+ width: 100%;
161
+ height: 100%;
162
+ }
163
+
144
164
  .tooltip {
145
165
  z-index: var(--layer-xxhigh);
146
166
  padding: var(--space-xsmall) var(--space-small);
@@ -154,15 +174,11 @@
154
174
  font-size: var(--size-small);
155
175
  }
156
176
 
157
- .tooltipArrow {
158
- border: var(--space-xxsmall) solid var(--color-background);
159
- border-width: var(--space-xxsmall) var(--space-xxsmall) 0;
160
- border-left-color: transparent;
161
- border-right-color: transparent;
162
- position: absolute;
163
- top: 100%;
177
+ .leafTooltipArrow svg {
178
+ display: block;
179
+ fill: var(--color-background) !important;
164
180
  }
165
181
 
166
- .tooltipContentTitle {
182
+ .leafTooltipContentTitle {
167
183
  font-size: var(--size-medium);
168
184
  }
@@ -0,0 +1,8 @@
1
+ import { useCallback } from 'react';
2
+ export function useEntryInfo(params) {
3
+ const { setState } = params;
4
+ const hideEntryInfo = useCallback(() => setState({ entryId: '' }), [setState]);
5
+ const showEntryInfo = useCallback((entryId) => setState({ entryId }), [setState]);
6
+ return [hideEntryInfo, showEntryInfo];
7
+ }
8
+ //# sourceMappingURL=entry-info.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-info.js","sourceRoot":"","sources":["../../src/hooks/entry-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAWpC,MAAM,UAAU,YAAY,CAAC,MAA0B;IACrD,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IAE5B,MAAM,aAAa,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC/E,MAAM,aAAa,GAAG,WAAW,CAAC,CAAC,OAAe,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE1F,OAAO,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;AACxC,CAAC"}
@@ -15,7 +15,7 @@ export const useComponentQueryState = (componentName) => {
15
15
  return;
16
16
  }
17
17
  setQueryState({ [componentName]: newState });
18
- }, [componentState]);
18
+ }, [componentState, setQueryState]);
19
19
  return [componentState, setState];
20
20
  };
21
21
  //# sourceMappingURL=query-state.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"query-state.js","sourceRoot":"","sources":["../src/query-state.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAM3D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAA8B,EAAE,EAAE,CAAC,CACpE,oBAAC,kBAAkB,IAAC,OAAO,EAAE,mBAAmB,KAAM,KAAK,GAAI,CAChE,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,aAAqB,EAAE,EAAE;IAC9D,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,cAAc,CAAC;QACjD,CAAC,aAAa,CAAC,EAAE,oBAAoB,CAAC,aAAa,CAAC;KACrD,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IAEjD,MAAM,QAAQ,GAAG,WAAW,CAC1B,CAAC,OAAgC,EAAE,EAAE;QACnC,MAAM,QAAQ,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,OAAO,EAAE,CAAC;QAGnD,IAAI,OAAO,CAAC,cAAc,EAAE,QAAQ,CAAC,EAAE;YACrC,OAAO;SACR;QAED,aAAa,CAAC,EAAE,CAAC,aAAa,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC/C,CAAC,EACD,CAAC,cAAc,CAAC,CACjB,CAAC;IAEF,OAAO,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;AACpC,CAAC,CAAC"}
1
+ {"version":3,"file":"query-state.js","sourceRoot":"","sources":["../src/query-state.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAM3D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAA8B,EAAE,EAAE,CAAC,CACpE,oBAAC,kBAAkB,IAAC,OAAO,EAAE,mBAAmB,KAAM,KAAK,GAAI,CAChE,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,aAAqB,EAAE,EAAE;IAC9D,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,cAAc,CAAC;QACjD,CAAC,aAAa,CAAC,EAAE,oBAAoB,CAAC,aAAa,CAAC;KACrD,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IAEjD,MAAM,QAAQ,GAAG,WAAW,CAC1B,CAAC,OAAgC,EAAE,EAAE;QACnC,MAAM,QAAQ,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,OAAO,EAAE,CAAC;QAGnD,IAAI,OAAO,CAAC,cAAc,EAAE,QAAQ,CAAC,EAAE;YACrC,OAAO;SACR;QAED,aAAa,CAAC,EAAE,CAAC,aAAa,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC/C,CAAC,EACD,CAAC,cAAc,EAAE,aAAa,CAAC,CAChC,CAAC;IAEF,OAAO,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;AACpC,CAAC,CAAC"}
@@ -256,6 +256,7 @@ a.root {
256
256
  .small .glyph {
257
257
  width: calc(var(--space-xsmall) + 2px);
258
258
  height: calc(var(--space-xsmall) + 2px);
259
+ margin: 1px; /* compensate to keep the same height when the text is not provided */
259
260
  }
260
261
 
261
262
  .medium {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bundle-stats/ui",
3
- "version": "4.13.0-beta.0",
3
+ "version": "4.13.0-beta.3",
4
4
  "description": "UI components for BundleStats projects.",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",
@@ -36,14 +36,14 @@
36
36
  },
37
37
  "homepage": "https://github.com/relative-ci/bundle-stats/blob/master/packages/ui#readme",
38
38
  "devDependencies": {
39
- "@babel/preset-env": "7.24.0",
40
- "@babel/preset-react": "7.23.3",
41
- "@babel/preset-typescript": "7.23.3",
39
+ "@babel/preset-env": "7.24.3",
40
+ "@babel/preset-react": "7.24.1",
41
+ "@babel/preset-typescript": "7.24.1",
42
42
  "@storybook/addon-essentials": "7.6.17",
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.64",
46
+ "@types/react": "18.2.67",
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,14 +73,12 @@
73
73
  "react-router-dom": "^5.0.0"
74
74
  },
75
75
  "dependencies": {
76
- "@bundle-stats/utils": "4.13.0-beta.0",
77
- "@floating-ui/react": "0.26.9",
78
- "@floating-ui/react-dom": "2.0.8",
76
+ "@bundle-stats/utils": "^4.13.0-beta.3",
79
77
  "ariakit": "2.0.0-next.44",
80
78
  "d3": "^7.8.5",
81
79
  "modern-css-reset": "1.4.0",
82
80
  "react-use": "^17.5.0",
83
81
  "use-query-params": "2.2.1"
84
82
  },
85
- "gitHead": "f8197677d480f9b0b2112456526c821f49ed5a7d"
83
+ "gitHead": "01131490d9a0d5e90c3010a384efb3121e41b53a"
86
84
  }
@@ -10,9 +10,14 @@ import {
10
10
  import { useRowsFilter } from '../../hooks/rows-filter';
11
11
  import { useRowsSort } from '../../hooks/rows-sort';
12
12
  import { useSearchParams } from '../../hooks/search-params';
13
- import { useShowEntry } from '../../hooks/show-entry';
13
+ import { useEntryInfo } from '../../hooks/entry-info';
14
14
  import { BundleAssets as BundleAssetsComponent } from './bundle-assets';
15
- import { addRowAssetFlags, addRowIsNotPredictive, getRowFilter, getCustomSort } from './bundle-assets.utils';
15
+ import {
16
+ addRowAssetFlags,
17
+ addRowIsNotPredictive,
18
+ getRowFilter,
19
+ getCustomSort,
20
+ } from './bundle-assets.utils';
16
21
 
17
22
  export const BundleAssets = (props) => {
18
23
  const { jobs, filters, search, setState, sortBy, direction, ...restProps } = props;
@@ -60,7 +65,7 @@ export const BundleAssets = (props) => {
60
65
  getCustomSort,
61
66
  });
62
67
 
63
- const { hideEntryInfo, showEntryInfo } = useShowEntry({ setState });
68
+ const [hideEntryInfo, showEntryInfo] = useEntryInfo({ setState });
64
69
 
65
70
  return (
66
71
  <BundleAssetsComponent
@@ -44,7 +44,9 @@ const RowHeader = (props: RowHeaderProps) => {
44
44
  return (
45
45
  <CustomComponentLink
46
46
  section={SECTIONS.MODULES}
47
- params={{ [COMPONENT.BUNDLE_MODULES]: { filters, search, entryId: row.key, moduleMetric } }}
47
+ params={{
48
+ [COMPONENT.BUNDLE_MODULES]: { filters, search, entryId: row.key, metric: moduleMetric },
49
+ }}
48
50
  className={css.name}
49
51
  >
50
52
  {row.duplicated && (
@@ -140,7 +142,7 @@ export const BundleModules = (props: BundleModulesProps) => {
140
142
  customComponentLink={CustomComponentLink}
141
143
  />
142
144
  ),
143
- [jobs, chunks, CustomComponentLink, filters, search],
145
+ [jobs, chunks, CustomComponentLink, filters, search, moduleMetric],
144
146
  );
145
147
 
146
148
  const emptyMessage = useMemo(
@@ -6,7 +6,7 @@ import type { SortAction } from '../../types';
6
6
  import { useRowsFilter } from '../../hooks/rows-filter';
7
7
  import { useRowsSort } from '../../hooks/rows-sort';
8
8
  import { useSearchParams } from '../../hooks/search-params';
9
- import { useShowEntry } from '../../hooks/show-entry';
9
+ import { useEntryInfo } from '../../hooks/entry-info';
10
10
  import { BundleModules as BaseComponent } from './bundle-modules';
11
11
  import {
12
12
  addRowFlags,
@@ -120,7 +120,7 @@ export const BundleModules = (props: BundleModulesProps) => {
120
120
  getCustomSort,
121
121
  });
122
122
 
123
- const { hideEntryInfo, showEntryInfo } = useShowEntry({ setState });
123
+ const [hideEntryInfo, showEntryInfo] = useEntryInfo({ setState });
124
124
 
125
125
  return (
126
126
  <BaseComponent
@@ -6,9 +6,14 @@ import * as webpack from '@bundle-stats/utils/lib-esm/webpack/compare';
6
6
  import { useRowsFilter } from '../../hooks/rows-filter';
7
7
  import { useRowsSort } from '../../hooks/rows-sort';
8
8
  import { useSearchParams } from '../../hooks/search-params';
9
- import { useShowEntry } from '../../hooks/show-entry';
9
+ import { useEntryInfo } from '../../hooks/entry-info';
10
10
  import { BundlePackages as BundlePackagesComponent } from './bundle-packages';
11
- import { getDuplicatePackages, getAddRowDuplicateFlag, getRowFilter, getCustomSort } from './bundle-packages.utils';
11
+ import {
12
+ getDuplicatePackages,
13
+ getAddRowDuplicateFlag,
14
+ getRowFilter,
15
+ getCustomSort,
16
+ } from './bundle-packages.utils';
12
17
 
13
18
  export const BundlePackages = (props) => {
14
19
  const { jobs, search, filters, setState, sortBy, direction, ...restProps } = props;
@@ -55,7 +60,7 @@ export const BundlePackages = (props) => {
55
60
  getCustomSort,
56
61
  });
57
62
 
58
- const { hideEntryInfo, showEntryInfo } = useShowEntry({ setState });
63
+ const [hideEntryInfo, showEntryInfo] = useEntryInfo({ setState });
59
64
 
60
65
  return (
61
66
  <BundlePackagesComponent
@@ -25,26 +25,22 @@ export const MetricsDisplaySelector = (
25
25
  active={value === MetricsDisplayType.TABLE}
26
26
  size="small"
27
27
  type="button"
28
+ glyph={Icon.ICONS.TABLE}
28
29
  onClick={() => onSelect(MetricsDisplayType.TABLE)}
29
30
  className={css.button}
30
31
  >
31
- <FlexStack space="xxxsmall" alignItems="center">
32
- <Icon glyph={Icon.ICONS.TABLE} className={css.icon} />
33
- <span>Table</span>
34
- </FlexStack>
32
+ Table
35
33
  </Button>
36
34
  <Button
37
35
  outline
38
36
  active={value === MetricsDisplayType.TREEMAP}
39
37
  size="small"
40
38
  type="button"
39
+ glyph={Icon.ICONS.TREEMAP}
41
40
  onClick={() => onSelect(MetricsDisplayType.TREEMAP)}
42
41
  className={cx(css.button)}
43
42
  >
44
- <FlexStack space="xxxsmall" alignItems="center">
45
- <Icon glyph={Icon.ICONS.TREEMAP} className={css.icon} />
46
- <span>Treemap</span>
47
- </FlexStack>
43
+ Treemap
48
44
  </Button>
49
45
  </FlexStack>
50
46
  );
@@ -12,6 +12,7 @@
12
12
  height: 100%;
13
13
  fill: var(--color-text);
14
14
  font-family: var(--font-family);
15
+ background: var(--color-background);
15
16
  }
16
17
 
17
18
  /** Tile overlay fill background transition */
@@ -20,29 +21,27 @@
20
21
  transition-property: opacity;
21
22
  }
22
23
 
23
- .tileOverlay {
24
- fill: var(--color-outline);
24
+ .leafBackdrop {
25
+ fill: var(--color-background);
25
26
  transition: var(--ui-transition-out);
26
27
  transition-property: opacity;
27
- opacity: 0.4;
28
+ opacity: 0.6;
28
29
  }
29
30
 
30
- .root .tile:hover .tileOverlay {
31
+ .leaf:hover .leafBackdrop {
31
32
  transition: var(--ui-transition-in);
32
- opacity: 0.8;
33
+ opacity: 0.4;
33
34
  }
34
35
 
35
- /** Tile content */
36
- .tileContent {
36
+ /** Leaf wrapper button */
37
+ .leafAction {
37
38
  appearance: none;
38
39
  border: 0;
39
- border-radius: none;
40
+ border-radius: 0;
40
41
  padding: 0;
41
42
  background: none;
42
-
43
43
  width: 100%;
44
44
  height: 100%;
45
- padding: var(--space-xxsmall) var(--space-small);
46
45
  display: flex;
47
46
  align-items: center;
48
47
  font-family: var(--font-family-fixed);
@@ -51,78 +50,94 @@
51
50
  text-align: left;
52
51
  }
53
52
 
54
- .tileContentWrapper {
53
+ .leafContent {
55
54
  width: 100%;
56
- max-height: 100%;
55
+ height: 100%;
57
56
  display: flex;
58
57
  flex-flow: column;
59
- gap: 4px;
58
+ justify-content: center;
59
+ padding: var(--space-xxsmall) var(--space-xxsmall);
60
+ gap: var(--space-xxxsmall);
61
+ line-height: var(--line-height-heading);
62
+ }
63
+
64
+ /** Align label to other elements on the first column leafs */
65
+ .leafWrapper[x="0"] .leafContent {
66
+ padding-left: var(--space-small);
60
67
  }
61
68
 
62
- .tileContentLabel {
63
- margin-right: calc(0px - var(--space-xxsmall)); /* take more space if necessary */
64
- margin-bottom: calc(0px - 2px);
65
- flex: 1 1 auto;
66
- max-width: calc(100% + var(--space-xxsmall)); /* take more space if necessary */
69
+ .leadContentLabel {
70
+ flex: 0 1 auto;
71
+ width: 100%;
72
+ min-width: 0;
73
+ max-height: calc(2em * var(--line-height-heading));
67
74
  overflow: hidden;
68
- word-break: break-word;
69
75
  }
70
76
 
71
- .tileContentValue {
77
+ .leadContentValue {
72
78
  flex: 0 0 auto;
73
79
  max-width: calc(100% + var(--space-xxsmall));
74
- margin-right: calc(0px - var(--space-xxsmall)); /* take more space if necessary */
75
80
  white-space: nowrap;
76
81
  overflow: hidden;
77
82
  }
78
83
 
79
- .tileContentMetric {
84
+ .leadContentMetric {
80
85
  font-weight: bold;
81
86
  }
82
87
 
83
- .tileContentDelta {
88
+ .leadContentDelta {
84
89
  margin-left: var(--space-xxxsmall);
85
90
  }
86
91
 
87
92
  /** Tile size variation */
88
- .tileSmall .tileContent {
93
+ .leafSmall .leafContent {
94
+ padding: var(--space-xxxsmall) var(--space-xxsmall);
95
+ gap: 0;
89
96
  font-size: var(--size-xsmall);
90
97
  }
91
98
 
92
- .tileSmall .tileContentLabel {
99
+ .leafSmall .leadContentLabel {
93
100
  margin-top: 0;
94
101
  }
95
102
 
96
103
  /** Tile diff variation */
97
- .tile-NO_CHANGE .tileContent {
104
+ .leaf-NO_CHANGE .leafBackdrop {
105
+ fill: var(--color-gray-50);
106
+ opacity: 0.4;
107
+ }
108
+
109
+ .leaf-NO_CHANGE:hover .leafBackdrop {
110
+ opacity: 0.2;
111
+ }
112
+
113
+ .leaf-NO_CHANGE .leafAction {
98
114
  color: var(--color-text-light);
99
115
  }
100
116
 
101
- .tile-HIGH_NEGATIVE .tileOverlay {
117
+ .leaf-HIGH_NEGATIVE .leafBackdrop {
102
118
  fill: var(--color-red-100);
103
119
  }
104
120
 
105
- .tile-NEGATIVE .tileOverlay {
121
+ .leaf-NEGATIVE .leafBackdrop {
106
122
  fill: var(--color-red-50);
107
123
  }
108
124
 
109
- .tile-LOW_NEGATIVE .tileOverlay {
125
+ .leaf-LOW_NEGATIVE .leafBackdrop {
110
126
  fill: var(--color-red-25);
111
127
  }
112
128
 
113
- .tile-LOW_POSITIVE .tileOverlay {
129
+ .leaf-LOW_POSITIVE .leafBackdrop {
114
130
  fill: var(--color-green-25);
115
131
  }
116
132
 
117
- .tile-POSITIVE .tileOverlay {
133
+ .leaf-POSITIVE .leafBackdrop {
118
134
  fill: var(--color-green-50);
119
135
  }
120
136
 
121
- .tile-HIGH_POSITIVE .tileOverlay {
137
+ .leaf-HIGH_POSITIVE .leafBackdrop {
122
138
  fill: var(--color-green-100);
123
139
  }
124
140
 
125
-
126
141
  /** empty message */
127
142
  .emptyMessage {
128
143
  position: absolute;
@@ -140,7 +155,12 @@
140
155
  text-align: center;
141
156
  }
142
157
 
143
- /** tooltip content */
158
+ /** tooltip */
159
+ .leafContentTooltipAnchor {
160
+ width: 100%;
161
+ height: 100%;
162
+ }
163
+
144
164
  .tooltip {
145
165
  z-index: var(--layer-xxhigh);
146
166
  padding: var(--space-xsmall) var(--space-small);
@@ -154,15 +174,11 @@
154
174
  font-size: var(--size-small);
155
175
  }
156
176
 
157
- .tooltipArrow {
158
- border: var(--space-xxsmall) solid var(--color-background);
159
- border-width: var(--space-xxsmall) var(--space-xxsmall) 0;
160
- border-left-color: transparent;
161
- border-right-color: transparent;
162
- position: absolute;
163
- top: 100%;
177
+ .leafTooltipArrow svg {
178
+ display: block;
179
+ fill: var(--color-background) !important;
164
180
  }
165
181
 
166
- .tooltipContentTitle {
182
+ .leafTooltipContentTitle {
167
183
  font-size: var(--size-medium);
168
184
  }