@bundle-stats/ui 4.3.0-beta.2 → 4.3.0-rc.0

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 (474) hide show
  1. package/globals.d.ts +4 -0
  2. package/lib/app/app.js +26 -8
  3. package/lib/app/app.js.map +1 -1
  4. package/lib/assets/icons.svg +14 -1
  5. package/lib/assets/icons.svg.js +10 -0
  6. package/lib/assets/icons.svg.js.map +1 -1
  7. package/lib/components/asset-info/asset-info.js +43 -44
  8. package/lib/components/asset-info/asset-info.js.map +1 -1
  9. package/lib/components/asset-info/asset-info.module.css +18 -6
  10. package/lib/components/asset-info/index.js.map +1 -1
  11. package/lib/components/asset-not-predictive/asset-not-predictive.js +28 -0
  12. package/lib/components/asset-not-predictive/asset-not-predictive.js.map +1 -0
  13. package/lib/components/asset-not-predictive/asset-not-predictive.module.css +3 -0
  14. package/lib/components/{duplicate-packages-insight → asset-not-predictive}/index.js +1 -1
  15. package/lib/components/asset-not-predictive/index.js.map +1 -0
  16. package/lib/components/bundle-assets/bundle-assets.js +17 -25
  17. package/lib/components/bundle-assets/bundle-assets.js.map +1 -1
  18. package/lib/components/bundle-assets/bundle-assets.module.css +13 -20
  19. package/lib/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js +7 -5
  20. package/lib/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js.map +1 -1
  21. package/lib/components/bundle-modules/bundle-modules.js +1 -2
  22. package/lib/components/bundle-modules/bundle-modules.js.map +1 -1
  23. package/lib/components/bundle-modules/bundle-modules.module.css +5 -0
  24. package/lib/components/bundle-packages/bundle-packages.js +14 -45
  25. package/lib/components/bundle-packages/bundle-packages.js.map +1 -1
  26. package/lib/components/bundle-packages/bundle-packages.module.css +4 -0
  27. package/lib/components/delta/delta.module.css +2 -1
  28. package/lib/components/entry-info/entry-info.js +46 -0
  29. package/lib/components/entry-info/entry-info.js.map +1 -0
  30. package/lib/components/entry-info/entry-info.module.css +33 -0
  31. package/lib/components/{summary-item → entry-info}/index.js +1 -1
  32. package/lib/components/entry-info/index.js.map +1 -0
  33. package/lib/components/index.js +9 -5
  34. package/lib/components/index.js.map +1 -1
  35. package/lib/components/insight-icon/index.js +18 -0
  36. package/lib/components/insight-icon/index.js.map +1 -0
  37. package/lib/components/insight-icon/insight-icon.js +25 -0
  38. package/lib/components/insight-icon/insight-icon.js.map +1 -0
  39. package/lib/components/insight-icon/insight-icon.module.css +24 -0
  40. package/lib/components/insights/index.js +18 -0
  41. package/lib/components/insights/index.js.map +1 -0
  42. package/lib/components/insights/insights.js +25 -0
  43. package/lib/components/insights/insights.js.map +1 -0
  44. package/lib/components/insights/insights.module.css +14 -0
  45. package/lib/components/metric/index.js.map +1 -1
  46. package/lib/components/metric/metric.js +7 -64
  47. package/lib/components/metric/metric.js.map +1 -1
  48. package/lib/components/metric/metric.module.css +3 -3
  49. package/lib/components/metric-run-info/index.js +18 -0
  50. package/lib/components/metric-run-info/index.js.map +1 -0
  51. package/lib/components/metric-run-info/metric-run-info.js +64 -0
  52. package/lib/components/metric-run-info/metric-run-info.js.map +1 -0
  53. package/lib/components/metric-run-info/metric-run-info.module.css +18 -0
  54. package/lib/components/metrics-table-options/metrics-table-options.js +1 -1
  55. package/lib/components/metrics-table-options/metrics-table-options.js.map +1 -1
  56. package/lib/components/metrics-table-search/metrics-table-search.module.css +0 -6
  57. package/lib/components/metrics-table-title/metrics-table-title.module.css +1 -0
  58. package/lib/components/module-info/index.js.map +1 -1
  59. package/lib/components/module-info/module-info.js +46 -47
  60. package/lib/components/module-info/module-info.js.map +1 -1
  61. package/lib/components/module-info/module-info.module.css +4 -6
  62. package/lib/components/package-info/index.js +18 -0
  63. package/lib/components/package-info/index.js.map +1 -0
  64. package/lib/components/package-info/package-info.js +71 -0
  65. package/lib/components/package-info/package-info.js.map +1 -0
  66. package/lib/components/package-info/package-info.module.css +13 -0
  67. package/lib/components/run-info/index.js +18 -0
  68. package/lib/components/run-info/index.js.map +1 -0
  69. package/lib/components/run-info/run-info.js +70 -0
  70. package/lib/components/run-info/run-info.js.map +1 -0
  71. package/{src/components/summary-item/summary-item.module.css → lib/components/run-info/run-info.module.css} +14 -19
  72. package/lib/components/summary/index.js.map +1 -1
  73. package/lib/components/summary/summary.js +10 -30
  74. package/lib/components/summary/summary.js.map +1 -1
  75. package/lib/components/summary/summary.module.css +17 -6
  76. package/lib/constants.js +1 -23
  77. package/lib/constants.js.map +1 -1
  78. package/lib/css/variables.css +17 -13
  79. package/lib/layout/box/box.js +3 -23
  80. package/lib/layout/box/box.js.map +1 -1
  81. package/lib/layout/box/box.module.css +11 -0
  82. package/lib/layout/box/index.js +15 -3
  83. package/lib/layout/box/index.js.map +1 -1
  84. package/lib/layout/flex-stack/flex-stack.js +3 -19
  85. package/lib/layout/flex-stack/flex-stack.js.map +1 -1
  86. package/lib/layout/flex-stack/index.js.map +1 -1
  87. package/lib/layout/stack/index.js.map +1 -1
  88. package/lib/layout/stack/stack.js +3 -16
  89. package/lib/layout/stack/stack.js.map +1 -1
  90. package/lib/tokens.js +38 -0
  91. package/lib/tokens.js.map +1 -0
  92. package/lib/ui/alert/alert.js +2 -12
  93. package/lib/ui/alert/alert.js.map +1 -1
  94. package/lib/ui/alert/index.js.map +1 -1
  95. package/lib/ui/container/container.js +1 -10
  96. package/lib/ui/container/container.js.map +1 -1
  97. package/lib/ui/container/index.js +15 -3
  98. package/lib/ui/container/index.js.map +1 -1
  99. package/lib/ui/dropdown/dropdown.module.css +1 -2
  100. package/lib/ui/file-name/file-name.js +1 -1
  101. package/lib/ui/file-name/file-name.js.map +1 -1
  102. package/lib/ui/filters/filters.module.css +1 -5
  103. package/lib/ui/hover-card/hover-card.js +1 -1
  104. package/lib/ui/icon/icon.js +3 -0
  105. package/lib/ui/icon/icon.js.map +1 -1
  106. package/lib/ui/index.js +1 -3
  107. package/lib/ui/index.js.map +1 -1
  108. package/lib/ui/input/input.module.css +3 -4
  109. package/lib/ui/table/index.js.map +1 -1
  110. package/lib/ui/table/table.js +3 -17
  111. package/lib/ui/table/table.js.map +1 -1
  112. package/lib/ui/tag/index.js.map +1 -1
  113. package/lib/ui/tag/tag.js +5 -29
  114. package/lib/ui/tag/tag.js.map +1 -1
  115. package/lib/ui/tag/tag.module.css +15 -1
  116. package/lib/ui/tooltip/index.js.map +1 -1
  117. package/lib/ui/tooltip/tooltip.js +3 -23
  118. package/lib/ui/tooltip/tooltip.js.map +1 -1
  119. package/lib/ui/tooltip/tooltip.module.css +4 -4
  120. package/lib-esm/app/app.js +27 -9
  121. package/lib-esm/app/app.js.map +1 -1
  122. package/lib-esm/assets/icons.svg +14 -1
  123. package/lib-esm/assets/icons.svg.js +10 -0
  124. package/lib-esm/assets/icons.svg.js.map +1 -1
  125. package/lib-esm/components/asset-info/asset-info.js +22 -45
  126. package/lib-esm/components/asset-info/asset-info.js.map +1 -1
  127. package/lib-esm/components/asset-info/asset-info.module.css +18 -6
  128. package/lib-esm/components/asset-info/index.js.map +1 -1
  129. package/lib-esm/components/asset-not-predictive/asset-not-predictive.js +21 -0
  130. package/lib-esm/components/asset-not-predictive/asset-not-predictive.js.map +1 -0
  131. package/lib-esm/components/asset-not-predictive/asset-not-predictive.module.css +3 -0
  132. package/lib-esm/components/asset-not-predictive/index.js +2 -0
  133. package/lib-esm/components/asset-not-predictive/index.js.map +1 -0
  134. package/lib-esm/components/bundle-assets/bundle-assets.js +17 -25
  135. package/lib-esm/components/bundle-assets/bundle-assets.js.map +1 -1
  136. package/lib-esm/components/bundle-assets/bundle-assets.module.css +13 -20
  137. package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js +6 -6
  138. package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js.map +1 -1
  139. package/lib-esm/components/bundle-modules/bundle-modules.js +1 -2
  140. package/lib-esm/components/bundle-modules/bundle-modules.js.map +1 -1
  141. package/lib-esm/components/bundle-modules/bundle-modules.module.css +5 -0
  142. package/lib-esm/components/bundle-packages/bundle-packages.js +15 -46
  143. package/lib-esm/components/bundle-packages/bundle-packages.js.map +1 -1
  144. package/lib-esm/components/bundle-packages/bundle-packages.module.css +4 -0
  145. package/lib-esm/components/delta/delta.module.css +2 -1
  146. package/lib-esm/components/entry-info/entry-info.js +40 -0
  147. package/lib-esm/components/entry-info/entry-info.js.map +1 -0
  148. package/lib-esm/components/entry-info/entry-info.module.css +33 -0
  149. package/lib-esm/components/entry-info/index.js +2 -0
  150. package/lib-esm/components/entry-info/index.js.map +1 -0
  151. package/lib-esm/components/index.js +4 -2
  152. package/lib-esm/components/index.js.map +1 -1
  153. package/lib-esm/components/insight-icon/index.js +2 -0
  154. package/lib-esm/components/insight-icon/index.js.map +1 -0
  155. package/lib-esm/components/insight-icon/insight-icon.js +18 -0
  156. package/lib-esm/components/insight-icon/insight-icon.js.map +1 -0
  157. package/lib-esm/components/insight-icon/insight-icon.module.css +24 -0
  158. package/lib-esm/components/insights/index.js +2 -0
  159. package/lib-esm/components/insights/index.js.map +1 -0
  160. package/lib-esm/components/insights/insights.js +18 -0
  161. package/lib-esm/components/insights/insights.js.map +1 -0
  162. package/lib-esm/components/insights/insights.module.css +14 -0
  163. package/lib-esm/components/metric/index.js.map +1 -1
  164. package/lib-esm/components/metric/metric.js +7 -41
  165. package/lib-esm/components/metric/metric.js.map +1 -1
  166. package/lib-esm/components/metric/metric.module.css +3 -3
  167. package/lib-esm/components/metric-run-info/index.js +2 -0
  168. package/lib-esm/components/metric-run-info/index.js.map +1 -0
  169. package/lib-esm/components/metric-run-info/metric-run-info.js +34 -0
  170. package/lib-esm/components/metric-run-info/metric-run-info.js.map +1 -0
  171. package/lib-esm/components/metric-run-info/metric-run-info.module.css +18 -0
  172. package/lib-esm/components/metrics-table-options/metrics-table-options.js +1 -1
  173. package/lib-esm/components/metrics-table-options/metrics-table-options.js.map +1 -1
  174. package/lib-esm/components/metrics-table-search/metrics-table-search.module.css +0 -6
  175. package/lib-esm/components/metrics-table-title/metrics-table-title.module.css +1 -0
  176. package/lib-esm/components/module-info/index.js.map +1 -1
  177. package/lib-esm/components/module-info/module-info.js +25 -48
  178. package/lib-esm/components/module-info/module-info.js.map +1 -1
  179. package/lib-esm/components/module-info/module-info.module.css +4 -6
  180. package/lib-esm/components/package-info/index.js +2 -0
  181. package/lib-esm/components/package-info/index.js.map +1 -0
  182. package/lib-esm/components/package-info/package-info.js +42 -0
  183. package/lib-esm/components/package-info/package-info.js.map +1 -0
  184. package/lib-esm/components/package-info/package-info.module.css +13 -0
  185. package/lib-esm/components/run-info/index.js +2 -0
  186. package/lib-esm/components/run-info/index.js.map +1 -0
  187. package/lib-esm/components/run-info/run-info.js +40 -0
  188. package/lib-esm/components/run-info/run-info.js.map +1 -0
  189. package/lib-esm/components/{summary-item/summary-item.module.css → run-info/run-info.module.css} +14 -19
  190. package/lib-esm/components/summary/index.js.map +1 -1
  191. package/lib-esm/components/summary/summary.js +9 -29
  192. package/lib-esm/components/summary/summary.js.map +1 -1
  193. package/lib-esm/components/summary/summary.module.css +17 -6
  194. package/lib-esm/constants.js +0 -22
  195. package/lib-esm/constants.js.map +1 -1
  196. package/lib-esm/css/variables.css +17 -13
  197. package/lib-esm/layout/box/box.js +3 -23
  198. package/lib-esm/layout/box/box.js.map +1 -1
  199. package/lib-esm/layout/box/box.module.css +11 -0
  200. package/lib-esm/layout/box/index.js +1 -1
  201. package/lib-esm/layout/box/index.js.map +1 -1
  202. package/lib-esm/layout/flex-stack/flex-stack.js +3 -19
  203. package/lib-esm/layout/flex-stack/flex-stack.js.map +1 -1
  204. package/lib-esm/layout/flex-stack/index.js.map +1 -1
  205. package/lib-esm/layout/stack/index.js.map +1 -1
  206. package/lib-esm/layout/stack/stack.js +3 -16
  207. package/lib-esm/layout/stack/stack.js.map +1 -1
  208. package/lib-esm/tokens.js +35 -0
  209. package/lib-esm/tokens.js.map +1 -0
  210. package/lib-esm/ui/alert/alert.js +2 -12
  211. package/lib-esm/ui/alert/alert.js.map +1 -1
  212. package/lib-esm/ui/alert/index.js.map +1 -1
  213. package/lib-esm/ui/container/container.js +1 -10
  214. package/lib-esm/ui/container/container.js.map +1 -1
  215. package/lib-esm/ui/container/index.js +1 -1
  216. package/lib-esm/ui/container/index.js.map +1 -1
  217. package/lib-esm/ui/dropdown/dropdown.module.css +1 -2
  218. package/lib-esm/ui/file-name/file-name.js +1 -1
  219. package/lib-esm/ui/file-name/file-name.js.map +1 -1
  220. package/lib-esm/ui/filters/filters.module.css +1 -5
  221. package/lib-esm/ui/hover-card/hover-card.js +1 -1
  222. package/lib-esm/ui/icon/icon.js +3 -0
  223. package/lib-esm/ui/icon/icon.js.map +1 -1
  224. package/lib-esm/ui/index.js +0 -1
  225. package/lib-esm/ui/index.js.map +1 -1
  226. package/lib-esm/ui/input/input.module.css +3 -4
  227. package/lib-esm/ui/table/index.js.map +1 -1
  228. package/lib-esm/ui/table/table.js +3 -17
  229. package/lib-esm/ui/table/table.js.map +1 -1
  230. package/lib-esm/ui/tag/index.js.map +1 -1
  231. package/lib-esm/ui/tag/tag.js +4 -28
  232. package/lib-esm/ui/tag/tag.js.map +1 -1
  233. package/lib-esm/ui/tag/tag.module.css +15 -1
  234. package/lib-esm/ui/tooltip/index.js.map +1 -1
  235. package/lib-esm/ui/tooltip/tooltip.js +3 -23
  236. package/lib-esm/ui/tooltip/tooltip.js.map +1 -1
  237. package/lib-esm/ui/tooltip/tooltip.module.css +4 -4
  238. package/package.json +19 -25
  239. package/src/app/app.jsx +34 -9
  240. package/src/assets/icons/error.svg +6 -0
  241. package/src/assets/icons/info.svg +6 -0
  242. package/src/assets/icons/more-vertical.svg +5 -0
  243. package/src/assets/icons.svg +14 -1
  244. package/src/assets/icons.svg.jsx +40 -0
  245. package/src/components/asset-info/asset-info.module.css +18 -6
  246. package/src/components/asset-info/asset-info.stories.tsx +64 -0
  247. package/src/components/asset-info/asset-info.tsx +133 -0
  248. package/src/components/asset-not-predictive/asset-not-predictive.module.css +3 -0
  249. package/src/components/asset-not-predictive/asset-not-predictive.stories.tsx +23 -0
  250. package/src/components/asset-not-predictive/asset-not-predictive.tsx +44 -0
  251. package/src/components/asset-not-predictive/index.ts +1 -0
  252. package/src/components/bundle-assets/bundle-assets.jsx +43 -53
  253. package/src/components/bundle-assets/bundle-assets.module.css +13 -20
  254. package/src/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.jsx +18 -15
  255. package/src/components/bundle-modules/bundle-modules.jsx +11 -9
  256. package/src/components/bundle-modules/bundle-modules.module.css +5 -0
  257. package/src/components/bundle-packages/bundle-packages.jsx +55 -118
  258. package/src/components/bundle-packages/bundle-packages.module.css +4 -0
  259. package/src/components/delta/delta.module.css +2 -1
  260. package/src/components/entry-info/entry-info.module.css +33 -0
  261. package/src/components/entry-info/entry-info.stories.tsx +67 -0
  262. package/src/components/entry-info/entry-info.tsx +107 -0
  263. package/src/components/entry-info/index.ts +1 -0
  264. package/src/components/index.js +4 -2
  265. package/src/components/insight-icon/index.ts +1 -0
  266. package/src/components/insight-icon/insight-icon.module.css +24 -0
  267. package/src/components/insight-icon/insight-icon.tsx +25 -0
  268. package/src/components/insights/index.ts +1 -0
  269. package/src/components/insights/insights.module.css +14 -0
  270. package/src/components/insights/insights.stories.tsx +54 -0
  271. package/src/components/insights/insights.tsx +44 -0
  272. package/src/components/metric/metric.module.css +3 -3
  273. package/src/components/metric/metric.stories.tsx +41 -0
  274. package/src/components/metric/metric.tsx +42 -0
  275. package/src/components/metric-run-info/index.ts +1 -0
  276. package/src/components/metric-run-info/metric-run-info.module.css +18 -0
  277. package/src/components/metric-run-info/metric-run-info.stories.tsx +34 -0
  278. package/src/components/metric-run-info/metric-run-info.tsx +85 -0
  279. package/src/components/metrics-table-options/metrics-table-options.jsx +1 -1
  280. package/src/components/metrics-table-search/metrics-table-search.module.css +0 -6
  281. package/src/components/metrics-table-title/metrics-table-title.module.css +1 -0
  282. package/src/components/module-info/module-info.module.css +4 -6
  283. package/src/components/module-info/module-info.stories.tsx +44 -0
  284. package/src/components/module-info/module-info.tsx +79 -0
  285. package/src/components/package-info/index.ts +1 -0
  286. package/src/components/package-info/package-info.module.css +13 -0
  287. package/src/components/package-info/package-info.stories.tsx +36 -0
  288. package/src/components/package-info/package-info.tsx +112 -0
  289. package/src/components/run-info/index.ts +1 -0
  290. package/{lib/components/summary-item/summary-item.module.css → src/components/run-info/run-info.module.css} +14 -19
  291. package/src/components/run-info/run-info.stories.tsx +49 -0
  292. package/src/components/run-info/run-info.tsx +108 -0
  293. package/src/components/summary/summary.module.css +17 -6
  294. package/src/components/summary/summary.stories.tsx +57 -0
  295. package/src/components/summary/summary.tsx +103 -0
  296. package/src/constants.js +0 -24
  297. package/src/css/variables.css +17 -13
  298. package/src/layout/box/box.module.css +11 -0
  299. package/src/layout/box/box.stories.tsx +49 -0
  300. package/src/layout/box/box.tsx +49 -0
  301. package/src/layout/box/index.ts +1 -0
  302. package/src/layout/flex-stack/flex-stack.stories.tsx +59 -0
  303. package/src/layout/flex-stack/flex-stack.tsx +43 -0
  304. package/src/layout/stack/stack.stories.tsx +53 -0
  305. package/src/layout/stack/stack.tsx +22 -0
  306. package/src/tokens.ts +37 -0
  307. package/src/ui/alert/alert.stories.tsx +39 -0
  308. package/src/ui/alert/alert.tsx +23 -0
  309. package/src/ui/container/container.stories.tsx +29 -0
  310. package/src/ui/container/container.tsx +18 -0
  311. package/src/ui/container/index.ts +1 -0
  312. package/src/ui/dropdown/dropdown.module.css +1 -2
  313. package/src/ui/file-name/file-name.jsx +1 -1
  314. package/src/ui/filters/filters.module.css +1 -5
  315. package/src/ui/hover-card/hover-card.jsx +1 -1
  316. package/src/ui/icon/icon.jsx +3 -0
  317. package/src/ui/index.js +0 -1
  318. package/src/ui/input/input.module.css +3 -4
  319. package/src/ui/table/table.stories.tsx +238 -0
  320. package/src/ui/table/table.tsx +38 -0
  321. package/src/ui/tag/tag.module.css +15 -1
  322. package/src/ui/tag/tag.stories.tsx +32 -0
  323. package/src/ui/tag/tag.tsx +28 -0
  324. package/src/ui/tooltip/tooltip.module.css +4 -4
  325. package/src/ui/tooltip/tooltip.stories.tsx +30 -0
  326. package/src/ui/tooltip/tooltip.tsx +56 -0
  327. package/types/app/header/header.d.ts +1 -1
  328. package/types/components/asset-info/asset-info.d.ts +18 -23
  329. package/types/components/asset-info/index.d.ts +1 -1
  330. package/types/components/asset-not-predictive/asset-not-predictive.d.ts +8 -0
  331. package/types/components/asset-not-predictive/index.d.ts +1 -0
  332. package/types/components/browsertime-table/browsertime-table.d.ts +1 -1
  333. package/types/components/bundle-assets/bundle-assets.d.ts +2 -2
  334. package/types/components/bundle-assets/index.d.ts +1 -1
  335. package/types/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.d.ts +2 -2
  336. package/types/components/bundle-assets-totals-table/bundle-assets-totals-table.d.ts +2 -2
  337. package/types/components/bundle-modules/bundle-modules.d.ts +2 -2
  338. package/types/components/bundle-modules/index.d.ts +1 -1
  339. package/types/components/bundle-packages/bundle-packages.d.ts +2 -2
  340. package/types/components/bundle-packages/index.d.ts +1 -1
  341. package/types/components/component-link.d.ts +1 -1
  342. package/types/components/delta/delta.d.ts +1 -1
  343. package/types/components/entry-info/entry-info.d.ts +18 -0
  344. package/types/components/entry-info/index.d.ts +1 -0
  345. package/types/components/index.d.ts +4 -2
  346. package/types/components/insight-icon/index.d.ts +1 -0
  347. package/types/components/insight-icon/insight-icon.d.ts +7 -0
  348. package/types/components/insights/index.d.ts +1 -0
  349. package/types/components/insights/insights.d.ts +8 -0
  350. package/types/components/job-header/job-header.d.ts +1 -1
  351. package/types/components/job-meta/job-meta.d.ts +1 -1
  352. package/types/components/job-name/job-name.d.ts +1 -1
  353. package/types/components/jobs-header/jobs-header.d.ts +1 -1
  354. package/types/components/lighthouse-table/lighthouse-table.d.ts +1 -1
  355. package/types/components/metric/index.d.ts +1 -1
  356. package/types/components/metric/metric.d.ts +6 -32
  357. package/types/components/metric-run-info/index.d.ts +1 -0
  358. package/types/components/metric-run-info/metric-run-info.d.ts +13 -0
  359. package/types/components/metrics-table/metrics-table.d.ts +1 -1
  360. package/types/components/metrics-table-options/metrics-table-options.d.ts +1 -1
  361. package/types/components/metrics-table-search/metrics-table-search.d.ts +1 -1
  362. package/types/components/metrics-table-title/metrics-table-title.d.ts +1 -1
  363. package/types/components/module-info/index.d.ts +1 -1
  364. package/types/components/module-info/module-info.d.ts +16 -34
  365. package/types/components/package-info/index.d.ts +1 -0
  366. package/types/components/package-info/package-info.d.ts +15 -0
  367. package/types/components/run-info/index.d.ts +1 -0
  368. package/types/components/run-info/run-info.d.ts +16 -0
  369. package/types/components/summary/index.d.ts +1 -1
  370. package/types/components/summary/summary.d.ts +25 -36
  371. package/types/components/total-size-type-title/total-size-type-title.d.ts +1 -1
  372. package/types/constants.d.ts +0 -11
  373. package/types/layout/box/box.d.ts +12 -25
  374. package/types/layout/box/index.d.ts +1 -1
  375. package/types/layout/flex-stack/flex-stack.d.ts +10 -33
  376. package/types/layout/flex-stack/index.d.ts +1 -1
  377. package/types/layout/footer/footer.d.ts +1 -1
  378. package/types/layout/separator.d.ts +2 -2
  379. package/types/layout/stack/index.d.ts +1 -1
  380. package/types/layout/stack/stack.d.ts +7 -20
  381. package/types/tokens.d.ts +23 -0
  382. package/types/ui/alert/alert.d.ts +7 -14
  383. package/types/ui/alert/index.d.ts +1 -1
  384. package/types/ui/container/container.d.ts +5 -17
  385. package/types/ui/container/index.d.ts +1 -1
  386. package/types/ui/dropdown/dropdown.d.ts +1 -1
  387. package/types/ui/empty-set/empty-set.d.ts +1 -1
  388. package/types/ui/file-name/file-name.d.ts +2 -2
  389. package/types/ui/filters/filters.d.ts +1 -1
  390. package/types/ui/filters/index.d.ts +1 -1
  391. package/types/ui/horizontal-bar-chart/horizontal-bar-chart.d.ts +1 -1
  392. package/types/ui/hover-card/hover-card.d.ts +1 -1
  393. package/types/ui/icon/icon.d.ts +4 -1
  394. package/types/ui/index.d.ts +0 -1
  395. package/types/ui/input/input.d.ts +1 -1
  396. package/types/ui/loader/loader.d.ts +1 -1
  397. package/types/ui/skeleton/skeleton.d.ts +1 -1
  398. package/types/ui/sort-dropdown/sort-dropdown.d.ts +1 -1
  399. package/types/ui/table/index.d.ts +1 -1
  400. package/types/ui/table/table.d.ts +14 -33
  401. package/types/ui/tabs/tabs.d.ts +1 -1
  402. package/types/ui/tag/index.d.ts +1 -1
  403. package/types/ui/tag/tag.d.ts +22 -33
  404. package/types/ui/toolbar/toolbar.d.ts +1 -1
  405. package/types/ui/tooltip/index.d.ts +1 -1
  406. package/types/ui/tooltip/tooltip.d.ts +10 -28
  407. package/lib/components/duplicate-packages-insight/duplicate-packages-insight.js +0 -31
  408. package/lib/components/duplicate-packages-insight/duplicate-packages-insight.js.map +0 -1
  409. package/lib/components/duplicate-packages-insight/duplicate-packages-insight.module.css +0 -18
  410. package/lib/components/duplicate-packages-insight/index.js.map +0 -1
  411. package/lib/components/summary-item/index.js.map +0 -1
  412. package/lib/components/summary-item/summary-item.js +0 -97
  413. package/lib/components/summary-item/summary-item.js.map +0 -1
  414. package/lib/ui/panels/index.js +0 -6
  415. package/lib/ui/panels/index.js.map +0 -1
  416. package/lib/ui/panels/panels.js +0 -28
  417. package/lib/ui/panels/panels.js.map +0 -1
  418. package/lib/ui/panels/panels.module.css +0 -23
  419. package/lib-esm/components/duplicate-packages-insight/duplicate-packages-insight.js +0 -24
  420. package/lib-esm/components/duplicate-packages-insight/duplicate-packages-insight.js.map +0 -1
  421. package/lib-esm/components/duplicate-packages-insight/duplicate-packages-insight.module.css +0 -18
  422. package/lib-esm/components/duplicate-packages-insight/index.js +0 -2
  423. package/lib-esm/components/duplicate-packages-insight/index.js.map +0 -1
  424. package/lib-esm/components/summary-item/index.js +0 -2
  425. package/lib-esm/components/summary-item/index.js.map +0 -1
  426. package/lib-esm/components/summary-item/summary-item.js +0 -67
  427. package/lib-esm/components/summary-item/summary-item.js.map +0 -1
  428. package/lib-esm/ui/panels/index.js +0 -2
  429. package/lib-esm/ui/panels/index.js.map +0 -1
  430. package/lib-esm/ui/panels/panels.js +0 -21
  431. package/lib-esm/ui/panels/panels.js.map +0 -1
  432. package/lib-esm/ui/panels/panels.module.css +0 -23
  433. package/src/components/asset-info/asset-info.jsx +0 -96
  434. package/src/components/duplicate-packages-insight/duplicate-packages-insight.module.css +0 -18
  435. package/src/components/duplicate-packages-insight/duplicate-packages-insight.stories.tsx +0 -66
  436. package/src/components/duplicate-packages-insight/duplicate-packages-insight.tsx +0 -81
  437. package/src/components/duplicate-packages-insight/index.ts +0 -1
  438. package/src/components/metric/metric.jsx +0 -63
  439. package/src/components/module-info/module-info.jsx +0 -93
  440. package/src/components/summary/summary.jsx +0 -73
  441. package/src/components/summary-item/index.js +0 -1
  442. package/src/components/summary-item/summary-item.jsx +0 -142
  443. package/src/layout/box/box.jsx +0 -67
  444. package/src/layout/box/index.js +0 -1
  445. package/src/layout/flex-stack/flex-stack.jsx +0 -49
  446. package/src/layout/stack/stack.jsx +0 -32
  447. package/src/ui/alert/alert.jsx +0 -27
  448. package/src/ui/container/container.jsx +0 -24
  449. package/src/ui/container/index.js +0 -1
  450. package/src/ui/panels/index.js +0 -1
  451. package/src/ui/panels/panels.jsx +0 -39
  452. package/src/ui/panels/panels.module.css +0 -23
  453. package/src/ui/table/table.jsx +0 -37
  454. package/src/ui/tag/tag.jsx +0 -49
  455. package/src/ui/tooltip/tooltip.jsx +0 -67
  456. package/tsconfig.esm.json +0 -13
  457. package/tsconfig.json +0 -7
  458. package/tsconfig.lib.json +0 -9
  459. package/types/components/duplicate-packages-insight/duplicate-packages-insight.d.ts +0 -11
  460. package/types/components/duplicate-packages-insight/index.d.ts +0 -1
  461. package/types/components/summary-item/index.d.ts +0 -1
  462. package/types/components/summary-item/summary-item.d.ts +0 -40
  463. package/types/ui/panels/index.d.ts +0 -1
  464. package/types/ui/panels/panels.d.ts +0 -18
  465. /package/src/components/asset-info/{index.js → index.ts} +0 -0
  466. /package/src/components/metric/{index.js → index.ts} +0 -0
  467. /package/src/components/module-info/{index.js → index.ts} +0 -0
  468. /package/src/components/summary/{index.js → index.ts} +0 -0
  469. /package/src/layout/flex-stack/{index.js → index.ts} +0 -0
  470. /package/src/layout/stack/{index.js → index.ts} +0 -0
  471. /package/src/ui/alert/{index.js → index.ts} +0 -0
  472. /package/src/ui/table/{index.js → index.ts} +0 -0
  473. /package/src/ui/tag/{index.js → index.ts} +0 -0
  474. /package/src/ui/tooltip/{index.js → index.ts} +0 -0
@@ -0,0 +1,24 @@
1
+ .root {
2
+ width: calc(var(--space-small) + 6px);
3
+ height: calc(var(--space-small) + 6px);
4
+ padding: 3px;
5
+ border-radius: 50%;
6
+ background: var(--color-highlight);
7
+ }
8
+
9
+ .error {
10
+ background: var(--color-red-50);
11
+ color: var(--color-danger);
12
+ }
13
+
14
+ .warning {
15
+ padding-top: 1px;
16
+ background: var(--color-yellow-100);
17
+ color: var(--color-yellow-900);
18
+ }
19
+
20
+ .info {
21
+ background: var(--color-highlight-info);
22
+ color: var(--color-info);
23
+ }
24
+
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import cx from 'classnames';
3
+ import { InsightType } from '@bundle-stats/utils';
4
+
5
+ import { Icon } from '../../ui/icon';
6
+ import css from './insight-icon.module.css';
7
+
8
+ const InsightTypeIconMap = new Map([
9
+ [InsightType.ERROR, Icon.ICONS.ERROR],
10
+ [InsightType.WARNING, Icon.ICONS.WARNING],
11
+ [InsightType.INFO, Icon.ICONS.INFO],
12
+ ]);
13
+
14
+ interface InsightIconProps extends React.HTMLAttributes<'span'> {
15
+ type: InsightType;
16
+ }
17
+
18
+ export const InsightIcon = (props: InsightIconProps) => {
19
+ const { className, type } = props;
20
+ const resolvedType = Object.values(InsightType).includes(type) ? type : InsightType.WARNING;
21
+ const rootClassName = cx(css.root, css[resolvedType], className);
22
+ const glyph = InsightTypeIconMap.get(resolvedType) as string;
23
+
24
+ return <Icon glyph={glyph} className={rootClassName} />;
25
+ };
@@ -0,0 +1 @@
1
+ export * from './insights';
@@ -0,0 +1,14 @@
1
+ .icon {
2
+ flex: 0 0 auto;
3
+ }
4
+
5
+ .entry {
6
+ color: inherit;
7
+ text-decoration: none;
8
+ }
9
+
10
+ .entry:hover,
11
+ .entry:active,
12
+ .entry:focus {
13
+ text-decoration: underline;
14
+ }
@@ -0,0 +1,54 @@
1
+ import React from 'react';
2
+
3
+ import { getWrapperDecorator } from '../../stories';
4
+ import { Insights } from '.';
5
+
6
+ export default {
7
+ title: 'Components/Insights',
8
+ component: Insights,
9
+ decorators: [getWrapperDecorator()],
10
+ };
11
+
12
+ const Template = (props: any) => <Insights {...props} />;
13
+
14
+ export const Default = Template.bind({});
15
+
16
+ Default.args = {
17
+ insights: {
18
+ duplicatePackages: {
19
+ type: 'error',
20
+ data: {
21
+ packages: { 'package-a': ['package-a', 'package-a~1'] },
22
+ text: 'Bundle introduced 1 and removed 2 duplicate packages',
23
+ },
24
+ },
25
+ newPackages: {
26
+ type: 'warning',
27
+ data: {
28
+ text: 'Bundle introduced 2 new packages: package-c, package-d',
29
+ packages: ['package-c', 'package-d'],
30
+ },
31
+ },
32
+ },
33
+ };
34
+
35
+ export const Info = Template.bind({});
36
+
37
+ Info.args = {
38
+ insights: {
39
+ duplicatePackages: {
40
+ type: 'info',
41
+ data: {
42
+ packages: { 'package-a': ['package-a', 'package-a~1'] },
43
+ text: 'Bundle removed 1 duplicate packages',
44
+ },
45
+ },
46
+ newPackages: {
47
+ type: 'warning',
48
+ data: {
49
+ text: 'Bundle introduced 2 new packages: package-c, package-d',
50
+ packages: ['package-c', 'package-d'],
51
+ },
52
+ },
53
+ },
54
+ };
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+ import { JobInsightsInfo, getInsightList } from '@bundle-stats/utils';
3
+
4
+ import { FlexStack } from '../../layout/flex-stack';
5
+ import { Stack } from '../../layout/stack';
6
+ import { ComponentLink } from '../component-link';
7
+ import { InsightIcon } from '../insight-icon';
8
+ import css from './insights.module.css';
9
+
10
+ interface InsightsProps extends React.HTMLAttributes<HTMLDivElement> {
11
+ insights: JobInsightsInfo;
12
+ customComponentLink?: React.ElementType;
13
+ }
14
+
15
+ export const Insights = (props: InsightsProps) => {
16
+ const {
17
+ insights,
18
+ customComponentLink: CustomComponentLink = ComponentLink,
19
+ ...restProps
20
+ } = props;
21
+
22
+ const insightList = getInsightList(insights);
23
+
24
+ return (
25
+ <Stack space="xxsmall" {...restProps}>
26
+ {insightList.map(({ name, insight, link }) => {
27
+ const { text } = insight.data as { text: string };
28
+ return (
29
+ <FlexStack
30
+ key={name}
31
+ space="xxsmall"
32
+ alignItems="center"
33
+ as={CustomComponentLink}
34
+ {...link}
35
+ className={css.entry}
36
+ >
37
+ <InsightIcon type={insight.type} className={css.icon} />
38
+ <span>{text}</span>
39
+ </FlexStack>
40
+ );
41
+ })}
42
+ </Stack>
43
+ );
44
+ };
@@ -1,12 +1,12 @@
1
1
  .root {
2
- letter-spacing: 0.05em;
2
+ font-family: var(--font-family-fixed);
3
3
  }
4
4
 
5
5
  .displayUnit {
6
6
  font-size: var(--size-small);
7
7
  }
8
8
 
9
- .delta {
9
+ .content {
10
10
  font-size: var(--size-small);
11
11
  }
12
12
 
@@ -14,7 +14,7 @@
14
14
  display: inline-block;
15
15
  }
16
16
 
17
- .inline .delta {
17
+ .inline .content {
18
18
  display: inline-block;
19
19
  margin: 0 0 0 var(--space-xxxsmall);
20
20
  }
@@ -0,0 +1,41 @@
1
+ import React from 'react';
2
+ import { Meta, Story } from '@storybook/react';
3
+
4
+ import { getWrapperDecorator } from '../../stories';
5
+ import { Delta } from '../delta';
6
+ import { Metric } from '.';
7
+
8
+ export default {
9
+ title: 'Components/Metric',
10
+ component: Metric,
11
+ decorators: [getWrapperDecorator({ maxWidth: '200px' })],
12
+ } as Meta;
13
+
14
+ const Template: Story = (args) => <Metric {...args} />;
15
+
16
+ export const Default = Template.bind({});
17
+
18
+ Default.args = {
19
+ value: '100',
20
+ };
21
+
22
+ export const WithUnit = Template.bind({});
23
+
24
+ WithUnit.args = {
25
+ value: '100',
26
+ unit: 'KiB',
27
+ };
28
+
29
+ export const WithDelta = Template.bind({});
30
+
31
+ WithDelta.args = {
32
+ ...WithUnit.args,
33
+ children: <Delta displayValue="+10%" deltaType="POSITIVE" />,
34
+ };
35
+
36
+ export const Inline = Template.bind({});
37
+
38
+ Inline.args = {
39
+ ...WithDelta.args,
40
+ inline: true,
41
+ };
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import cx from 'classnames';
3
+
4
+ import css from './metric.module.css';
5
+
6
+ export interface MetricProps {
7
+ /**
8
+ * Metric value
9
+ */
10
+ value?: React.ReactNode;
11
+ /**
12
+ * Metric value unit
13
+ */
14
+ unit?: string;
15
+ /**
16
+ * Inline variant - render children inline
17
+ */
18
+ inline?: boolean;
19
+ }
20
+
21
+ export const Metric = (props: MetricProps & React.ComponentProps<'div'>) => {
22
+ const {
23
+ className = '',
24
+ value = '0',
25
+ unit = '',
26
+ inline = false,
27
+ children = null,
28
+ ...restProps
29
+ } = props;
30
+
31
+ const rootClassName = cx(className, css.root, inline && css.inline);
32
+
33
+ return (
34
+ <div className={rootClassName} {...restProps}>
35
+ <div className={css.display}>
36
+ <span className={css.displayValue}>{value}</span>
37
+ {unit && <span className={css.displayUnit}>{unit}</span>}
38
+ </div>
39
+ {children && <div className={css.content}>{children}</div>}
40
+ </div>
41
+ );
42
+ };
@@ -0,0 +1 @@
1
+ export * from './metric-run-info';
@@ -0,0 +1,18 @@
1
+ .readMoreLink {
2
+ appearance: none;
3
+ background: none;
4
+ margin: 0;
5
+ border: 0;
6
+ padding: 0;
7
+ color: var(--color-primary);
8
+ text-decoration: underline;
9
+ cursor: pointer;
10
+ }
11
+
12
+ .readMoreLink:hover,
13
+ .readMoreLink:active,
14
+ .readMoreLink:focus {
15
+ color: var(--color-primary-dark);
16
+ text-decoration: none;
17
+ }
18
+
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+
3
+ import { Meta, Story } from '@storybook/react';
4
+ import { MetricRunInfo } from '.';
5
+
6
+ export default {
7
+ title: 'Components/MetricRunInfo',
8
+ component: MetricRunInfo,
9
+ } as Meta;
10
+
11
+ const Template: Story = (args: any) => <MetricRunInfo {...args} />;
12
+
13
+ export const Default = Template.bind({});
14
+
15
+ Default.args = {
16
+ metricId: 'webpack.totalSizeByTypeALL',
17
+ current: 120 * 1024,
18
+ baseline: 100 * 1024,
19
+ };
20
+
21
+ export const NoBaseline = Template.bind({});
22
+
23
+ NoBaseline.args = {
24
+ metricId: 'webpack.totalSizeByTypeALL',
25
+ current: 120 * 1024,
26
+ showBaseline: false,
27
+ };
28
+
29
+ export const NoDelta = Template.bind({});
30
+
31
+ NoDelta.args = {
32
+ ...Default.args,
33
+ showDelta: false,
34
+ };
@@ -0,0 +1,85 @@
1
+ import React, { useCallback, useMemo } from 'react';
2
+ import { getGlobalMetricType, getMetricRunInfo } from '@bundle-stats/utils';
3
+
4
+ import { Stack } from '../../layout/stack';
5
+ import { RunInfo, RunInfoProps } from '../run-info';
6
+ import css from './metric-run-info.module.css';
7
+
8
+ interface MetricInfoProps {
9
+ description: string;
10
+ url?: string;
11
+ }
12
+
13
+ const MetricHoverCard = ({ description, url }: MetricInfoProps) => {
14
+ // The component parent can be rendered inside a link, use button to avoid using nested links
15
+ const onClick = useCallback(() => {
16
+ if (url) {
17
+ window.open(url);
18
+ }
19
+ }, [url]);
20
+
21
+ return (
22
+ <Stack space="xxxsmall">
23
+ <p>{description}</p>
24
+ {url && (
25
+ <p>
26
+ <button type="button" onClick={onClick} className={css.readMoreLink}>
27
+ Read more
28
+ </button>
29
+ </p>
30
+ )}
31
+ </Stack>
32
+ );
33
+ };
34
+
35
+ export interface MetricRunInfoProps {
36
+ metricId: string;
37
+ current: number;
38
+ baseline?: number;
39
+ showDelta?: boolean;
40
+ showMetricDescription?: boolean;
41
+ showBaseline?: boolean;
42
+ size?: RunInfoProps['size'];
43
+ loading?: RunInfoProps['loading'];
44
+ }
45
+
46
+ export const MetricRunInfo = (props: MetricRunInfoProps & React.ComponentProps<'div'>) => {
47
+ const {
48
+ metricId,
49
+ current,
50
+ baseline = 0,
51
+ showDelta = true,
52
+ showMetricDescription = true,
53
+ showBaseline = true,
54
+ ...restProps
55
+ } = props;
56
+
57
+ const metric = getGlobalMetricType(metricId);
58
+ const metricRunInfo = getMetricRunInfo(metric, current, baseline || 0);
59
+
60
+ const titleHoverCard = useMemo(() => {
61
+ if (showMetricDescription) {
62
+ return <MetricHoverCard description={metric.description} url={metric.url} />;
63
+ }
64
+
65
+ return null;
66
+ }, [showMetricDescription, metric]);
67
+
68
+ return (
69
+ <RunInfo
70
+ title={metric.label}
71
+ titleHoverCard={titleHoverCard}
72
+ enhance
73
+ current={metricRunInfo.displayValue}
74
+ showBaseline={showBaseline}
75
+ {...(showBaseline && {
76
+ baseline: metric.formatter(baseline),
77
+ })}
78
+ {...(showDelta && showBaseline && {
79
+ delta: metricRunInfo.displayDeltaPercentage,
80
+ deltaType: metricRunInfo.deltaType,
81
+ })}
82
+ {...restProps}
83
+ />
84
+ );
85
+ };
@@ -8,7 +8,7 @@ export const MetricsTableOptions = (props) => {
8
8
  const { className, handleViewAll, handleResetFilters, ...restProps } = props;
9
9
 
10
10
  return (
11
- <Dropdown className={className} glyph="menu" {...restProps}>
11
+ <Dropdown className={className} glyph="more-vertical" {...restProps}>
12
12
  {handleResetFilters && (
13
13
  <Dropdown.Item onClick={handleResetFilters}>
14
14
  {I18N.RESET_FILTERS}
@@ -5,13 +5,7 @@
5
5
  }
6
6
 
7
7
  .input {
8
- border-radius: var(--radius-small);
9
8
  height: var(--space-large);
10
- border-color: var(--color-outline);
11
- }
12
-
13
- .input:focus {
14
- border-color: var(--color-outline-dark);
15
9
  }
16
10
 
17
11
  .cancelButton {
@@ -14,6 +14,7 @@
14
14
 
15
15
  .anchorIcon {
16
16
  display: block;
17
+ margin: -2px 0; /* compensate for the vertical space */
17
18
  }
18
19
 
19
20
  .info {
@@ -8,14 +8,12 @@
8
8
 
9
9
  .chunksItem {
10
10
  overflow-wrap: break-word;
11
+ text-decoration: none;
12
+ text-transform: none;
13
+ font-weight: normal;
14
+ font-size: 1em;
11
15
  }
12
16
 
13
17
  .chunksItem + .chunksItem {
14
18
  margin-left: var(--space-xxxsmall);
15
19
  }
16
-
17
- .fileName {
18
- max-width: 100%;
19
- padding: 2px;
20
- background: var(--color-highlight-warning);
21
- }
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+
3
+ import { getWrapperDecorator } from '../../stories';
4
+ import { ModuleInfo } from '.';
5
+
6
+ export default {
7
+ title: 'Components/ModuleInfo',
8
+ component: ModuleInfo,
9
+ decorators: [getWrapperDecorator()],
10
+ };
11
+
12
+ export const Default = () => (
13
+ <ModuleInfo
14
+ item={{
15
+ label: './node_modules/lodash/fp/merge.js',
16
+ duplicated: true,
17
+ runs: [
18
+ {
19
+ name: './node_modules/lodash/fp/merge.js',
20
+ chunkIds: ['1', '2'],
21
+ value: 1024 * 4,
22
+ },
23
+ {
24
+ name: './node_modules/lodash/fp/merge.js',
25
+ chunkIds: ['1', '2'],
26
+ value: 1024 * 3,
27
+ displayValue: '3KiB',
28
+ },
29
+ ] as any,
30
+ }}
31
+ chunks={[
32
+ {
33
+ id: '1',
34
+ name: 'chunk-1',
35
+ },
36
+ {
37
+ id: '2',
38
+ name: 'chunk-2',
39
+ },
40
+ ]}
41
+ chunkIds={['1', '2']}
42
+ labels={['Job #2', 'Job #1']}
43
+ />
44
+ );
@@ -0,0 +1,79 @@
1
+ import React, { useMemo } from 'react';
2
+ import cx from 'classnames';
3
+ import isEmpty from 'lodash/isEmpty';
4
+ import noop from 'lodash/noop';
5
+ import { BUNDLE_MODULES_DUPLICATE, MetricRunInfo, getBundleModulesByChunk } from '@bundle-stats/utils';
6
+ import { Module, MetaChunk } from '@bundle-stats/utils/types/webpack';
7
+
8
+ import { Tag } from '../../ui/tag';
9
+ import { ComponentLink } from '../component-link';
10
+ import { EntryInfo } from '../entry-info';
11
+ import css from './module-info.module.css';
12
+
13
+ interface ModuleInfoProps {
14
+ item: {
15
+ label: string;
16
+ changed?: boolean;
17
+ duplicated?: boolean;
18
+ runs: Array<Module & MetricRunInfo>;
19
+ };
20
+ chunks?: Array<MetaChunk>;
21
+ chunkIds?: Array<string>;
22
+ labels: Array<string>;
23
+ customComponentLink?: React.ElementType;
24
+ }
25
+
26
+ export const ModuleInfo = (props: ModuleInfoProps & React.ComponentProps<'div'>) => {
27
+ const {
28
+ className = '',
29
+ item,
30
+ labels,
31
+ chunks = [],
32
+ chunkIds = [],
33
+ customComponentLink: CustomComponentLink = ComponentLink,
34
+ onClick = noop,
35
+ } = props;
36
+
37
+ const rootClassName = cx(css.root, className);
38
+ const currentRun = item.runs?.[0];
39
+
40
+ const tags = useMemo(() => {
41
+ if (!item.duplicated) {
42
+ return null;
43
+ }
44
+
45
+ return (
46
+ <div>
47
+ <Tag as={CustomComponentLink} {...BUNDLE_MODULES_DUPLICATE} onClick={onClick} kind="danger">Duplicate</Tag>
48
+ </div>
49
+ );
50
+ }, [item]);
51
+
52
+ return (
53
+ <EntryInfo item={item} labels={labels} tags={tags} className={rootClassName}>
54
+ {!isEmpty(currentRun?.chunkIds) && (
55
+ <div className={css.chunks}>
56
+ <span className={css.chunksTitle}>Chunks:</span>
57
+ {currentRun.chunkIds.map((chunkId) => {
58
+ const chunk = chunks?.find(({ id }) => id === chunkId);
59
+
60
+ if (!chunk) {
61
+ return null;
62
+ }
63
+
64
+ return (
65
+ <Tag
66
+ as={CustomComponentLink}
67
+ {...getBundleModulesByChunk(chunkIds, chunkId)}
68
+ onClick={onClick}
69
+ className={css.chunksItem}
70
+ >
71
+ {chunk.name}
72
+ </Tag>
73
+ );
74
+ })}
75
+ </div>
76
+ )}
77
+ </EntryInfo>
78
+ );
79
+ };
@@ -0,0 +1 @@
1
+ export * from './package-info';
@@ -0,0 +1,13 @@
1
+ .fileName {
2
+ padding: 0 2px;
3
+ background: var(--color-highlight-warning);
4
+ }
5
+
6
+ .external {
7
+ padding: 0;
8
+ list-style: inside disc;
9
+ }
10
+
11
+ .packageTitleId {
12
+ color: var(--color-text-ultra-light);
13
+ }
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+
3
+ import { getWrapperDecorator } from '../../stories';
4
+ import { PackageInfo } from '.';
5
+
6
+ export default {
7
+ title: 'Components/PackageInfo',
8
+ component: PackageInfo,
9
+ decorators: [getWrapperDecorator()],
10
+ };
11
+
12
+ const RUNS = [
13
+ {
14
+ name: 'lodash',
15
+ value: 279901,
16
+ path: '../node_modules/lodash',
17
+ },
18
+ {
19
+ name: 'lodash',
20
+ value: 283712,
21
+ displayValue: '277.06KiB',
22
+ path: '../node_modules/lodash',
23
+ },
24
+ ];
25
+
26
+ export const Default = () => (
27
+ <PackageInfo
28
+ name="lodash~1"
29
+ item={{
30
+ label: 'lodash',
31
+ duplicate: true,
32
+ runs: RUNS as any,
33
+ }}
34
+ labels={['Job #2', 'Job #1']}
35
+ />
36
+ );