@bundle-stats/ui 3.2.5-beta.2 → 3.2.6-beta.2

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 (112) hide show
  1. package/CHANGELOG.md +22 -1
  2. package/lib/components/bundle-assets/bundle-assets.js +23 -13
  3. package/lib/components/bundle-assets/bundle-assets.module.css +18 -26
  4. package/lib/components/bundle-modules/bundle-modules.js +4 -5
  5. package/lib/components/bundle-packages/bundle-packages.js +14 -8
  6. package/lib/components/bundle-packages/bundle-packages.module.css +8 -12
  7. package/lib/components/delta/delta.module.css +1 -0
  8. package/lib/components/metrics-table-search/metrics-table-search.module.css +5 -4
  9. package/lib/components/metrics-table-title/metrics-table-title.js +9 -7
  10. package/lib/components/metrics-table-title/metrics-table-title.module.css +2 -0
  11. package/lib/components/module-info/module-info.module.css +1 -0
  12. package/lib/components/summary-item/summary-item.js +14 -17
  13. package/lib/components/summary-item/summary-item.module.css +1 -19
  14. package/lib/components/total-size-type-title/total-size-type-title.js +7 -3
  15. package/lib/css/variables.css +3 -3
  16. package/lib/hooks/search-params.js +6 -6
  17. package/lib/layout/box/box.module.css +9 -0
  18. package/lib/ui/dropdown/dropdown.js +16 -26
  19. package/lib/ui/dropdown/dropdown.module.css +11 -12
  20. package/lib/ui/dropdown/dropdown.stories.js +2 -9
  21. package/lib/ui/filters/filters.js +10 -5
  22. package/lib/ui/filters/filters.module.css +10 -0
  23. package/lib/ui/hover-card/hover-card.js +100 -0
  24. package/lib/ui/hover-card/hover-card.module.css +52 -0
  25. package/lib/ui/hover-card/hover-card.stories.js +56 -0
  26. package/lib/ui/hover-card/index.js +18 -0
  27. package/lib/ui/icon/icon.js +6 -6
  28. package/lib/ui/index.js +8 -8
  29. package/lib/ui/table/table.module.css +0 -4
  30. package/lib/ui/{popover → tag}/index.js +4 -4
  31. package/lib/ui/tag/tag.js +72 -0
  32. package/lib/ui/tag/tag.module.css +55 -0
  33. package/lib/ui/tag/tag.stories.js +38 -0
  34. package/lib/ui/tooltip/tooltip.js +10 -9
  35. package/lib/ui/tooltip/tooltip.module.css +1 -1
  36. package/lib-esm/components/bundle-assets/bundle-assets.js +22 -13
  37. package/lib-esm/components/bundle-assets/bundle-assets.module.css +18 -26
  38. package/lib-esm/components/bundle-modules/bundle-modules.js +4 -5
  39. package/lib-esm/components/bundle-packages/bundle-packages.js +13 -8
  40. package/lib-esm/components/bundle-packages/bundle-packages.module.css +8 -12
  41. package/lib-esm/components/delta/delta.module.css +1 -0
  42. package/lib-esm/components/metrics-table-search/metrics-table-search.module.css +5 -4
  43. package/lib-esm/components/metrics-table-title/metrics-table-title.js +8 -7
  44. package/lib-esm/components/metrics-table-title/metrics-table-title.module.css +2 -0
  45. package/lib-esm/components/module-info/module-info.module.css +1 -0
  46. package/lib-esm/components/summary-item/summary-item.js +13 -17
  47. package/lib-esm/components/summary-item/summary-item.module.css +1 -19
  48. package/lib-esm/components/total-size-type-title/total-size-type-title.js +6 -3
  49. package/lib-esm/css/variables.css +3 -3
  50. package/lib-esm/hooks/search-params.js +6 -6
  51. package/lib-esm/layout/box/box.module.css +9 -0
  52. package/lib-esm/ui/dropdown/dropdown.js +15 -25
  53. package/lib-esm/ui/dropdown/dropdown.module.css +11 -12
  54. package/lib-esm/ui/dropdown/dropdown.stories.js +2 -7
  55. package/lib-esm/ui/filters/filters.js +9 -4
  56. package/lib-esm/ui/filters/filters.module.css +10 -0
  57. package/lib-esm/ui/hover-card/hover-card.js +86 -0
  58. package/lib-esm/ui/hover-card/hover-card.module.css +52 -0
  59. package/lib-esm/ui/hover-card/hover-card.stories.js +35 -0
  60. package/lib-esm/ui/hover-card/index.js +1 -0
  61. package/lib-esm/ui/icon/icon.js +3 -3
  62. package/lib-esm/ui/index.js +1 -1
  63. package/lib-esm/ui/table/table.module.css +0 -4
  64. package/lib-esm/ui/tag/index.js +1 -0
  65. package/lib-esm/ui/tag/tag.js +45 -0
  66. package/lib-esm/ui/tag/tag.module.css +55 -0
  67. package/lib-esm/ui/tag/tag.stories.js +23 -0
  68. package/lib-esm/ui/tooltip/tooltip.js +10 -9
  69. package/lib-esm/ui/tooltip/tooltip.module.css +1 -1
  70. package/package.json +9 -9
  71. package/src/components/bundle-assets/bundle-assets.jsx +61 -42
  72. package/src/components/bundle-assets/bundle-assets.module.css +18 -26
  73. package/src/components/bundle-modules/bundle-modules.jsx +24 -14
  74. package/src/components/bundle-packages/bundle-packages.jsx +21 -8
  75. package/src/components/bundle-packages/bundle-packages.module.css +8 -12
  76. package/src/components/delta/delta.module.css +1 -0
  77. package/src/components/metrics-table-search/metrics-table-search.module.css +5 -4
  78. package/src/components/metrics-table-title/metrics-table-title.jsx +20 -21
  79. package/src/components/metrics-table-title/metrics-table-title.module.css +2 -0
  80. package/src/components/module-info/module-info.jsx +1 -5
  81. package/src/components/module-info/module-info.module.css +1 -0
  82. package/src/components/summary-item/summary-item.jsx +20 -26
  83. package/src/components/summary-item/summary-item.module.css +1 -19
  84. package/src/components/total-size-type-title/total-size-type-title.jsx +6 -9
  85. package/src/css/variables.css +3 -3
  86. package/src/hooks/search-params.js +18 -11
  87. package/src/layout/box/box.module.css +9 -0
  88. package/src/ui/dropdown/dropdown.jsx +12 -22
  89. package/src/ui/dropdown/dropdown.module.css +11 -12
  90. package/src/ui/filters/filters.jsx +53 -50
  91. package/src/ui/filters/filters.module.css +10 -0
  92. package/src/ui/hover-card/hover-card.jsx +79 -0
  93. package/src/ui/hover-card/hover-card.module.css +52 -0
  94. package/src/ui/hover-card/index.js +1 -0
  95. package/src/ui/icon/icon.jsx +11 -7
  96. package/src/ui/index.js +1 -1
  97. package/src/ui/table/table.module.css +0 -4
  98. package/src/ui/tag/index.js +1 -0
  99. package/src/ui/tag/tag.jsx +49 -0
  100. package/src/ui/tag/tag.module.css +55 -0
  101. package/src/ui/tooltip/tooltip.jsx +10 -14
  102. package/src/ui/tooltip/tooltip.module.css +1 -1
  103. package/lib/ui/popover/popover.js +0 -92
  104. package/lib/ui/popover/popover.module.css +0 -66
  105. package/lib/ui/popover/popover.stories.js +0 -26
  106. package/lib-esm/ui/popover/index.js +0 -1
  107. package/lib-esm/ui/popover/popover.js +0 -71
  108. package/lib-esm/ui/popover/popover.module.css +0 -66
  109. package/lib-esm/ui/popover/popover.stories.js +0 -14
  110. package/src/ui/popover/index.js +0 -1
  111. package/src/ui/popover/popover.jsx +0 -79
  112. package/src/ui/popover/popover.module.css +0 -66
@@ -2,15 +2,21 @@ import React, { useMemo } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import cx from 'classnames';
4
4
  import { get, map } from 'lodash';
5
- import { ASSET_ENTRY_TYPE, ASSET_FILE_TYPE, ASSET_FILTERS, FILE_TYPE_LABELS } from '@bundle-stats/utils';
5
+ import {
6
+ ASSET_ENTRY_TYPE,
7
+ ASSET_FILE_TYPE,
8
+ ASSET_FILTERS,
9
+ FILE_TYPE_LABELS,
10
+ } from '@bundle-stats/utils';
6
11
 
7
12
  import config from '../../config.json';
8
13
  import I18N from '../../i18n';
9
14
  import { FlexStack } from '../../layout/flex-stack';
10
15
  import { Icon } from '../../ui/icon';
11
16
  import { FileName } from '../../ui/file-name';
12
- import { Popover } from '../../ui/popover';
17
+ import { HoverCard } from '../../ui/hover-card';
13
18
  import { Tooltip } from '../../ui/tooltip';
19
+ import { Tag } from '../../ui/tag';
14
20
  import { Filters } from '../../ui/filters';
15
21
  import { SortDropdown } from '../../ui/sort-dropdown';
16
22
  import { EmptySet } from '../../ui/empty-set';
@@ -71,47 +77,60 @@ TooltipNotPredictive.propTypes = {
71
77
  runs: PropTypes.array, // eslint-disable-line react/forbid-prop-types
72
78
  };
73
79
 
74
- const getRenderRowHeader = ({ labels, CustomComponentLink, chunks }) => (item) => {
75
- const { label, isNotPredictive, runs, isChunk, isEntry, isInitial } = item;
80
+ const getRenderRowHeader =
81
+ ({ labels, CustomComponentLink, chunks }) =>
82
+ (item) => {
83
+ const { label, isNotPredictive, runs, isChunk, isEntry, isInitial } = item;
76
84
 
77
- return (
78
- <Popover
79
- label={<FileName name={label} />}
80
- icon={
81
- <div className={css.assetInfoFlags}>
82
- {isNotPredictive && (
83
- <Tooltip className={css.notPredictive} title={<TooltipNotPredictive runs={runs} />}>
84
- <Icon className={css.notPredictiveIcon} glyph="warning" />
85
- </Tooltip>
86
- )}
87
- {isChunk && (
88
- <span title="Chunk" className={css.flagChunk}>
89
- c
90
- </span>
91
- )}
92
- {isEntry && (
93
- <span title="Entrypoint" className={css.flagEntry}>
94
- e
95
- </span>
96
- )}
97
- {isInitial && (
98
- <span title="Initial" className={css.flagInitial}>
99
- i
100
- </span>
101
- )}
102
- </div>
103
- }
104
- >
105
- <AssetInfo
106
- className={css.assetInfo}
107
- item={item}
108
- labels={labels}
109
- chunks={chunks}
110
- CustomComponentLink={CustomComponentLink}
111
- />
112
- </Popover>
113
- );
114
- };
85
+ return (
86
+ <HoverCard
87
+ label={
88
+ <FlexStack space="xxxsmall" className={css.assetName}>
89
+ <div className={css.assetInfoFlags}>
90
+ {isNotPredictive && (
91
+ <Tooltip className={css.notPredictive} title={<TooltipNotPredictive runs={runs} />}>
92
+ <Icon className={css.notPredictiveIcon} glyph="warning" />
93
+ </Tooltip>
94
+ )}
95
+ {isChunk && (
96
+ <Tag
97
+ title="Chunk"
98
+ size={Tag.SIZES.SMALL}
99
+ kind={Tag.KINDS.INFO}
100
+ className={cx(css.tag, css.tagChunk)}
101
+ />
102
+ )}
103
+ {isEntry && (
104
+ <Tag
105
+ title="Entrypoint"
106
+ size={Tag.SIZES.SMALL}
107
+ kind={Tag.KINDS.INFO}
108
+ className={cx(css.tag, css.tagEntry)}
109
+ />
110
+ )}
111
+ {isInitial && (
112
+ <Tag
113
+ title="Initial"
114
+ size={Tag.SIZES.SMALL}
115
+ kind={Tag.KINDS.INFO}
116
+ className={cx(css.tag, css.tagInitial)}
117
+ />
118
+ )}
119
+ </div>
120
+ <FileName name={label} />
121
+ </FlexStack>
122
+ }
123
+ >
124
+ <AssetInfo
125
+ className={css.assetInfo}
126
+ item={item}
127
+ labels={labels}
128
+ chunks={chunks}
129
+ CustomComponentLink={CustomComponentLink}
130
+ />
131
+ </HoverCard>
132
+ );
133
+ };
115
134
 
116
135
  export const BundleAssets = (props) => {
117
136
  const {
@@ -8,6 +8,11 @@
8
8
  margin-right: -1px; /** collapse border */
9
9
  }
10
10
 
11
+ .assetName {
12
+ display: inline-flex;
13
+ align-items: center;
14
+ }
15
+
11
16
  .notPredictive {
12
17
  margin-right: var(--space-xxsmall);
13
18
  display: inline-block;
@@ -30,41 +35,28 @@
30
35
  display: none;
31
36
  }
32
37
 
33
- .flag {
34
- display: inline-block;
35
- width: var(--space-xsmall);
36
- height: var(--space-xsmall);
37
- font-family: var(--font-family);
38
- font-size: 8px;
39
- font-weight: bold;
40
- background: var(--color-highlight);
41
- color: var(--color-text-light);
42
- line-height: var(--space-xsmall);
43
- text-align: center;
44
- text-transform: uppercase;
45
- vertical-align: middle;
46
- }
47
-
48
- .flag + .flag {
38
+ .tag + .tag {
49
39
  margin-left: 2px;
50
40
  }
51
41
 
52
- .flagEntry {
53
- composes: flag;
42
+ .tagEntry {
54
43
  background: var(--color-info-light);
55
- color: var(--color-background);
56
44
  }
57
45
 
58
- .flagInitial {
59
- composes: flag;
46
+ .tagEntry::before {
47
+ content: 'e';
48
+ }
49
+
50
+ .tagInitial {
60
51
  background: var(--color-info-light);
61
- color: var(--color-background);
62
52
  }
63
53
 
64
- .flagChunk {
65
- composes: flag;
66
- background: var(--color-info);
67
- color: var(--color-background);
54
+ .tagInitial::before {
55
+ content: 'i';
56
+ }
57
+
58
+ .tagChunk::before {
59
+ content: 'c';
68
60
  }
69
61
 
70
62
  /* Tooltip not predictive */
@@ -18,7 +18,7 @@ import { FlexStack } from '../../layout/flex-stack';
18
18
  import { EmptySet } from '../../ui/empty-set';
19
19
  import { FileName } from '../../ui/file-name';
20
20
  import { Filters } from '../../ui/filters';
21
- import { Popover } from '../../ui/popover';
21
+ import { HoverCard } from '../../ui/hover-card';
22
22
  import { SortDropdown } from '../../ui/sort-dropdown';
23
23
  import { Toolbar } from '../../ui/toolbar';
24
24
  import { MetricsTable } from '../metrics-table';
@@ -37,11 +37,11 @@ const RowHeader = ({ row, chunks, labels, CustomComponentLink }) => {
37
37
 
38
38
  return (
39
39
  <div onMouseEnter={handleOnMouseEnter}>
40
- {!showPopopver ?
40
+ {!showPopopver ? (
41
41
  content
42
- : (
43
- <Popover ariaLabel="View module info" label={content}>
44
- {({ popoverToggle }) => (
42
+ ) : (
43
+ <HoverCard label={content}>
44
+ {({ close }) => (
45
45
  <ModuleInfo
46
46
  className={css.namePopover}
47
47
  item={row}
@@ -49,10 +49,10 @@ const RowHeader = ({ row, chunks, labels, CustomComponentLink }) => {
49
49
  chunkIds={chunkIds}
50
50
  labels={labels}
51
51
  customComponentLink={CustomComponentLink}
52
- onClick={popoverToggle}
52
+ onClick={close}
53
53
  />
54
54
  )}
55
- </Popover>
55
+ </HoverCard>
56
56
  )}
57
57
  </div>
58
58
  );
@@ -76,9 +76,17 @@ RowHeader.defaultProps = {
76
76
  chunks: [],
77
77
  };
78
78
 
79
- const getRenderRowHeader = ({ labels, chunks, CustomComponentLink }) => (row) => (
80
- <RowHeader row={row} chunks={chunks} labels={labels} CustomComponentLink={CustomComponentLink} />
81
- );
79
+ const getRenderRowHeader =
80
+ ({ labels, chunks, CustomComponentLink }) =>
81
+ (row) =>
82
+ (
83
+ <RowHeader
84
+ row={row}
85
+ chunks={chunks}
86
+ labels={labels}
87
+ CustomComponentLink={CustomComponentLink}
88
+ />
89
+ );
82
90
 
83
91
  export const BundleModules = ({
84
92
  className,
@@ -240,10 +248,12 @@ BundleModules.propTypes = {
240
248
  jobs: PropTypes.array, // eslint-disable-line react/forbid-prop-types
241
249
 
242
250
  /** Chunks data */
243
- chunks: PropTypes.arrayOf(PropTypes.shape({
244
- id: PropTypes.string,
245
- name: PropTypes.string,
246
- })).isRequired,
251
+ chunks: PropTypes.arrayOf(
252
+ PropTypes.shape({
253
+ id: PropTypes.string,
254
+ name: PropTypes.string,
255
+ }),
256
+ ).isRequired,
247
257
 
248
258
  /** total row count */
249
259
  totalRowCount: PropTypes.number,
@@ -1,4 +1,4 @@
1
- import React, {useCallback} from 'react';
1
+ import React, { useCallback } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import cx from 'classnames';
4
4
  import {
@@ -15,8 +15,9 @@ import { Stack } from '../../layout/stack';
15
15
  import { FlexStack } from '../../layout/flex-stack';
16
16
  import { EmptySet } from '../../ui/empty-set';
17
17
  import { Filters } from '../../ui/filters';
18
- import { Popover } from '../../ui/popover';
18
+ import { HoverCard } from '../../ui/hover-card';
19
19
  import { SortDropdown } from '../../ui/sort-dropdown';
20
+ import { Tag } from '../../ui/tag';
20
21
  import { Toolbar } from '../../ui/toolbar';
21
22
  import { FileName } from '../../ui/file-name';
22
23
  import { ComponentLink } from '../component-link';
@@ -27,7 +28,8 @@ import { MetricsTableTitle } from '../metrics-table-title';
27
28
  import css from './bundle-packages.module.css';
28
29
 
29
30
  const PackagePopoverContent = ({ name, fullName, path, duplicate, CustomComponentLink }) => {
30
- const normalizedPackagePath = path || `node_modules/${fullName.split(PACKAGES_SEPARATOR).join('/node_modules/')}/`;
31
+ const normalizedPackagePath =
32
+ path || `node_modules/${fullName.split(PACKAGES_SEPARATOR).join('/node_modules/')}/`;
31
33
  const [normalizedName, packageId] = name.split(PACKAGE_ID_SEPARATOR);
32
34
 
33
35
  return (
@@ -105,13 +107,24 @@ const PackageRowHeader = ({ item, CustomComponentLink }) => {
105
107
  {packageNames.map((packageName, index) => {
106
108
  // Render duplicate flag only for the last entry
107
109
  const duplicateFlag = index === packageNames.length - 1 && item.duplicate && (
108
- <span className={css.duplicate} title="Duplicate package">
109
- D
110
- </span>
110
+ <Tag
111
+ title="Duplicate package"
112
+ kind={Tag.KINDS.DANGER}
113
+ size={Tag.SIZES.SMALL}
114
+ className={css.tagDuplicate}
115
+ />
111
116
  );
112
117
 
113
118
  return (
114
- <Popover className={css.packageName} icon={duplicateFlag} label={packageName}>
119
+ <HoverCard
120
+ className={css.packageName}
121
+ label={
122
+ <FlexStack space="xxxsmall" className={css.packageNameLabel}>
123
+ {duplicateFlag}
124
+ <span>{packageName}</span>
125
+ </FlexStack>
126
+ }
127
+ >
115
128
  <PackagePopoverContent
116
129
  name={packageName}
117
130
  path={path}
@@ -119,7 +132,7 @@ const PackageRowHeader = ({ item, CustomComponentLink }) => {
119
132
  duplicate={item.duplicate}
120
133
  CustomComponentLink={CustomComponentLink}
121
134
  />
122
- </Popover>
135
+ </HoverCard>
123
136
  );
124
137
  })}
125
138
  </span>
@@ -12,20 +12,12 @@
12
12
  margin-right: -1px; /** collapse border */
13
13
  }
14
14
 
15
- .duplicate {
15
+ .tagDuplicate {
16
16
  margin-right: var(--space-xxxsmall);
17
- display: inline-block;
18
- width: var(--space-small);
19
- height: var(--space-small);
20
- font-size: 10px;
21
- font-weight: bold;
22
- line-height: var(--space-small);
23
- text-align: center;
24
- text-transform: uppercase;
25
- vertical-align: middle;
17
+ }
26
18
 
27
- background: var(--color-danger);
28
- color: var(--color-light);
19
+ .tagDuplicate::before {
20
+ content: 'd';
29
21
  }
30
22
 
31
23
  .packageName {
@@ -43,6 +35,10 @@
43
35
  color: var(--color-text-ultra-light);
44
36
  }
45
37
 
38
+ .packageNameLabel {
39
+ align-items: center;
40
+ }
41
+
46
42
  .packagePopover {
47
43
  min-width: 320px;
48
44
  }
@@ -28,6 +28,7 @@
28
28
  }
29
29
 
30
30
  .inverted {
31
+ border-radius: var(--radius-small);
31
32
  background-color: var(--color-gray-ultra-light);
32
33
  color: var(--color-light);
33
34
  }
@@ -5,6 +5,7 @@
5
5
  }
6
6
 
7
7
  .input {
8
+ border-radius: var(--radius-small) 0 0 var(--radius-small);
8
9
  height: var(--space-large);
9
10
  border-color: var(--color-outline);
10
11
  }
@@ -21,12 +22,12 @@
21
22
  cursor: pointer;
22
23
  border-radius: 50%;
23
24
  position: absolute;
24
- right: 0;
25
+ right: 2px;
25
26
  top: 50%;
26
27
  transform: translateY(-50%);
27
- padding: var(--space-xxsmall);
28
- width: var(--space-large);
29
- height: var(--space-large);
28
+ padding: var(--space-xxxsmall);
29
+ width: var(--space-medium);
30
+ height: var(--space-medium);
30
31
  background: radial-gradient(var(--color-background) 50%, transparent);
31
32
  color: var(--color-text-ultra-light);
32
33
  transition: var(--transition-in);
@@ -5,7 +5,8 @@ import cx from 'classnames';
5
5
  import I18N from '../../i18n';
6
6
  import { FlexStack } from '../../layout/flex-stack';
7
7
  import { Stack } from '../../layout/stack';
8
- import { Popover } from '../../ui/popover';
8
+ import { Icon } from '../../ui/icon';
9
+ import { HoverCard } from '../../ui/hover-card';
9
10
  import css from './metrics-table-title.module.css';
10
11
 
11
12
  export const MetricsTableTitle = (props) => {
@@ -13,26 +14,24 @@ export const MetricsTableTitle = (props) => {
13
14
  const rootClassName = cx(css.root, className);
14
15
 
15
16
  return (
16
- <Stack space="xxxsmall" className={rootClassName}>
17
- <FlexStack space="xxxsmall">
18
- <span>{title}</span>
19
- {info && <span className={css.info}>{info}</span>}
20
- {(popoverInfo || popoverHref) && (
21
- <Popover icon="help">
22
- <Stack space="xxxsmall">
23
- {popoverInfo && <p>{popoverInfo}</p>}
24
- {popoverHref && (
25
- <p>
26
- <a href={popoverHref} target="_blank" rel="noreferrer">
27
- {I18N.READ_MORE}
28
- </a>
29
- </p>
30
- )}
31
- </Stack>
32
- </Popover>
33
- )}
34
- </FlexStack>
35
- </Stack>
17
+ <FlexStack space="xxxsmall" className={rootClassName}>
18
+ <span>{title}</span>
19
+ {info && <span className={css.info}>{info}</span>}
20
+ {(popoverInfo || popoverHref) && (
21
+ <HoverCard label={<Icon glyph="help" />}>
22
+ <Stack space="xxxsmall">
23
+ {popoverInfo && <p>{popoverInfo}</p>}
24
+ {popoverHref && (
25
+ <p>
26
+ <a href={popoverHref} target="_blank" rel="noreferrer">
27
+ {I18N.READ_MORE}
28
+ </a>
29
+ </p>
30
+ )}
31
+ </Stack>
32
+ </HoverCard>
33
+ )}
34
+ </FlexStack>
36
35
  );
37
36
  };
38
37
 
@@ -1,5 +1,7 @@
1
1
  .root {
2
+ align-items: center;
2
3
  font-weight: bold;
4
+ line-height: var(--space-small);
3
5
  text-transform: uppercase;
4
6
  color: var(--color-text-light);
5
7
  }
@@ -51,11 +51,7 @@ export const ModuleInfo = (props) => {
51
51
  </div>
52
52
  )}
53
53
 
54
- <FileName
55
- className={css.fileName}
56
- as="code"
57
- name={run?.name || '-'}
58
- />
54
+ <FileName className={css.fileName} as="code" name={run?.name || '-'} />
59
55
  </Stack>
60
56
  );
61
57
  })}
@@ -15,6 +15,7 @@
15
15
  }
16
16
 
17
17
  .fileName {
18
+ max-width: 100%;
18
19
  padding: 2px;
19
20
  background: var(--color-highlight-warning);
20
21
  }
@@ -3,7 +3,8 @@ import PropTypes from 'prop-types';
3
3
  import cx from 'classnames';
4
4
  import { getGlobalMetricType, getMetricRunInfo } from '@bundle-stats/utils';
5
5
 
6
- import { Popover } from '../../ui/popover';
6
+ import { HoverCard } from '../../ui/hover-card';
7
+ import { Icon } from '../../ui/icon';
7
8
  import { Skeleton } from '../../ui/skeleton';
8
9
  import { Stack } from '../../layout/stack';
9
10
  import { FlexStack } from '../../layout/flex-stack';
@@ -11,32 +12,25 @@ import { Metric } from '../metric';
11
12
  import { Delta } from '../delta';
12
13
  import css from './summary-item.module.css';
13
14
 
14
- const MetricInfoPopover = ({ description, url }) => {
15
- // Workaround cases where the parent is a link
16
- const readMoreOnClick = () => {
17
- window.open(url);
18
- };
19
-
20
- return (
21
- <Stack space="xxxsmall">
22
- <p>{description}</p>
23
- {url && (
24
- <p>
25
- <button type="button" className={css.readMoreBtn} onClick={readMoreOnClick}>
26
- Read more
27
- </button>
28
- </p>
29
- )}
30
- </Stack>
31
- );
32
- };
33
-
34
- MetricInfoPopover.propTypes = {
15
+ const MetricInfo = ({ description, url }) => (
16
+ <Stack space="xxxsmall">
17
+ <p>{description}</p>
18
+ {url && (
19
+ <p>
20
+ <a href={url} className={css.readMoreLink}>
21
+ Read more
22
+ </a>
23
+ </p>
24
+ )}
25
+ </Stack>
26
+ );
27
+
28
+ MetricInfo.propTypes = {
35
29
  description: PropTypes.string.isRequired,
36
30
  url: PropTypes.string,
37
31
  };
38
32
 
39
- MetricInfoPopover.defaultProps = {
33
+ MetricInfo.defaultProps = {
40
34
  url: '',
41
35
  };
42
36
 
@@ -65,9 +59,9 @@ export const SummaryItem = ({
65
59
  <span>{metric.label}</span>
66
60
 
67
61
  {showMetricDescriptionTooltip && (
68
- <Popover className={css.icon} icon="help">
69
- <MetricInfoPopover {...metric} />
70
- </Popover>
62
+ <HoverCard className={css.icon} label={<Icon glyph="help" />}>
63
+ <MetricInfo {...metric} />
64
+ </HoverCard>
71
65
  )}
72
66
  </FlexStack>
73
67
 
@@ -1,4 +1,5 @@
1
1
  .title {
2
+ align-items: center;
2
3
  color: var(--color-text-ultra-light);
3
4
  font-weight: bold;
4
5
  font-size: var(--size-xsmall);
@@ -7,25 +8,6 @@
7
8
  white-space: nowrap;
8
9
  }
9
10
 
10
- .readMoreBtn {
11
- appearance: none;
12
- padding: 0;
13
- border: 0;
14
- background: none;
15
- cursor: pointer;
16
- /* simulate link */
17
- color: var(--color-primary);
18
- text-decoration: underline;
19
- line-height: var(--space-small);
20
- }
21
-
22
- .readMoreBtn:hover,
23
- .readMoreBtn:active,
24
- .readMoreBtn:focus {
25
- color: var(--color-primary-dark);
26
- text-decoration: none;
27
- }
28
-
29
11
  .currentMetric {
30
12
  display: block;
31
13
  color: var(--color-heading);
@@ -1,31 +1,28 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import cx from 'classnames'
3
+ import cx from 'classnames';
4
4
 
5
5
  import config from '../../config.json';
6
6
  import I18N from '../../i18n';
7
7
  import { FlexStack } from '../../layout/flex-stack';
8
8
  import { Stack } from '../../layout/stack';
9
- import { Popover } from '../../ui/popover';
9
+ import { Icon } from '../../ui/icon';
10
+ import { HoverCard } from '../../ui/hover-card';
10
11
  import css from './total-size-type-title.module.css';
11
12
 
12
13
  export const TotalSizeTypeTitle = ({ className }) => (
13
14
  <FlexStack space="xxxsmall" className={cx(css.title, className)}>
14
15
  <span>{I18N.ASSET_TOTALS}</span>
15
- <Popover icon="help">
16
+ <HoverCard label={<Icon glyph="help" />}>
16
17
  <Stack space="xxxsmall">
17
18
  <p>{I18N.ASSET_TOTALS_INFO}</p>
18
19
  <p>
19
- <a
20
- href={config.documentation.assets}
21
- target="_blank"
22
- rel="noreferrer"
23
- >
20
+ <a href={config.documentation.assets} target="_blank" rel="noreferrer">
24
21
  {I18N.READ_MORE}
25
22
  </a>
26
23
  </p>
27
24
  </Stack>
28
- </Popover>
25
+ </HoverCard>
29
26
  </FlexStack>
30
27
  );
31
28
 
@@ -181,9 +181,9 @@
181
181
  --layer-high: 1000;
182
182
  --layer-xhigh: 10000;
183
183
 
184
- --radius-small: var(--space-xxxsmall);
185
- --radius-medium: var(--space-xxsmall);
186
- --radius-large: var(--space-small);
184
+ --radius-small: 2px;
185
+ --radius-medium: var(--space-xxxsmall);
186
+ --radius-large: var(--space-xxsmall);
187
187
 
188
188
  /** Layout */
189
189
  --max-width: 80rem;