@bundle-stats/ui 4.23.0-beta.1 → 4.23.0-beta.10

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 (324) hide show
  1. package/lib/app/app.js +2 -1
  2. package/lib/app/app.js.map +1 -1
  3. package/lib/app/app.module.css +8 -9
  4. package/lib/app/header/header.module.css +1 -3
  5. package/lib/components/asset-name/asset-name.js +8 -7
  6. package/lib/components/asset-name/asset-name.js.map +1 -1
  7. package/lib/components/asset-name/asset-name.module.css +11 -10
  8. package/lib/components/bundle-assets/bundle-assets.js +4 -2
  9. package/lib/components/bundle-assets/bundle-assets.js.map +1 -1
  10. package/lib/components/bundle-assets/bundle-assets.module.css +0 -12
  11. package/lib/components/bundle-assets/index.js +2 -1
  12. package/lib/components/bundle-assets/index.js.map +1 -1
  13. package/lib/components/bundle-assets-totals/bundle-assets-totals.js +4 -2
  14. package/lib/components/bundle-assets-totals/bundle-assets-totals.js.map +1 -1
  15. package/lib/components/bundle-modules/bundle-modules.js +5 -3
  16. package/lib/components/bundle-modules/bundle-modules.js.map +1 -1
  17. package/lib/components/bundle-modules/bundle-modules.module.css +2 -16
  18. package/lib/components/bundle-modules/index.js +2 -1
  19. package/lib/components/bundle-modules/index.js.map +1 -1
  20. package/lib/components/bundle-packages/bundle-packages.js +5 -3
  21. package/lib/components/bundle-packages/bundle-packages.js.map +1 -1
  22. package/lib/components/bundle-packages/bundle-packages.module.css +18 -22
  23. package/lib/components/entry-info/entry-info.js +4 -2
  24. package/lib/components/entry-info/entry-info.js.map +1 -1
  25. package/lib/components/entry-info/entry-info.module.css +7 -2
  26. package/lib/components/jobs-header/jobs-header.js +1 -1
  27. package/lib/components/jobs-header/jobs-header.js.map +1 -1
  28. package/lib/components/jobs-header/jobs-header.module.css +0 -1
  29. package/lib/components/metric-change-legend/metric-change-legend.js +2 -2
  30. package/lib/components/metric-change-legend/metric-change-legend.js.map +1 -1
  31. package/lib/components/metric-change-legend/metric-change-legend.module.css +11 -0
  32. package/lib/components/metric-run-info/metric-run-info.js +4 -11
  33. package/lib/components/metric-run-info/metric-run-info.js.map +1 -1
  34. package/lib/components/metrics-display-selector/metrics-display-selector.module.css +0 -2
  35. package/lib/components/metrics-table/metrics-table.js +31 -20
  36. package/lib/components/metrics-table/metrics-table.js.map +1 -1
  37. package/lib/components/metrics-table/metrics-table.module.css +4 -12
  38. package/lib/components/metrics-table-options/metrics-table-options.js +5 -6
  39. package/lib/components/metrics-table-options/metrics-table-options.js.map +1 -1
  40. package/lib/components/metrics-table-row-count/index.js +18 -0
  41. package/lib/components/metrics-table-row-count/index.js.map +1 -0
  42. package/lib/components/metrics-table-row-count/metrics-table-row-count.js +17 -0
  43. package/lib/components/metrics-table-row-count/metrics-table-row-count.js.map +1 -0
  44. package/lib/components/metrics-table-row-count/metrics-table-row-count.module.css +5 -0
  45. package/lib/components/metrics-treemap/metrics-treemap.constants.js +3 -1
  46. package/lib/components/metrics-treemap/metrics-treemap.constants.js.map +1 -1
  47. package/lib/components/metrics-treemap/metrics-treemap.js +46 -113
  48. package/lib/components/metrics-treemap/metrics-treemap.js.map +1 -1
  49. package/lib/components/metrics-treemap/metrics-treemap.module.css +3 -274
  50. package/lib/components/metrics-treemap/metrics-treemap.utils.js +81 -16
  51. package/lib/components/metrics-treemap/metrics-treemap.utils.js.map +1 -1
  52. package/lib/components/metrics-treemap/tile/index.js +18 -0
  53. package/lib/components/metrics-treemap/tile/index.js.map +1 -0
  54. package/lib/components/metrics-treemap/tile/tile.js +79 -0
  55. package/lib/components/metrics-treemap/tile/tile.js.map +1 -0
  56. package/lib/components/metrics-treemap/tile/tile.module.css +145 -0
  57. package/lib/components/metrics-treemap/tile-group/index.js +18 -0
  58. package/lib/components/metrics-treemap/tile-group/index.js.map +1 -0
  59. package/lib/components/metrics-treemap/tile-group/tile-group.js +75 -0
  60. package/lib/components/metrics-treemap/tile-group/tile-group.js.map +1 -0
  61. package/lib/components/metrics-treemap/tile-group/tile-group.module.css +57 -0
  62. package/lib/components/metrics-treemap/tile-group-title/index.js +18 -0
  63. package/lib/components/metrics-treemap/tile-group-title/index.js.map +1 -0
  64. package/lib/components/metrics-treemap/tile-group-title/tile-group-title.js +24 -0
  65. package/lib/components/metrics-treemap/tile-group-title/tile-group-title.js.map +1 -0
  66. package/lib/components/metrics-treemap/tile-group-title/tile-group-title.module.css +48 -0
  67. package/lib/components/sort-button/sort-button.module.css +0 -2
  68. package/lib/components/summary/summary.js +5 -4
  69. package/lib/components/summary/summary.js.map +1 -1
  70. package/lib/components/summary/summary.module.css +10 -14
  71. package/lib/css/default.css +7 -4
  72. package/lib/css/variables.css +36 -25
  73. package/lib/layout/flex-stack/flex-stack.js +2 -2
  74. package/lib/layout/flex-stack/flex-stack.js.map +1 -1
  75. package/lib/layout/flex-stack/flex-stack.module.css +65 -10
  76. package/lib/query-state.js +6 -3
  77. package/lib/query-state.js.map +1 -1
  78. package/lib/ui/button/button.js +3 -2
  79. package/lib/ui/button/button.js.map +1 -1
  80. package/lib/ui/button/button.module.css +38 -27
  81. package/lib/ui/control-group/control-group.js +1 -1
  82. package/lib/ui/control-group/control-group.js.map +1 -1
  83. package/lib/ui/copy-to-clipboard/copy-to-clipboard.module.css +2 -2
  84. package/lib/ui/dialog/dialog.js +3 -1
  85. package/lib/ui/dialog/dialog.js.map +1 -1
  86. package/lib/ui/dialog/dialog.module.css +5 -0
  87. package/lib/ui/dropdown/dropdown.js +11 -3
  88. package/lib/ui/dropdown/dropdown.js.map +1 -1
  89. package/lib/ui/dropdown/dropdown.module.css +49 -7
  90. package/lib/ui/filters/filters.js +28 -16
  91. package/lib/ui/filters/filters.js.map +1 -1
  92. package/lib/ui/filters/filters.module.css +3 -19
  93. package/lib/ui/hover-card/hover-card.js +7 -1
  94. package/lib/ui/hover-card/hover-card.js.map +1 -1
  95. package/lib/ui/hover-card/hover-card.module.css +5 -6
  96. package/lib/ui/input/input.module.css +2 -2
  97. package/lib/ui/table/table.module.css +12 -5
  98. package/lib/ui/tabs/tabs.module.css +13 -9
  99. package/lib/ui/tag/tag.module.css +0 -2
  100. package/lib/ui/textarea/textarea.module.css +2 -2
  101. package/lib/ui/toolbar/toolbar.js +2 -1
  102. package/lib/ui/toolbar/toolbar.js.map +1 -1
  103. package/lib/ui/toolbar/toolbar.module.css +0 -6
  104. package/lib/ui/tooltip/tooltip.js +6 -1
  105. package/lib/ui/tooltip/tooltip.js.map +1 -1
  106. package/lib/ui/tooltip/tooltip.module.css +1 -1
  107. package/lib/utils/index.js +1 -0
  108. package/lib/utils/index.js.map +1 -1
  109. package/lib/utils/portal.js +10 -0
  110. package/lib/utils/portal.js.map +1 -0
  111. package/lib-esm/app/app.js +2 -1
  112. package/lib-esm/app/app.js.map +1 -1
  113. package/lib-esm/app/app.module.css +8 -9
  114. package/lib-esm/app/header/header.module.css +1 -3
  115. package/lib-esm/components/asset-name/asset-name.js +8 -7
  116. package/lib-esm/components/asset-name/asset-name.js.map +1 -1
  117. package/lib-esm/components/asset-name/asset-name.module.css +11 -10
  118. package/lib-esm/components/bundle-assets/bundle-assets.js +4 -2
  119. package/lib-esm/components/bundle-assets/bundle-assets.js.map +1 -1
  120. package/lib-esm/components/bundle-assets/bundle-assets.module.css +0 -12
  121. package/lib-esm/components/bundle-assets/index.js +2 -1
  122. package/lib-esm/components/bundle-assets/index.js.map +1 -1
  123. package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.js +4 -2
  124. package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.js.map +1 -1
  125. package/lib-esm/components/bundle-modules/bundle-modules.js +5 -3
  126. package/lib-esm/components/bundle-modules/bundle-modules.js.map +1 -1
  127. package/lib-esm/components/bundle-modules/bundle-modules.module.css +2 -16
  128. package/lib-esm/components/bundle-modules/index.js +2 -1
  129. package/lib-esm/components/bundle-modules/index.js.map +1 -1
  130. package/lib-esm/components/bundle-packages/bundle-packages.js +5 -3
  131. package/lib-esm/components/bundle-packages/bundle-packages.js.map +1 -1
  132. package/lib-esm/components/bundle-packages/bundle-packages.module.css +18 -22
  133. package/lib-esm/components/entry-info/entry-info.js +4 -2
  134. package/lib-esm/components/entry-info/entry-info.js.map +1 -1
  135. package/lib-esm/components/entry-info/entry-info.module.css +7 -2
  136. package/lib-esm/components/jobs-header/jobs-header.js +1 -1
  137. package/lib-esm/components/jobs-header/jobs-header.js.map +1 -1
  138. package/lib-esm/components/jobs-header/jobs-header.module.css +0 -1
  139. package/lib-esm/components/metric-change-legend/metric-change-legend.js +2 -2
  140. package/lib-esm/components/metric-change-legend/metric-change-legend.js.map +1 -1
  141. package/lib-esm/components/metric-change-legend/metric-change-legend.module.css +11 -0
  142. package/lib-esm/components/metric-run-info/metric-run-info.js +5 -12
  143. package/lib-esm/components/metric-run-info/metric-run-info.js.map +1 -1
  144. package/lib-esm/components/metrics-display-selector/metrics-display-selector.module.css +0 -2
  145. package/lib-esm/components/metrics-table/metrics-table.js +32 -20
  146. package/lib-esm/components/metrics-table/metrics-table.js.map +1 -1
  147. package/lib-esm/components/metrics-table/metrics-table.module.css +4 -12
  148. package/lib-esm/components/metrics-table-options/metrics-table-options.js +6 -7
  149. package/lib-esm/components/metrics-table-options/metrics-table-options.js.map +1 -1
  150. package/lib-esm/components/metrics-table-row-count/index.js +2 -0
  151. package/lib-esm/components/metrics-table-row-count/index.js.map +1 -0
  152. package/lib-esm/components/metrics-table-row-count/metrics-table-row-count.js +10 -0
  153. package/lib-esm/components/metrics-table-row-count/metrics-table-row-count.js.map +1 -0
  154. package/lib-esm/components/metrics-table-row-count/metrics-table-row-count.module.css +5 -0
  155. package/lib-esm/components/metrics-treemap/metrics-treemap.constants.js +2 -0
  156. package/lib-esm/components/metrics-treemap/metrics-treemap.constants.js.map +1 -1
  157. package/lib-esm/components/metrics-treemap/metrics-treemap.js +52 -120
  158. package/lib-esm/components/metrics-treemap/metrics-treemap.js.map +1 -1
  159. package/lib-esm/components/metrics-treemap/metrics-treemap.module.css +3 -274
  160. package/lib-esm/components/metrics-treemap/metrics-treemap.utils.js +80 -18
  161. package/lib-esm/components/metrics-treemap/metrics-treemap.utils.js.map +1 -1
  162. package/lib-esm/components/metrics-treemap/tile/index.js +2 -0
  163. package/lib-esm/components/metrics-treemap/tile/index.js.map +1 -0
  164. package/lib-esm/components/metrics-treemap/tile/tile.js +40 -0
  165. package/lib-esm/components/metrics-treemap/tile/tile.js.map +1 -0
  166. package/lib-esm/components/metrics-treemap/tile/tile.module.css +145 -0
  167. package/lib-esm/components/metrics-treemap/tile-group/index.js +2 -0
  168. package/lib-esm/components/metrics-treemap/tile-group/index.js.map +1 -0
  169. package/lib-esm/components/metrics-treemap/tile-group/tile-group.js +35 -0
  170. package/lib-esm/components/metrics-treemap/tile-group/tile-group.js.map +1 -0
  171. package/lib-esm/components/metrics-treemap/tile-group/tile-group.module.css +57 -0
  172. package/lib-esm/components/metrics-treemap/tile-group-title/index.js +2 -0
  173. package/lib-esm/components/metrics-treemap/tile-group-title/index.js.map +1 -0
  174. package/lib-esm/components/metrics-treemap/tile-group-title/tile-group-title.js +17 -0
  175. package/lib-esm/components/metrics-treemap/tile-group-title/tile-group-title.js.map +1 -0
  176. package/lib-esm/components/metrics-treemap/tile-group-title/tile-group-title.module.css +48 -0
  177. package/lib-esm/components/sort-button/sort-button.module.css +0 -2
  178. package/lib-esm/components/summary/summary.js +5 -4
  179. package/lib-esm/components/summary/summary.js.map +1 -1
  180. package/lib-esm/components/summary/summary.module.css +10 -14
  181. package/lib-esm/css/default.css +7 -4
  182. package/lib-esm/css/variables.css +36 -25
  183. package/lib-esm/layout/flex-stack/flex-stack.js +3 -2
  184. package/lib-esm/layout/flex-stack/flex-stack.js.map +1 -1
  185. package/lib-esm/layout/flex-stack/flex-stack.module.css +65 -10
  186. package/lib-esm/query-state.js +7 -4
  187. package/lib-esm/query-state.js.map +1 -1
  188. package/lib-esm/ui/button/button.js +3 -2
  189. package/lib-esm/ui/button/button.js.map +1 -1
  190. package/lib-esm/ui/button/button.module.css +38 -27
  191. package/lib-esm/ui/control-group/control-group.js +1 -1
  192. package/lib-esm/ui/control-group/control-group.js.map +1 -1
  193. package/lib-esm/ui/copy-to-clipboard/copy-to-clipboard.module.css +2 -2
  194. package/lib-esm/ui/dialog/dialog.js +3 -1
  195. package/lib-esm/ui/dialog/dialog.js.map +1 -1
  196. package/lib-esm/ui/dialog/dialog.module.css +5 -0
  197. package/lib-esm/ui/dropdown/dropdown.js +9 -2
  198. package/lib-esm/ui/dropdown/dropdown.js.map +1 -1
  199. package/lib-esm/ui/dropdown/dropdown.module.css +49 -7
  200. package/lib-esm/ui/filters/filters.js +29 -17
  201. package/lib-esm/ui/filters/filters.js.map +1 -1
  202. package/lib-esm/ui/filters/filters.module.css +3 -19
  203. package/lib-esm/ui/hover-card/hover-card.js +7 -1
  204. package/lib-esm/ui/hover-card/hover-card.js.map +1 -1
  205. package/lib-esm/ui/hover-card/hover-card.module.css +5 -6
  206. package/lib-esm/ui/input/input.module.css +2 -2
  207. package/lib-esm/ui/table/table.module.css +12 -5
  208. package/lib-esm/ui/tabs/tabs.module.css +13 -9
  209. package/lib-esm/ui/tag/tag.module.css +0 -2
  210. package/lib-esm/ui/textarea/textarea.module.css +2 -2
  211. package/lib-esm/ui/toolbar/toolbar.js +2 -1
  212. package/lib-esm/ui/toolbar/toolbar.js.map +1 -1
  213. package/lib-esm/ui/toolbar/toolbar.module.css +0 -6
  214. package/lib-esm/ui/tooltip/tooltip.js +6 -1
  215. package/lib-esm/ui/tooltip/tooltip.js.map +1 -1
  216. package/lib-esm/ui/tooltip/tooltip.module.css +1 -1
  217. package/lib-esm/utils/index.js +1 -0
  218. package/lib-esm/utils/index.js.map +1 -1
  219. package/lib-esm/utils/portal.js +6 -0
  220. package/lib-esm/utils/portal.js.map +1 -0
  221. package/package.json +17 -17
  222. package/src/app/app.jsx +3 -2
  223. package/src/app/app.module.css +8 -9
  224. package/src/app/header/header.module.css +1 -3
  225. package/src/components/asset-name/asset-name.module.css +11 -10
  226. package/src/components/asset-name/asset-name.tsx +17 -14
  227. package/src/components/bundle-assets/bundle-assets.module.css +0 -12
  228. package/src/components/bundle-assets/bundle-assets.tsx +8 -1
  229. package/src/components/bundle-assets/index.tsx +3 -1
  230. package/src/components/bundle-assets-totals/bundle-assets-totals.jsx +6 -4
  231. package/src/components/bundle-modules/bundle-modules.module.css +2 -16
  232. package/src/components/bundle-modules/bundle-modules.tsx +10 -3
  233. package/src/components/bundle-modules/index.tsx +3 -1
  234. package/src/components/bundle-packages/bundle-packages.jsx +14 -3
  235. package/src/components/bundle-packages/bundle-packages.module.css +18 -22
  236. package/src/components/entry-info/entry-info.module.css +7 -2
  237. package/src/components/entry-info/entry-info.tsx +9 -3
  238. package/src/components/jobs-header/jobs-header.module.css +0 -1
  239. package/src/components/jobs-header/jobs-header.tsx +2 -2
  240. package/src/components/metric-change-legend/metric-change-legend.module.css +11 -0
  241. package/src/components/metric-change-legend/metric-change-legend.tsx +2 -2
  242. package/src/components/metric-run-info/metric-run-info.stories.tsx +9 -0
  243. package/src/components/metric-run-info/metric-run-info.tsx +10 -12
  244. package/src/components/metrics-display-selector/metrics-display-selector.module.css +0 -2
  245. package/src/components/metrics-table/metrics-table.module.css +4 -12
  246. package/src/components/metrics-table/metrics-table.tsx +70 -39
  247. package/src/components/metrics-table-options/metrics-table-options.tsx +14 -15
  248. package/src/components/metrics-table-row-count/index.ts +1 -0
  249. package/src/components/metrics-table-row-count/metrics-table-row-count.module.css +5 -0
  250. package/src/components/metrics-table-row-count/metrics-table-row-count.tsx +21 -0
  251. package/src/components/metrics-treemap/metrics-treemap.constants.ts +9 -0
  252. package/src/components/metrics-treemap/metrics-treemap.module.css +3 -274
  253. package/src/components/metrics-treemap/metrics-treemap.stories.utils.ts +46 -0
  254. package/src/components/metrics-treemap/metrics-treemap.tsx +123 -428
  255. package/src/components/metrics-treemap/metrics-treemap.utils.ts +161 -27
  256. package/src/components/metrics-treemap/tile/index.ts +1 -0
  257. package/src/components/metrics-treemap/tile/tile.module.css +145 -0
  258. package/src/components/metrics-treemap/tile/tile.stories.tsx +139 -0
  259. package/src/components/metrics-treemap/tile/tile.tsx +121 -0
  260. package/src/components/metrics-treemap/tile-group/index.ts +1 -0
  261. package/src/components/metrics-treemap/tile-group/tile-group.module.css +57 -0
  262. package/src/components/metrics-treemap/tile-group/tile-group.stories.tsx +163 -0
  263. package/src/components/metrics-treemap/tile-group/tile-group.tsx +177 -0
  264. package/src/components/metrics-treemap/tile-group-title/index.ts +1 -0
  265. package/src/components/metrics-treemap/tile-group-title/tile-group-title.module.css +48 -0
  266. package/src/components/metrics-treemap/tile-group-title/tile-group-title.stories.tsx +88 -0
  267. package/src/components/metrics-treemap/tile-group-title/tile-group-title.tsx +51 -0
  268. package/src/components/sort-button/sort-button.module.css +0 -2
  269. package/src/components/summary/summary.module.css +10 -14
  270. package/src/components/summary/summary.tsx +9 -8
  271. package/src/css/default.css +7 -4
  272. package/src/css/variables.css +36 -25
  273. package/src/layout/flex-stack/flex-stack.module.css +65 -10
  274. package/src/layout/flex-stack/flex-stack.stories.tsx +68 -9
  275. package/src/layout/flex-stack/flex-stack.tsx +24 -4
  276. package/src/query-state.tsx +9 -4
  277. package/src/ui/button/button.module.css +38 -27
  278. package/src/ui/button/button.stories.tsx +1 -1
  279. package/src/ui/button/button.tsx +3 -1
  280. package/src/ui/control-group/control-group.tsx +1 -1
  281. package/src/ui/copy-to-clipboard/copy-to-clipboard.module.css +2 -2
  282. package/src/ui/dialog/dialog.module.css +5 -0
  283. package/src/ui/dialog/dialog.stories.tsx +8 -0
  284. package/src/ui/dialog/dialog.tsx +7 -0
  285. package/src/ui/dropdown/dropdown.module.css +49 -7
  286. package/src/ui/dropdown/dropdown.stories.tsx +6 -0
  287. package/src/ui/dropdown/dropdown.tsx +13 -2
  288. package/src/ui/filters/filters.module.css +3 -19
  289. package/src/ui/filters/filters.tsx +131 -67
  290. package/src/ui/hover-card/hover-card.module.css +5 -6
  291. package/src/ui/hover-card/hover-card.tsx +7 -1
  292. package/src/ui/input/input.module.css +2 -2
  293. package/src/ui/table/table.module.css +12 -5
  294. package/src/ui/tabs/tabs.module.css +13 -9
  295. package/src/ui/tag/tag.module.css +0 -2
  296. package/src/ui/textarea/textarea.module.css +2 -2
  297. package/src/ui/toolbar/toolbar.jsx +4 -1
  298. package/src/ui/toolbar/toolbar.module.css +0 -6
  299. package/src/ui/tooltip/tooltip.module.css +1 -1
  300. package/src/ui/tooltip/tooltip.tsx +6 -1
  301. package/src/utils/index.ts +1 -0
  302. package/src/utils/portal.ts +9 -0
  303. package/types/components/metric-run-info/metric-run-info.d.ts +1 -0
  304. package/types/components/metrics-table/metrics-table.d.ts +2 -1
  305. package/types/components/metrics-table-row-count/index.d.ts +1 -0
  306. package/types/components/metrics-table-row-count/metrics-table-row-count.d.ts +7 -0
  307. package/types/components/metrics-treemap/metrics-treemap.constants.d.ts +2 -0
  308. package/types/components/metrics-treemap/metrics-treemap.utils.d.ts +16 -5
  309. package/types/components/metrics-treemap/tile/index.d.ts +1 -0
  310. package/types/components/metrics-treemap/tile/tile.d.ts +11 -0
  311. package/types/components/metrics-treemap/tile-group/index.d.ts +1 -0
  312. package/types/components/metrics-treemap/tile-group/tile-group.d.ts +20 -0
  313. package/types/components/metrics-treemap/tile-group-title/index.d.ts +1 -0
  314. package/types/components/metrics-treemap/tile-group-title/tile-group-title.d.ts +12 -0
  315. package/types/layout/flex-stack/flex-stack.d.ts +6 -2
  316. package/types/ui/button/button.d.ts +1 -0
  317. package/types/ui/dropdown/dropdown.d.ts +3 -1
  318. package/types/ui/filters/filters.d.ts +2 -1
  319. package/types/utils/index.d.ts +1 -0
  320. package/types/utils/portal.d.ts +1 -0
  321. package/vitest.config.ts +4 -0
  322. package/lib/components/metrics-table-options/metrics-table-options.module.css +0 -15
  323. package/lib-esm/components/metrics-table-options/metrics-table-options.module.css +0 -15
  324. package/src/components/metrics-table-options/metrics-table-options.module.css +0 -15
@@ -0,0 +1,163 @@
1
+ import React from 'react';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+ import { action } from 'storybook/actions';
4
+ import { HierarchyRectangularNode, hierarchy, treemap, treemapSquarify } from 'd3';
5
+ import type { ReportMetricRow } from '@bundle-stats/utils';
6
+
7
+ import { getWrapperDecorator } from '../../../stories';
8
+ import {
9
+ type Tree,
10
+ type TreeNode,
11
+ SQUARIFY_RATIO,
12
+ PADDING_OUTER,
13
+ PADDING_INNER,
14
+ NESTED_PADDING,
15
+ NESTED_PADDING_TOP,
16
+ NESTED_PADDING_LEFT,
17
+ } from '../metrics-treemap.constants';
18
+ import {
19
+ CURRENT_VALUE_BY_DELTA_TYPE as VALUES,
20
+ createReportMetricRow,
21
+ } from '../metrics-treemap.stories.utils';
22
+ import { getTreemapNodes, getTreemapNodesGroupedByPath } from '../metrics-treemap.utils';
23
+ import { TileGroup } from '.';
24
+
25
+ const WIDTH = 480;
26
+ const HEIGHT = 270;
27
+
28
+ const ITEMS = [
29
+ createReportMetricRow('src/components/button/button.tsx', VALUES.NEGATIVE),
30
+ createReportMetricRow('src/components/button/button.css', VALUES.NO_CHANGE),
31
+ createReportMetricRow('src/components/input/input.tsx', VALUES.HIGH_NEGATIVE),
32
+ createReportMetricRow('src/components/input/input.css', VALUES.LOW_POSITIVE),
33
+ createReportMetricRow('src/utils/format.ts', VALUES.POSITIVE),
34
+ createReportMetricRow('src/assets/logo.svg', VALUES.NO_CHANGE),
35
+ createReportMetricRow('src/index.ts', VALUES.NO_CHANGE),
36
+ ];
37
+
38
+ const ITEMS_NO_CHANGE = [
39
+ createReportMetricRow('src/components/button.tsx', VALUES.NO_CHANGE),
40
+ createReportMetricRow('src/components/input.tsx', VALUES.NO_CHANGE),
41
+ createReportMetricRow('src/index.ts', VALUES.NO_CHANGE),
42
+ ];
43
+
44
+ const ITEMS_POSITIVE = [
45
+ createReportMetricRow('src/components/button.tsx', VALUES.POSITIVE),
46
+ createReportMetricRow('src/components/input.tsx', VALUES.HIGH_POSITIVE),
47
+ createReportMetricRow('src/index.ts', VALUES.NO_CHANGE),
48
+ ];
49
+
50
+ /**
51
+ * Resolve the root tile group props - same layout as `MetricsTreemap`
52
+ */
53
+ function getTileGroupArgs(
54
+ treeNodes: Tree,
55
+ options: { nested?: boolean; width?: number; height?: number } = {},
56
+ ) {
57
+ const { nested = false, width = WIDTH, height = HEIGHT } = options;
58
+
59
+ const customHierarchy = hierarchy<Tree>(treeNodes);
60
+ customHierarchy.sum((node) => node.value);
61
+ // @ts-expect-error
62
+ customHierarchy.sort((a, b) => b.value - a.value);
63
+
64
+ let createTreemapLayout = treemap()
65
+ .size([width, height])
66
+ .tile(treemapSquarify.ratio(SQUARIFY_RATIO))
67
+ .paddingOuter(PADDING_OUTER);
68
+
69
+ if (nested) {
70
+ createTreemapLayout = createTreemapLayout
71
+ .padding(NESTED_PADDING)
72
+ .paddingLeft(NESTED_PADDING_LEFT)
73
+ .paddingTop(NESTED_PADDING_TOP);
74
+ } else {
75
+ createTreemapLayout = createTreemapLayout.paddingInner(PADDING_INNER);
76
+ }
77
+
78
+ // @ts-expect-error
79
+ const rootNode = createTreemapLayout(customHierarchy) as HierarchyRectangularNode<TreeNode>;
80
+ const rootData = rootNode.data as Tree;
81
+
82
+ return {
83
+ title: nested ? rootData.label : undefined,
84
+ total: rootData.total,
85
+ id: rootData.id,
86
+ childNodes: rootNode.children,
87
+ nested,
88
+ left: rootNode.x0,
89
+ top: rootNode.y0,
90
+ absoluteLeft: rootNode.x0,
91
+ absoluteTop: rootNode.y0,
92
+ width: rootNode.x1 - rootNode.x0,
93
+ height: rootNode.y1 - rootNode.y0,
94
+ };
95
+ }
96
+
97
+ function getNestedTileGroupArgs(
98
+ items: Array<ReportMetricRow>,
99
+ options: { width?: number; height?: number } = {},
100
+ ) {
101
+ return getTileGroupArgs(getTreemapNodesGroupedByPath(items), { ...options, nested: true });
102
+ }
103
+
104
+ const meta = {
105
+ title: 'Components/MetricsTreemap/TileGroup',
106
+ component: TileGroup,
107
+ decorators: [
108
+ // Tile groups are absolutely positioned inside the treemap canvas
109
+ (Story, { args }) => (
110
+ <div
111
+ style={{
112
+ position: 'relative',
113
+ width: args.width,
114
+ height: args.height,
115
+ background: 'var(--color-background)',
116
+ }}
117
+ >
118
+ <Story />
119
+ </div>
120
+ ),
121
+ getWrapperDecorator(),
122
+ ],
123
+ args: {
124
+ ...getTileGroupArgs(getTreemapNodes(ITEMS)),
125
+ onItemClick: action('ITEM_CLICK'),
126
+ onGroupClick: action('GROUP_CLICK'),
127
+ },
128
+ } satisfies Meta<typeof TileGroup>;
129
+
130
+ export default meta;
131
+
132
+ type Story = StoryObj<typeof meta>;
133
+
134
+ export const Default: Story = {};
135
+
136
+ /**
137
+ * Nested
138
+ */
139
+ export const Nested: Story = {
140
+ args: getNestedTileGroupArgs(ITEMS),
141
+ };
142
+
143
+ /**
144
+ * Delta type
145
+ */
146
+ export const NestedNoChange: Story = {
147
+ args: getNestedTileGroupArgs(ITEMS_NO_CHANGE),
148
+ };
149
+
150
+ export const NestedPositive: Story = {
151
+ args: getNestedTileGroupArgs(ITEMS_POSITIVE),
152
+ };
153
+
154
+ /**
155
+ * Size
156
+ */
157
+ export const SizeSmall: Story = {
158
+ args: getNestedTileGroupArgs(ITEMS, { height: 28 }),
159
+ };
160
+
161
+ export const SizeMinimal: Story = {
162
+ args: getNestedTileGroupArgs(ITEMS, { height: 20 }),
163
+ };
@@ -0,0 +1,177 @@
1
+ import React, { type ComponentProps, type MouseEventHandler, useCallback, useMemo } from 'react';
2
+ import cx from 'classnames';
3
+ import type { HierarchyRectangularNode } from 'd3';
4
+
5
+ import type { TreeLeaf, TreeNode, Tree } from '../metrics-treemap.constants';
6
+ import * as I18N from '../metrics-treemap.i18n';
7
+ import { getGroupRunInfo, resolveTileGroupSizeDisplay } from '../metrics-treemap.utils';
8
+ import { type TileProps, Tile } from '../tile';
9
+ import { TileGroupTitle } from '../tile-group-title';
10
+ import css from './tile-group.module.css';
11
+
12
+ export interface TileGroupProps extends ComponentProps<'div'> {
13
+ /**
14
+ * Node title
15
+ */
16
+ title?: string;
17
+ /**
18
+ * Group sum
19
+ */
20
+ total?: Tree['total'];
21
+ /**
22
+ * Node id
23
+ */
24
+ id: string;
25
+ /**
26
+ * Node children
27
+ */
28
+ childNodes: HierarchyRectangularNode<TreeNode>['children'];
29
+ /**
30
+ * Nested treemap variation
31
+ */
32
+ nested?: boolean;
33
+ /**
34
+ * On click tile handler
35
+ */
36
+ onItemClick: TileProps['onClick'];
37
+ /**
38
+ * On click group title
39
+ */
40
+ onGroupClick?: (groupId: string) => void;
41
+
42
+ /**
43
+ * Node rectangle dimensions
44
+ */
45
+ width?: number;
46
+ height?: number;
47
+
48
+ /**
49
+ * Node rectangle relative coordinates (relative to parent)
50
+ */
51
+ left: number;
52
+ top: number;
53
+
54
+ /**
55
+ * Node rectangle absolute coordinates (relative to canvas)
56
+ */
57
+ absoluteLeft: number;
58
+ absoluteTop: number;
59
+ }
60
+
61
+ export const TileGroup = (props: TileGroupProps) => {
62
+ const {
63
+ title = '',
64
+ total,
65
+ id,
66
+ childNodes,
67
+ nested = false,
68
+ onItemClick,
69
+ onGroupClick,
70
+ left,
71
+ top,
72
+ width,
73
+ height,
74
+ absoluteLeft,
75
+ absoluteTop,
76
+ } = props;
77
+
78
+ const onClick: MouseEventHandler<HTMLDivElement> = useCallback(
79
+ (event) => {
80
+ onGroupClick?.(id);
81
+ event.stopPropagation();
82
+ },
83
+ [onGroupClick, id],
84
+ );
85
+
86
+ const displaySize = useMemo(
87
+ () => resolveTileGroupSizeDisplay(width || 0, height || 0),
88
+ [width, height],
89
+ );
90
+
91
+ // Prepare data
92
+ const groupRunInfo = useMemo(() => (total ? getGroupRunInfo(total) : undefined), [total]);
93
+
94
+ const rootClassName = cx(
95
+ css.root,
96
+ css[`tileGroup--${groupRunInfo?.deltaType}`],
97
+ css[`tileGroup--${displaySize}`],
98
+ nested && css.nested,
99
+ );
100
+
101
+ /* eslint-disable jsx-a11y/click-events-have-key-events, jsx-a11y/interactive-supports-focus */
102
+ if (title && displaySize === 'minimal') {
103
+ return (
104
+ <div
105
+ onClick={onClick}
106
+ role="button"
107
+ aria-label={I18N.TILE_GROUP_LABEL}
108
+ className={rootClassName}
109
+ style={{ left, top, width, height }}
110
+ >
111
+ <TileGroupTitle id={id} fill />
112
+ </div>
113
+ );
114
+ }
115
+
116
+ if (title && displaySize === 'small') {
117
+ return (
118
+ <div
119
+ onClick={onClick}
120
+ role="button"
121
+ aria-label={I18N.TILE_GROUP_LABEL}
122
+ style={{ left, top, width, height }}
123
+ className={rootClassName}
124
+ >
125
+ <TileGroupTitle id={id} title={title} fill />
126
+ </div>
127
+ );
128
+ }
129
+
130
+ return (
131
+ <div
132
+ onClick={onClick}
133
+ role="button"
134
+ aria-label={I18N.TILE_GROUP_LABEL}
135
+ className={cx(rootClassName, css.tileGroupSizeDefault)}
136
+ style={{ left, top, width, height }}
137
+ >
138
+ <TileGroupTitle id={id} title={title} runInfo={groupRunInfo?.runInfo} />
139
+ {childNodes?.map((childNode) => {
140
+ if ('children' in childNode) {
141
+ const groupData = childNode.data as Tree;
142
+
143
+ return (
144
+ <TileGroup
145
+ title={groupData.label}
146
+ total={groupData.total}
147
+ id={groupData.id}
148
+ childNodes={childNode.children}
149
+ nested={nested}
150
+ left={childNode.x0 - absoluteLeft}
151
+ top={childNode.y0 - absoluteTop}
152
+ absoluteLeft={childNode.x0}
153
+ absoluteTop={childNode.y0}
154
+ width={childNode.x1 - childNode.x0}
155
+ height={childNode.y1 - childNode.y0}
156
+ onItemClick={onItemClick}
157
+ onGroupClick={onGroupClick}
158
+ key={groupData.id}
159
+ />
160
+ );
161
+ }
162
+
163
+ return (
164
+ <Tile
165
+ data={childNode.data as TreeLeaf}
166
+ left={childNode.x0 - absoluteLeft}
167
+ top={childNode.y0 - absoluteTop}
168
+ width={childNode.x1 - childNode.x0}
169
+ height={childNode.y1 - childNode.y0}
170
+ onClick={onItemClick}
171
+ key={childNode.data.id}
172
+ />
173
+ );
174
+ })}
175
+ </div>
176
+ );
177
+ };
@@ -0,0 +1 @@
1
+ export * from './tile-group-title';
@@ -0,0 +1,48 @@
1
+ .root {
2
+ width: 100%;
3
+ cursor: default;
4
+ }
5
+
6
+ .tileGroupTitleContent {
7
+ width: 100%;
8
+ padding: var(--space-xxxsmall) calc(var(--space-xxxsmall) / 2) var(--space-xxxsmall) var(--space-xxsmall);
9
+ border-radius: var(--radius-xsmall);
10
+ display: flex;
11
+ align-items: center;
12
+ color: var(--color-text);
13
+ font-family: var(--font-family-fixed);
14
+ font-size: 10px;
15
+ line-height: var(--space-small);
16
+ overflow: hidden;
17
+ white-space: nowrap;
18
+ text-overflow: ellipsis;
19
+ }
20
+
21
+ .tileGroupTitleText,
22
+ .tileGroupTitleTotal {
23
+ flex: 0 0 auto;
24
+ min-width: 0;
25
+ }
26
+
27
+ .tileGroupTitleTotal {
28
+ margin-left: var(--space-xxsmall);
29
+ color: var(--color-text-light);
30
+ }
31
+
32
+ .root {
33
+ transition: var(--transition-out);
34
+ }
35
+
36
+ .root:hover .tileGroupTitleText {
37
+ text-decoration: underline;
38
+ transition: var(--transition-in);
39
+ }
40
+
41
+ /** Fill variation */
42
+ .fill {
43
+ height: 100%;
44
+ }
45
+
46
+ .fill .tileGroupTitleContent {
47
+ min-height: 100%;
48
+ }
@@ -0,0 +1,88 @@
1
+ import React from 'react';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+ import { type MetricRunInfo, METRIC_TYPE_CONFIGS, getMetricRunInfo } from '@bundle-stats/utils';
4
+
5
+ import { getWrapperDecorator } from '../../../stories';
6
+ import { BASELINE_VALUE, CURRENT_VALUE_BY_DELTA_TYPE } from '../metrics-treemap.stories.utils';
7
+ import { TileGroupTitle } from '.';
8
+
9
+ const meta = {
10
+ title: 'Components/MetricsTreemap/TileGroupTitle',
11
+ component: TileGroupTitle,
12
+ decorators: [
13
+ // Outline the group area to visualize the title size
14
+ (Story) => (
15
+ <div style={{ width: 320, height: 48, outline: '1px dashed var(--color-outline)' }}>
16
+ <Story />
17
+ </div>
18
+ ),
19
+ getWrapperDecorator(),
20
+ ],
21
+ args: {
22
+ id: 'src/components',
23
+ title: 'components',
24
+ runInfo: getMetricRunInfo(
25
+ METRIC_TYPE_CONFIGS.METRIC_TYPE_FILE_SIZE,
26
+ CURRENT_VALUE_BY_DELTA_TYPE.NEGATIVE,
27
+ BASELINE_VALUE,
28
+ ) as MetricRunInfo,
29
+ fill: false,
30
+ },
31
+ argTypes: {
32
+ fill: {
33
+ control: { type: 'boolean' },
34
+ },
35
+ },
36
+ } satisfies Meta<typeof TileGroupTitle>;
37
+
38
+ export default meta;
39
+
40
+ type Story = StoryObj<typeof meta>;
41
+
42
+ export const Default: Story = {};
43
+
44
+ /**
45
+ * Run info
46
+ */
47
+ export const NoBaseline: Story = {
48
+ args: {
49
+ runInfo: getMetricRunInfo(
50
+ METRIC_TYPE_CONFIGS.METRIC_TYPE_FILE_SIZE,
51
+ CURRENT_VALUE_BY_DELTA_TYPE.NEGATIVE,
52
+ ) as MetricRunInfo,
53
+ },
54
+ };
55
+
56
+ export const NoRunInfo: Story = {
57
+ args: {
58
+ runInfo: undefined,
59
+ },
60
+ };
61
+
62
+ /**
63
+ * Title
64
+ */
65
+ export const NoTitle: Story = {
66
+ args: {
67
+ title: undefined,
68
+ runInfo: undefined,
69
+ },
70
+ };
71
+
72
+ /**
73
+ * Fill
74
+ */
75
+ export const Fill: Story = {
76
+ args: {
77
+ fill: true,
78
+ runInfo: undefined,
79
+ },
80
+ };
81
+
82
+ export const FillNoTitle: Story = {
83
+ args: {
84
+ fill: true,
85
+ title: undefined,
86
+ runInfo: undefined,
87
+ },
88
+ };
@@ -0,0 +1,51 @@
1
+ import React from 'react';
2
+ import cx from 'classnames';
3
+ import type { MetricRunInfo } from '@bundle-stats/utils';
4
+
5
+ import css from './tile-group-title.module.css';
6
+
7
+ interface TileGroupTitleContentProps {
8
+ title?: string;
9
+ runInfo?: MetricRunInfo;
10
+ }
11
+
12
+ const TileGroupTitleContent = (props: TileGroupTitleContentProps) => {
13
+ const { title, runInfo } = props;
14
+
15
+ return (
16
+ <div className={css.tileGroupTitleContent}>
17
+ {title && <span className={css.tileGroupTitleText}>{title}</span>}
18
+ {runInfo && (
19
+ <span className={css.tileGroupTitleTotal}>
20
+ {runInfo.displayValue}
21
+ {'displayDelta' in runInfo && `(${runInfo.displayDeltaPercentage})`}
22
+ </span>
23
+ )}
24
+ </div>
25
+ );
26
+ };
27
+
28
+ export type TileGroupTitleProps = TileGroupTitleContentProps & {
29
+ /**
30
+ * Node id - used to resolve the tooltip content on hover
31
+ */
32
+ id: string;
33
+ /**
34
+ * Fill the group height - when the title is missing or the group does not render any children
35
+ */
36
+ fill?: boolean;
37
+ };
38
+
39
+ export const TileGroupTitle = (props: TileGroupTitleProps) => {
40
+ const { id, fill = false, ...restProps } = props;
41
+
42
+ return (
43
+ <div
44
+ className={cx(css.root, fill && css.fill)}
45
+ data-treemap-id={id}
46
+ data-treemap-tile-group-title
47
+ >
48
+ <TileGroupTitleContent {...restProps} />
49
+ </div>
50
+ );
51
+ };
@@ -18,7 +18,6 @@
18
18
  overflow: hidden;
19
19
  right: -2px; /* compensate for the button padding */
20
20
  color: var(--color-text-ultra-light);
21
- transition: var(--transition-out);
22
21
  }
23
22
 
24
23
  .directionIcon {
@@ -36,7 +35,6 @@
36
35
  .direction:active,
37
36
  .direction:focus {
38
37
  color: var(--color-text-dark);
39
- transition: var(--transition-in);
40
38
  }
41
39
 
42
40
  .directionAsc {
@@ -5,10 +5,6 @@
5
5
 
6
6
  .row {
7
7
  width: 100%;
8
- display: flex;
9
- align-items: stretch;
10
- flex-wrap: wrap;
11
- gap: var(--space-small);
12
8
  }
13
9
 
14
10
  .rowGroup {
@@ -26,13 +22,6 @@
26
22
  margin-top: var(--summary-gap);
27
23
  }
28
24
 
29
- .items {
30
- display: flex;
31
- align-items: stretch;
32
- flex-wrap: wrap;
33
- gap: var(--space-medium);
34
- }
35
-
36
25
  .item {
37
26
  flex: 1 1 10%; /* force equal sizes */
38
27
  min-width: 8em;
@@ -42,7 +31,7 @@
42
31
  }
43
32
 
44
33
  .item::before {
45
- content: "";
34
+ content: '';
46
35
  border-radius: var(--radius-medium);
47
36
  background: var(--color-highlight);
48
37
  display: block;
@@ -56,13 +45,15 @@
56
45
  transition: var(--transition-out);
57
46
  }
58
47
 
48
+ .item:focus::before,
49
+ .item:active::before,
59
50
  .item:hover::before {
60
51
  opacity: 1;
61
52
  transition: var(--transition-in);
62
53
  }
63
54
 
64
55
  .item + .item::after {
65
- content: "";
56
+ content: '';
66
57
  border-radius: var(--radius-medium);
67
58
  background: var(--color-outline);
68
59
  display: block;
@@ -75,7 +66,12 @@
75
66
  transition: var(--transition-out);
76
67
  }
77
68
 
78
- .item:hover::after, .item:hover + .item::after {
69
+ .item:focus::after,
70
+ .item:active::after,
71
+ .item:hover::after,
72
+ .item:focus + .item::after,
73
+ .item:active + .item::after,
74
+ .item:hover + .item::after {
79
75
  opacity: 0;
80
76
  transition: var(--transition-in);
81
77
  }
@@ -10,6 +10,7 @@ import {
10
10
  METRICS_WEBPACK_GENERAL,
11
11
  } from '../../constants';
12
12
  import { Box } from '../../layout/box';
13
+ import { FlexStack } from '../../layout/flex-stack';
13
14
  import { ComponentLink } from '../component-link';
14
15
  import { MetricRunInfo, MetricRunInfoProps } from '../metric-run-info';
15
16
  import css from './summary.module.css';
@@ -77,9 +78,9 @@ export const Summary = ({
77
78
  summaryItemLink = ComponentLink,
78
79
  }: SummaryProps & React.ComponentProps<'div'>) => (
79
80
  <Box className={cx(css.root, className)}>
80
- <div className={css.row}>
81
+ <FlexStack wrap="wrap" gap="small" className={css.row}>
81
82
  <Box outline padding="small" className={css.rowGroup}>
82
- <div className={css.items}>
83
+ <FlexStack wrap="wrap" gap="medium">
83
84
  {METRICS_WEBPACK_GENERAL.map((metricId) => (
84
85
  <SummaryItem
85
86
  key={metricId}
@@ -93,15 +94,15 @@ export const Summary = ({
93
94
  showBaseline={showSummaryItemBaseline}
94
95
  />
95
96
  ))}
96
- </div>
97
+ </FlexStack>
97
98
  </Box>
98
- </div>
99
- <div className={css.row}>
99
+ </FlexStack>
100
+ <FlexStack wrap="wrap" gap="small" className={css.row}>
100
101
  {[METRICS_GROUP_ASSETS, METRICS_GROUP_MODULES, METRICS_GROUP_PACKAGES].map((metricGroup) => (
101
102
  <Stack className={css.rowGroup} key={metricGroup.title}>
102
103
  <h3 className={css.rowGroupTitle}>{metricGroup.title}</h3>
103
104
  <Box outline padding="small">
104
- <div className={css.items}>
105
+ <FlexStack wrap="wrap" gap="medium">
105
106
  {metricGroup.metrics.map((metricId) => (
106
107
  <SummaryItem
107
108
  key={metricId}
@@ -115,10 +116,10 @@ export const Summary = ({
115
116
  showBaseline={showSummaryItemBaseline}
116
117
  />
117
118
  ))}
118
- </div>
119
+ </FlexStack>
119
120
  </Box>
120
121
  </Stack>
121
122
  ))}
122
- </div>
123
+ </FlexStack>
123
124
  </Box>
124
125
  );
@@ -15,6 +15,7 @@ html {
15
15
 
16
16
  body {
17
17
  background: var(--color-background);
18
+ accent-color: var(--color-accent);
18
19
  color: var(--color-text);
19
20
  line-height: var(--line-height);
20
21
  }
@@ -59,12 +60,14 @@ code {
59
60
  }
60
61
 
61
62
  a {
62
- color: var(--color-primary);
63
+ color: var(--color-accent);
64
+ transition: var(--transition-out);
63
65
  }
64
66
 
65
- a:hover,
67
+ a:focus,
66
68
  a:active,
67
- a:focus {
68
- color: var(--color-primary-dark);
69
+ a:hover {
70
+ color: var(--color-accent-dark);
69
71
  outline: none;
72
+ transition: var(--transition-in);
70
73
  }