@bundle-stats/ui 4.22.3 → 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.
- package/lib/app/app.js +4 -0
- package/lib/app/app.js.map +1 -1
- package/lib/app/app.module.css +14 -5
- package/lib/app/header/header.module.css +1 -3
- package/lib/components/asset-name/asset-name.js +8 -7
- package/lib/components/asset-name/asset-name.js.map +1 -1
- package/lib/components/asset-name/asset-name.module.css +11 -10
- package/lib/components/bundle-assets/bundle-assets.js +4 -2
- package/lib/components/bundle-assets/bundle-assets.js.map +1 -1
- package/lib/components/bundle-assets/bundle-assets.module.css +0 -12
- package/lib/components/bundle-assets/index.js +2 -1
- package/lib/components/bundle-assets/index.js.map +1 -1
- package/lib/components/bundle-assets-totals/bundle-assets-totals.js +4 -2
- package/lib/components/bundle-assets-totals/bundle-assets-totals.js.map +1 -1
- package/lib/components/bundle-modules/bundle-modules.js +5 -3
- package/lib/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib/components/bundle-modules/bundle-modules.module.css +2 -16
- package/lib/components/bundle-modules/index.js +2 -1
- package/lib/components/bundle-modules/index.js.map +1 -1
- package/lib/components/bundle-packages/bundle-packages.js +5 -3
- package/lib/components/bundle-packages/bundle-packages.js.map +1 -1
- package/lib/components/bundle-packages/bundle-packages.module.css +18 -22
- package/lib/components/delta/delta.js +3 -13
- package/lib/components/delta/delta.js.map +1 -1
- package/lib/components/delta/delta.module.css +13 -12
- package/lib/components/delta/index.js.map +1 -1
- package/lib/components/entry-info/entry-info.js +4 -2
- package/lib/components/entry-info/entry-info.js.map +1 -1
- package/lib/components/entry-info/entry-info.module.css +7 -2
- package/lib/components/index.js +3 -1
- package/lib/components/index.js.map +1 -1
- package/lib/components/insight-icon/insight-icon.module.css +6 -6
- package/lib/components/job-name/job-name.js +1 -2
- package/lib/components/job-name/job-name.js.map +1 -1
- package/lib/components/jobs-header/jobs-header.js +1 -1
- package/lib/components/jobs-header/jobs-header.js.map +1 -1
- package/lib/components/jobs-header/jobs-header.module.css +0 -1
- package/lib/components/metric-change-legend/index.js +18 -0
- package/lib/components/metric-change-legend/index.js.map +1 -0
- package/lib/components/metric-change-legend/metric-change-legend.js +91 -0
- package/lib/components/metric-change-legend/metric-change-legend.js.map +1 -0
- package/lib/components/metric-change-legend/metric-change-legend.module.css +80 -0
- package/lib/components/metric-run-info/metric-run-info.js +24 -8
- package/lib/components/metric-run-info/metric-run-info.js.map +1 -1
- package/lib/components/metrics-display-selector/metrics-display-selector.js +7 -9
- package/lib/components/metrics-display-selector/metrics-display-selector.js.map +1 -1
- package/lib/components/metrics-display-selector/metrics-display-selector.module.css +0 -27
- package/lib/components/metrics-table/metrics-table.js +31 -20
- package/lib/components/metrics-table/metrics-table.js.map +1 -1
- package/lib/components/metrics-table/metrics-table.module.css +4 -12
- package/lib/components/metrics-table-header/metrics-table-header.js +6 -6
- package/lib/components/metrics-table-header/metrics-table-header.js.map +1 -1
- package/lib/components/metrics-table-header/metrics-table-header.module.css +8 -12
- package/lib/components/metrics-table-options/metrics-table-options.js +4 -5
- package/lib/components/metrics-table-options/metrics-table-options.js.map +1 -1
- package/lib/components/metrics-table-row-count/index.js +18 -0
- package/lib/components/metrics-table-row-count/index.js.map +1 -0
- package/lib/components/metrics-table-row-count/metrics-table-row-count.js +17 -0
- package/lib/components/metrics-table-row-count/metrics-table-row-count.js.map +1 -0
- package/lib/components/metrics-table-row-count/metrics-table-row-count.module.css +5 -0
- package/lib/components/metrics-table-title/metrics-table-title.js +1 -1
- package/lib/components/metrics-table-title/metrics-table-title.js.map +1 -1
- package/lib/components/metrics-treemap/metrics-treemap.constants.js +3 -1
- package/lib/components/metrics-treemap/metrics-treemap.constants.js.map +1 -1
- package/lib/components/metrics-treemap/metrics-treemap.js +46 -113
- package/lib/components/metrics-treemap/metrics-treemap.js.map +1 -1
- package/lib/components/metrics-treemap/metrics-treemap.module.css +3 -274
- package/lib/components/metrics-treemap/metrics-treemap.utils.js +81 -16
- package/lib/components/metrics-treemap/metrics-treemap.utils.js.map +1 -1
- package/lib/components/metrics-treemap/tile/index.js +18 -0
- package/lib/components/metrics-treemap/tile/index.js.map +1 -0
- package/lib/components/metrics-treemap/tile/tile.js +79 -0
- package/lib/components/metrics-treemap/tile/tile.js.map +1 -0
- package/lib/components/metrics-treemap/tile/tile.module.css +145 -0
- package/lib/components/metrics-treemap/tile-group/index.js +18 -0
- package/lib/components/metrics-treemap/tile-group/index.js.map +1 -0
- package/lib/components/metrics-treemap/tile-group/tile-group.js +75 -0
- package/lib/components/metrics-treemap/tile-group/tile-group.js.map +1 -0
- package/lib/components/metrics-treemap/tile-group/tile-group.module.css +57 -0
- package/lib/components/metrics-treemap/tile-group-title/index.js +18 -0
- package/lib/components/metrics-treemap/tile-group-title/index.js.map +1 -0
- package/lib/components/metrics-treemap/tile-group-title/tile-group-title.js +24 -0
- package/lib/components/metrics-treemap/tile-group-title/tile-group-title.js.map +1 -0
- package/lib/components/metrics-treemap/tile-group-title/tile-group-title.module.css +48 -0
- package/lib/components/run-info/run-info.js +26 -14
- package/lib/components/run-info/run-info.js.map +1 -1
- package/lib/components/run-info/run-info.module.css +35 -26
- package/lib/components/sort-button/sort-button.module.css +0 -2
- package/lib/components/summary/summary.js +10 -10
- package/lib/components/summary/summary.js.map +1 -1
- package/lib/components/summary/summary.module.css +60 -14
- package/lib/constants.js +13 -1
- package/lib/constants.js.map +1 -1
- package/lib/css/default.css +7 -4
- package/lib/css/variables.css +84 -60
- package/lib/layout/flex-stack/flex-stack.js +2 -2
- package/lib/layout/flex-stack/flex-stack.js.map +1 -1
- package/lib/layout/flex-stack/flex-stack.module.css +65 -10
- package/lib/query-state.js +6 -3
- package/lib/query-state.js.map +1 -1
- package/lib/ui/button/button.js +3 -2
- package/lib/ui/button/button.js.map +1 -1
- package/lib/ui/button/button.module.css +38 -27
- package/lib/ui/control-group/control-group.js +1 -1
- package/lib/ui/control-group/control-group.js.map +1 -1
- package/lib/ui/copy-to-clipboard/copy-to-clipboard.module.css +2 -2
- package/lib/ui/dialog/dialog.js +7 -3
- package/lib/ui/dialog/dialog.js.map +1 -1
- package/lib/ui/dialog/dialog.module.css +27 -0
- package/lib/ui/dropdown/dropdown.js +13 -4
- package/lib/ui/dropdown/dropdown.js.map +1 -1
- package/lib/ui/dropdown/dropdown.module.css +60 -7
- package/lib/ui/filters/filters.js +28 -16
- package/lib/ui/filters/filters.js.map +1 -1
- package/lib/ui/filters/filters.module.css +3 -19
- package/lib/ui/hover-card/hover-card.js +7 -1
- package/lib/ui/hover-card/hover-card.js.map +1 -1
- package/lib/ui/hover-card/hover-card.module.css +18 -5
- package/lib/ui/input/input.module.css +2 -2
- package/lib/ui/table/table.module.css +12 -6
- package/lib/ui/tabs/tabs.module.css +13 -9
- package/lib/ui/tag/tag.module.css +0 -2
- package/lib/ui/textarea/textarea.module.css +2 -2
- package/lib/ui/toolbar/toolbar.js +2 -1
- package/lib/ui/toolbar/toolbar.js.map +1 -1
- package/lib/ui/toolbar/toolbar.module.css +0 -6
- package/lib/ui/tooltip/tooltip.js +6 -1
- package/lib/ui/tooltip/tooltip.js.map +1 -1
- package/lib/ui/tooltip/tooltip.module.css +12 -1
- package/lib/utils/index.js +1 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/portal.js +10 -0
- package/lib/utils/portal.js.map +1 -0
- package/lib-esm/app/app.js +5 -1
- package/lib-esm/app/app.js.map +1 -1
- package/lib-esm/app/app.module.css +14 -5
- package/lib-esm/app/header/header.module.css +1 -3
- package/lib-esm/components/asset-name/asset-name.js +8 -7
- package/lib-esm/components/asset-name/asset-name.js.map +1 -1
- package/lib-esm/components/asset-name/asset-name.module.css +11 -10
- package/lib-esm/components/bundle-assets/bundle-assets.js +4 -2
- package/lib-esm/components/bundle-assets/bundle-assets.js.map +1 -1
- package/lib-esm/components/bundle-assets/bundle-assets.module.css +0 -12
- package/lib-esm/components/bundle-assets/index.js +2 -1
- package/lib-esm/components/bundle-assets/index.js.map +1 -1
- package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.js +4 -2
- package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.js.map +1 -1
- package/lib-esm/components/bundle-modules/bundle-modules.js +5 -3
- package/lib-esm/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib-esm/components/bundle-modules/bundle-modules.module.css +2 -16
- package/lib-esm/components/bundle-modules/index.js +2 -1
- package/lib-esm/components/bundle-modules/index.js.map +1 -1
- package/lib-esm/components/bundle-packages/bundle-packages.js +5 -3
- package/lib-esm/components/bundle-packages/bundle-packages.js.map +1 -1
- package/lib-esm/components/bundle-packages/bundle-packages.module.css +18 -22
- package/lib-esm/components/delta/delta.js +3 -13
- package/lib-esm/components/delta/delta.js.map +1 -1
- package/lib-esm/components/delta/delta.module.css +13 -12
- package/lib-esm/components/delta/index.js.map +1 -1
- package/lib-esm/components/entry-info/entry-info.js +4 -2
- package/lib-esm/components/entry-info/entry-info.js.map +1 -1
- package/lib-esm/components/entry-info/entry-info.module.css +7 -2
- package/lib-esm/components/index.js +1 -0
- package/lib-esm/components/index.js.map +1 -1
- package/lib-esm/components/insight-icon/insight-icon.module.css +6 -6
- package/lib-esm/components/job-name/job-name.js +1 -2
- package/lib-esm/components/job-name/job-name.js.map +1 -1
- package/lib-esm/components/jobs-header/jobs-header.js +1 -1
- package/lib-esm/components/jobs-header/jobs-header.js.map +1 -1
- package/lib-esm/components/jobs-header/jobs-header.module.css +0 -1
- package/lib-esm/components/metric-change-legend/index.js +2 -0
- package/lib-esm/components/metric-change-legend/index.js.map +1 -0
- package/lib-esm/components/metric-change-legend/metric-change-legend.js +84 -0
- package/lib-esm/components/metric-change-legend/metric-change-legend.js.map +1 -0
- package/lib-esm/components/metric-change-legend/metric-change-legend.module.css +80 -0
- package/lib-esm/components/metric-run-info/metric-run-info.js +24 -8
- package/lib-esm/components/metric-run-info/metric-run-info.js.map +1 -1
- package/lib-esm/components/metrics-display-selector/metrics-display-selector.js +7 -9
- package/lib-esm/components/metrics-display-selector/metrics-display-selector.js.map +1 -1
- package/lib-esm/components/metrics-display-selector/metrics-display-selector.module.css +0 -27
- package/lib-esm/components/metrics-table/metrics-table.js +32 -20
- package/lib-esm/components/metrics-table/metrics-table.js.map +1 -1
- package/lib-esm/components/metrics-table/metrics-table.module.css +4 -12
- package/lib-esm/components/metrics-table-header/metrics-table-header.js +6 -6
- package/lib-esm/components/metrics-table-header/metrics-table-header.js.map +1 -1
- package/lib-esm/components/metrics-table-header/metrics-table-header.module.css +8 -12
- package/lib-esm/components/metrics-table-options/metrics-table-options.js +5 -6
- package/lib-esm/components/metrics-table-options/metrics-table-options.js.map +1 -1
- package/lib-esm/components/metrics-table-row-count/index.js +2 -0
- package/lib-esm/components/metrics-table-row-count/index.js.map +1 -0
- package/lib-esm/components/metrics-table-row-count/metrics-table-row-count.js +10 -0
- package/lib-esm/components/metrics-table-row-count/metrics-table-row-count.js.map +1 -0
- package/lib-esm/components/metrics-table-row-count/metrics-table-row-count.module.css +5 -0
- package/lib-esm/components/metrics-table-title/metrics-table-title.js +1 -1
- package/lib-esm/components/metrics-table-title/metrics-table-title.js.map +1 -1
- package/lib-esm/components/metrics-treemap/metrics-treemap.constants.js +2 -0
- package/lib-esm/components/metrics-treemap/metrics-treemap.constants.js.map +1 -1
- package/lib-esm/components/metrics-treemap/metrics-treemap.js +52 -120
- package/lib-esm/components/metrics-treemap/metrics-treemap.js.map +1 -1
- package/lib-esm/components/metrics-treemap/metrics-treemap.module.css +3 -274
- package/lib-esm/components/metrics-treemap/metrics-treemap.utils.js +80 -18
- package/lib-esm/components/metrics-treemap/metrics-treemap.utils.js.map +1 -1
- package/lib-esm/components/metrics-treemap/tile/index.js +2 -0
- package/lib-esm/components/metrics-treemap/tile/index.js.map +1 -0
- package/lib-esm/components/metrics-treemap/tile/tile.js +40 -0
- package/lib-esm/components/metrics-treemap/tile/tile.js.map +1 -0
- package/lib-esm/components/metrics-treemap/tile/tile.module.css +145 -0
- package/lib-esm/components/metrics-treemap/tile-group/index.js +2 -0
- package/lib-esm/components/metrics-treemap/tile-group/index.js.map +1 -0
- package/lib-esm/components/metrics-treemap/tile-group/tile-group.js +35 -0
- package/lib-esm/components/metrics-treemap/tile-group/tile-group.js.map +1 -0
- package/lib-esm/components/metrics-treemap/tile-group/tile-group.module.css +57 -0
- package/lib-esm/components/metrics-treemap/tile-group-title/index.js +2 -0
- package/lib-esm/components/metrics-treemap/tile-group-title/index.js.map +1 -0
- package/lib-esm/components/metrics-treemap/tile-group-title/tile-group-title.js +17 -0
- package/lib-esm/components/metrics-treemap/tile-group-title/tile-group-title.js.map +1 -0
- package/lib-esm/components/metrics-treemap/tile-group-title/tile-group-title.module.css +48 -0
- package/lib-esm/components/run-info/run-info.js +26 -14
- package/lib-esm/components/run-info/run-info.js.map +1 -1
- package/lib-esm/components/run-info/run-info.module.css +35 -26
- package/lib-esm/components/sort-button/sort-button.module.css +0 -2
- package/lib-esm/components/summary/summary.js +11 -11
- package/lib-esm/components/summary/summary.js.map +1 -1
- package/lib-esm/components/summary/summary.module.css +60 -14
- package/lib-esm/constants.js +12 -0
- package/lib-esm/constants.js.map +1 -1
- package/lib-esm/css/default.css +7 -4
- package/lib-esm/css/variables.css +84 -60
- package/lib-esm/layout/flex-stack/flex-stack.js +3 -2
- package/lib-esm/layout/flex-stack/flex-stack.js.map +1 -1
- package/lib-esm/layout/flex-stack/flex-stack.module.css +65 -10
- package/lib-esm/query-state.js +7 -4
- package/lib-esm/query-state.js.map +1 -1
- package/lib-esm/ui/button/button.js +3 -2
- package/lib-esm/ui/button/button.js.map +1 -1
- package/lib-esm/ui/button/button.module.css +38 -27
- package/lib-esm/ui/control-group/control-group.js +1 -1
- package/lib-esm/ui/control-group/control-group.js.map +1 -1
- package/lib-esm/ui/copy-to-clipboard/copy-to-clipboard.module.css +2 -2
- package/lib-esm/ui/dialog/dialog.js +7 -3
- package/lib-esm/ui/dialog/dialog.js.map +1 -1
- package/lib-esm/ui/dialog/dialog.module.css +27 -0
- package/lib-esm/ui/dropdown/dropdown.js +11 -3
- package/lib-esm/ui/dropdown/dropdown.js.map +1 -1
- package/lib-esm/ui/dropdown/dropdown.module.css +60 -7
- package/lib-esm/ui/filters/filters.js +29 -17
- package/lib-esm/ui/filters/filters.js.map +1 -1
- package/lib-esm/ui/filters/filters.module.css +3 -19
- package/lib-esm/ui/hover-card/hover-card.js +7 -1
- package/lib-esm/ui/hover-card/hover-card.js.map +1 -1
- package/lib-esm/ui/hover-card/hover-card.module.css +18 -5
- package/lib-esm/ui/input/input.module.css +2 -2
- package/lib-esm/ui/table/table.module.css +12 -6
- package/lib-esm/ui/tabs/tabs.module.css +13 -9
- package/lib-esm/ui/tag/tag.module.css +0 -2
- package/lib-esm/ui/textarea/textarea.module.css +2 -2
- package/lib-esm/ui/toolbar/toolbar.js +2 -1
- package/lib-esm/ui/toolbar/toolbar.js.map +1 -1
- package/lib-esm/ui/toolbar/toolbar.module.css +0 -6
- package/lib-esm/ui/tooltip/tooltip.js +6 -1
- package/lib-esm/ui/tooltip/tooltip.js.map +1 -1
- package/lib-esm/ui/tooltip/tooltip.module.css +12 -1
- package/lib-esm/utils/index.js +1 -0
- package/lib-esm/utils/index.js.map +1 -1
- package/lib-esm/utils/portal.js +6 -0
- package/lib-esm/utils/portal.js.map +1 -0
- package/package.json +18 -18
- package/src/app/app.jsx +7 -1
- package/src/app/app.module.css +14 -5
- package/src/app/header/header.module.css +1 -3
- package/src/components/asset-name/asset-name.module.css +11 -10
- package/src/components/asset-name/asset-name.tsx +17 -14
- package/src/components/bundle-assets/bundle-assets.module.css +0 -12
- package/src/components/bundle-assets/bundle-assets.tsx +8 -1
- package/src/components/bundle-assets/index.tsx +3 -1
- package/src/components/bundle-assets-totals/bundle-assets-totals.jsx +6 -4
- package/src/components/bundle-modules/bundle-modules.module.css +2 -16
- package/src/components/bundle-modules/bundle-modules.tsx +10 -3
- package/src/components/bundle-modules/index.tsx +3 -1
- package/src/components/bundle-packages/bundle-packages.jsx +14 -3
- package/src/components/bundle-packages/bundle-packages.module.css +18 -22
- package/src/components/delta/delta.module.css +13 -12
- package/src/components/delta/delta.tsx +32 -0
- package/src/components/entry-info/entry-info.module.css +7 -2
- package/src/components/entry-info/entry-info.tsx +9 -3
- package/src/components/index.ts +3 -0
- package/src/components/insight-icon/insight-icon.module.css +6 -6
- package/src/components/job-name/job-name.jsx +2 -3
- package/src/components/jobs-header/jobs-header.module.css +0 -1
- package/src/components/jobs-header/jobs-header.tsx +2 -2
- package/src/components/metric-change-legend/index.ts +1 -0
- package/src/components/metric-change-legend/metric-change-legend.module.css +80 -0
- package/src/components/metric-change-legend/metric-change-legend.stories.tsx +13 -0
- package/src/components/metric-change-legend/metric-change-legend.tsx +148 -0
- package/src/components/metric-run-info/metric-run-info.stories.tsx +9 -0
- package/src/components/metric-run-info/metric-run-info.tsx +39 -17
- package/src/components/metrics-display-selector/metrics-display-selector.module.css +0 -27
- package/src/components/metrics-display-selector/metrics-display-selector.tsx +25 -37
- package/src/components/metrics-table/metrics-table.module.css +4 -12
- package/src/components/metrics-table/metrics-table.tsx +70 -39
- package/src/components/metrics-table-header/metrics-table-header.module.css +8 -12
- package/src/components/metrics-table-header/metrics-table-header.tsx +5 -6
- package/src/components/metrics-table-options/metrics-table-options.tsx +13 -14
- package/src/components/metrics-table-row-count/index.ts +1 -0
- package/src/components/metrics-table-row-count/metrics-table-row-count.module.css +5 -0
- package/src/components/metrics-table-row-count/metrics-table-row-count.tsx +21 -0
- package/src/components/metrics-table-title/metrics-table-title.jsx +1 -1
- package/src/components/metrics-treemap/metrics-treemap.constants.ts +9 -0
- package/src/components/metrics-treemap/metrics-treemap.module.css +3 -274
- package/src/components/metrics-treemap/metrics-treemap.stories.utils.ts +46 -0
- package/src/components/metrics-treemap/metrics-treemap.tsx +123 -428
- package/src/components/metrics-treemap/metrics-treemap.utils.ts +161 -27
- package/src/components/metrics-treemap/tile/index.ts +1 -0
- package/src/components/metrics-treemap/tile/tile.module.css +145 -0
- package/src/components/metrics-treemap/tile/tile.stories.tsx +139 -0
- package/src/components/metrics-treemap/tile/tile.tsx +121 -0
- package/src/components/metrics-treemap/tile-group/index.ts +1 -0
- package/src/components/metrics-treemap/tile-group/tile-group.module.css +57 -0
- package/src/components/metrics-treemap/tile-group/tile-group.stories.tsx +163 -0
- package/src/components/metrics-treemap/tile-group/tile-group.tsx +177 -0
- package/src/components/metrics-treemap/tile-group-title/index.ts +1 -0
- package/src/components/metrics-treemap/tile-group-title/tile-group-title.module.css +48 -0
- package/src/components/metrics-treemap/tile-group-title/tile-group-title.stories.tsx +88 -0
- package/src/components/metrics-treemap/tile-group-title/tile-group-title.tsx +51 -0
- package/src/components/run-info/run-info.module.css +35 -26
- package/src/components/run-info/run-info.stories.tsx +16 -10
- package/src/components/run-info/run-info.tsx +132 -73
- package/src/components/sort-button/sort-button.module.css +0 -2
- package/src/components/summary/summary.module.css +60 -14
- package/src/components/summary/summary.tsx +50 -52
- package/src/constants.ts +13 -0
- package/src/css/default.css +7 -4
- package/src/css/variables.css +84 -60
- package/src/layout/flex-stack/flex-stack.module.css +65 -10
- package/src/layout/flex-stack/flex-stack.stories.tsx +68 -9
- package/src/layout/flex-stack/flex-stack.tsx +24 -4
- package/src/query-state.tsx +9 -4
- package/src/ui/button/button.module.css +38 -27
- package/src/ui/button/button.stories.tsx +1 -1
- package/src/ui/button/button.tsx +3 -1
- package/src/ui/control-group/control-group.tsx +1 -1
- package/src/ui/copy-to-clipboard/copy-to-clipboard.module.css +2 -2
- package/src/ui/dialog/dialog.module.css +27 -0
- package/src/ui/dialog/dialog.stories.tsx +8 -0
- package/src/ui/dialog/dialog.tsx +16 -2
- package/src/ui/dropdown/dropdown.module.css +60 -7
- package/src/ui/dropdown/dropdown.stories.tsx +6 -0
- package/src/ui/dropdown/dropdown.tsx +17 -2
- package/src/ui/filters/filters.module.css +3 -19
- package/src/ui/filters/filters.tsx +131 -67
- package/src/ui/hover-card/hover-card.module.css +18 -5
- package/src/ui/hover-card/hover-card.tsx +7 -1
- package/src/ui/input/input.module.css +2 -2
- package/src/ui/table/table.module.css +12 -6
- package/src/ui/tabs/tabs.module.css +13 -9
- package/src/ui/tag/tag.module.css +0 -2
- package/src/ui/textarea/textarea.module.css +2 -2
- package/src/ui/toolbar/toolbar.jsx +4 -1
- package/src/ui/toolbar/toolbar.module.css +0 -6
- package/src/ui/tooltip/tooltip.module.css +12 -1
- package/src/ui/tooltip/tooltip.tsx +6 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/portal.ts +9 -0
- package/types/components/delta/delta.d.ts +7 -21
- package/types/components/delta/index.d.ts +1 -1
- package/types/components/index.d.ts +3 -0
- package/types/components/metric-change-legend/index.d.ts +1 -0
- package/types/components/metric-change-legend/metric-change-legend.d.ts +4 -0
- package/types/components/metric-run-info/metric-run-info.d.ts +3 -6
- package/types/components/metrics-table/metrics-table.d.ts +2 -1
- package/types/components/metrics-table-row-count/index.d.ts +1 -0
- package/types/components/metrics-table-row-count/metrics-table-row-count.d.ts +7 -0
- package/types/components/metrics-treemap/metrics-treemap.constants.d.ts +2 -0
- package/types/components/metrics-treemap/metrics-treemap.utils.d.ts +16 -5
- package/types/components/metrics-treemap/tile/index.d.ts +1 -0
- package/types/components/metrics-treemap/tile/tile.d.ts +11 -0
- package/types/components/metrics-treemap/tile-group/index.d.ts +1 -0
- package/types/components/metrics-treemap/tile-group/tile-group.d.ts +20 -0
- package/types/components/metrics-treemap/tile-group-title/index.d.ts +1 -0
- package/types/components/metrics-treemap/tile-group-title/tile-group-title.d.ts +12 -0
- package/types/components/run-info/run-info.d.ts +16 -7
- package/types/constants.d.ts +12 -0
- package/types/layout/flex-stack/flex-stack.d.ts +6 -2
- package/types/ui/button/button.d.ts +1 -0
- package/types/ui/dialog/dialog.d.ts +3 -2
- package/types/ui/dropdown/dropdown.d.ts +4 -1
- package/types/ui/filters/filters.d.ts +2 -1
- package/types/utils/index.d.ts +1 -0
- package/types/utils/portal.d.ts +1 -0
- package/vitest.config.ts +4 -0
- package/lib/components/metrics-table-options/metrics-table-options.module.css +0 -15
- package/lib-esm/components/metrics-table-options/metrics-table-options.module.css +0 -15
- package/src/components/delta/delta.jsx +0 -22
- package/src/components/metrics-table-options/metrics-table-options.module.css +0 -15
- /package/src/components/delta/{index.js → index.ts} +0 -0
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useDebounce, useMouseHovered } from 'react-use';
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
2
|
import { useTooltipState } from 'ariakit/tooltip';
|
|
4
3
|
import {
|
|
5
4
|
DeltaType,
|
|
6
5
|
type MetricRunInfoBaseline,
|
|
7
6
|
type MetricRunInfo,
|
|
8
7
|
type ReportMetricRow,
|
|
8
|
+
METRIC_TYPE_CONFIGS,
|
|
9
|
+
formatFileSize,
|
|
10
|
+
getMetricRunInfo,
|
|
9
11
|
} from '@bundle-stats/utils';
|
|
10
12
|
|
|
11
13
|
import {
|
|
12
14
|
type TreeLeaf,
|
|
15
|
+
type TreeNode,
|
|
13
16
|
type TreeNodeChildren,
|
|
14
17
|
type Tree,
|
|
15
18
|
type TreeTotal,
|
|
@@ -158,6 +161,28 @@ export function getTreemapNodesGroupedByPath(items: Array<ReportMetricRow>): Tre
|
|
|
158
161
|
};
|
|
159
162
|
}
|
|
160
163
|
|
|
164
|
+
/**
|
|
165
|
+
* Index every tree node by id, to allow resolving the hovered node from the
|
|
166
|
+
* `data-treemap-id` DOM marker without walking the tree on every pointer move
|
|
167
|
+
*/
|
|
168
|
+
export function getTreemapNodesIndex(
|
|
169
|
+
node: Tree,
|
|
170
|
+
index: Map<string, TreeNode> = new Map(),
|
|
171
|
+
): Map<string, TreeNode> {
|
|
172
|
+
index.set(node.id, node);
|
|
173
|
+
|
|
174
|
+
node.children.forEach((childNode) => {
|
|
175
|
+
if ('children' in childNode) {
|
|
176
|
+
getTreemapNodesIndex(childNode, index);
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
index.set(childNode.id, childNode);
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
return index;
|
|
184
|
+
}
|
|
185
|
+
|
|
161
186
|
export function resolveGroupDeltaType(
|
|
162
187
|
metricRunInfo?: MetricRunInfo | MetricRunInfoBaseline,
|
|
163
188
|
): DeltaType.NO_CHANGE | DeltaType.NEGATIVE | DeltaType.POSITIVE {
|
|
@@ -178,6 +203,23 @@ export function resolveGroupDeltaType(
|
|
|
178
203
|
return DeltaType.NO_CHANGE;
|
|
179
204
|
}
|
|
180
205
|
|
|
206
|
+
/**
|
|
207
|
+
* Resolve the run info of a tile group from the children total
|
|
208
|
+
*/
|
|
209
|
+
export function getGroupRunInfo(total: TreeTotal) {
|
|
210
|
+
const runInfo = getMetricRunInfo(
|
|
211
|
+
METRIC_TYPE_CONFIGS.METRIC_TYPE_FILE_SIZE,
|
|
212
|
+
total.current,
|
|
213
|
+
total.baseline,
|
|
214
|
+
) as MetricRunInfo;
|
|
215
|
+
|
|
216
|
+
return {
|
|
217
|
+
runInfo,
|
|
218
|
+
baselineDisplayValue: formatFileSize(total.baseline),
|
|
219
|
+
deltaType: resolveGroupDeltaType(runInfo),
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
|
|
181
223
|
/**
|
|
182
224
|
* Resolve the tile's size using predefined values to avoid
|
|
183
225
|
* computing the size of the content for every tile
|
|
@@ -225,50 +267,142 @@ export function resolveTileSizeDisplay(width: number, height: number): TileSizeD
|
|
|
225
267
|
return 'default';
|
|
226
268
|
}
|
|
227
269
|
|
|
228
|
-
interface
|
|
229
|
-
/**
|
|
230
|
-
* React ref to parent div
|
|
231
|
-
*/
|
|
232
|
-
parentRef: RefObject<Element>;
|
|
270
|
+
interface UseTreemapTooltipStateOptions {
|
|
233
271
|
/**
|
|
234
272
|
* Tooltip gutter
|
|
235
273
|
*/
|
|
236
274
|
gutter?: number;
|
|
237
275
|
/**
|
|
238
|
-
*
|
|
276
|
+
* Delay before showing the tooltip
|
|
239
277
|
*/
|
|
240
278
|
timeout?: number;
|
|
279
|
+
/**
|
|
280
|
+
* Delay before hiding the tooltip once the pointer is no longer over a cell.
|
|
281
|
+
*
|
|
282
|
+
* Tiles are separated by a gutter that belongs to no node, so without this
|
|
283
|
+
* grace period moving from one cell to another would close and reopen the
|
|
284
|
+
* tooltip every time the pointer crosses the gap.
|
|
285
|
+
*/
|
|
286
|
+
hideTimeout?: number;
|
|
241
287
|
}
|
|
242
288
|
|
|
243
289
|
/**
|
|
244
|
-
* Ariakit tooltip state
|
|
290
|
+
* Ariakit tooltip state shared by every tile/tile group of a treemap.
|
|
291
|
+
*
|
|
292
|
+
* The tooltip is anchored to a virtual 1x1 rect that follows the pointer, so
|
|
293
|
+
* no `TooltipAnchor` is rendered per cell: the anchor position is stored on a
|
|
294
|
+
* ref and ariakit is asked to reposition at most once per animation frame,
|
|
295
|
+
* which keeps the treemap itself out of the pointer move render path.
|
|
296
|
+
*
|
|
297
|
+
* The hovered node id is owned here as well, so that all the tooltip timing
|
|
298
|
+
* lives in a single place.
|
|
245
299
|
*/
|
|
246
|
-
export function
|
|
247
|
-
const {
|
|
300
|
+
export function useTreemapTooltipState(options: UseTreemapTooltipStateOptions = {}) {
|
|
301
|
+
const { gutter = 16, timeout = 240, hideTimeout = timeout } = options;
|
|
248
302
|
|
|
249
|
-
const
|
|
303
|
+
const pointerRef = useRef<{ x: number; y: number } | null>(null);
|
|
304
|
+
const frameRef = useRef(0);
|
|
305
|
+
const hideTimeoutRef = useRef(0);
|
|
250
306
|
|
|
251
|
-
// Return custom rect based on the
|
|
307
|
+
// Return custom rect based on the pointer position
|
|
252
308
|
const getAnchorRect = useCallback(() => {
|
|
253
|
-
|
|
254
|
-
|
|
309
|
+
const pointer = pointerRef.current;
|
|
310
|
+
|
|
311
|
+
// Skip the custom rect until we have a pointer position
|
|
312
|
+
if (!pointer) {
|
|
255
313
|
return null;
|
|
256
314
|
}
|
|
257
315
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
y: pointer.docY - (document?.defaultView?.scrollY ?? 0),
|
|
261
|
-
w: 1,
|
|
262
|
-
h: 1,
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
return newRect;
|
|
266
|
-
}, [pointer.docX, pointer.docY]);
|
|
316
|
+
return { x: pointer.x, y: pointer.y, w: 1, h: 1 };
|
|
317
|
+
}, []);
|
|
267
318
|
|
|
268
319
|
const tooltipState = useTooltipState({ gutter, getAnchorRect, timeout });
|
|
320
|
+
const { mounted, render, show, hide } = tooltipState;
|
|
321
|
+
|
|
322
|
+
const [hoveredNodeId, setHoveredNodeId] = useState<string | null>(null);
|
|
323
|
+
const hoveredNodeIdRef = useRef<string | null>(null);
|
|
324
|
+
|
|
325
|
+
useEffect(
|
|
326
|
+
() => () => {
|
|
327
|
+
cancelAnimationFrame(frameRef.current);
|
|
328
|
+
window.clearTimeout(hideTimeoutRef.current);
|
|
329
|
+
},
|
|
330
|
+
[],
|
|
331
|
+
);
|
|
332
|
+
|
|
333
|
+
const setPointer = useCallback(
|
|
334
|
+
(x: number, y: number) => {
|
|
335
|
+
pointerRef.current = { x, y };
|
|
336
|
+
|
|
337
|
+
// Reposition only while the tooltip is visible, once per frame
|
|
338
|
+
if (!mounted || frameRef.current) {
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
frameRef.current = requestAnimationFrame(() => {
|
|
343
|
+
frameRef.current = 0;
|
|
344
|
+
render();
|
|
345
|
+
});
|
|
346
|
+
},
|
|
347
|
+
[mounted, render],
|
|
348
|
+
);
|
|
349
|
+
|
|
350
|
+
const commitHoveredNode = useCallback(
|
|
351
|
+
(nodeId: string | null) => {
|
|
352
|
+
hoveredNodeIdRef.current = nodeId;
|
|
353
|
+
setHoveredNodeId(nodeId);
|
|
354
|
+
|
|
355
|
+
if (nodeId === null) {
|
|
356
|
+
hide();
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
show();
|
|
361
|
+
},
|
|
362
|
+
[hide, show],
|
|
363
|
+
);
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Set the hovered node. Showing another node is applied right away, while
|
|
367
|
+
* hiding is deferred so that the tooltip survives the gap between two cells.
|
|
368
|
+
*/
|
|
369
|
+
const setHoveredNode = useCallback(
|
|
370
|
+
(nodeId: string | null) => {
|
|
371
|
+
window.clearTimeout(hideTimeoutRef.current);
|
|
372
|
+
hideTimeoutRef.current = 0;
|
|
373
|
+
|
|
374
|
+
// Guard against re-triggering `show`, which would restart the show timeout
|
|
375
|
+
if (nodeId === hoveredNodeIdRef.current) {
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
if (nodeId !== null || !hideTimeout) {
|
|
380
|
+
commitHoveredNode(nodeId);
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
hideTimeoutRef.current = window.setTimeout(() => {
|
|
385
|
+
hideTimeoutRef.current = 0;
|
|
386
|
+
commitHoveredNode(null);
|
|
387
|
+
}, hideTimeout);
|
|
388
|
+
},
|
|
389
|
+
[commitHoveredNode, hideTimeout],
|
|
390
|
+
);
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Hide the tooltip right away, without the grace period - the pointer left
|
|
394
|
+
* the treemap, there is no next cell to move to.
|
|
395
|
+
*/
|
|
396
|
+
const clearHoveredNode = useCallback(() => {
|
|
397
|
+
window.clearTimeout(hideTimeoutRef.current);
|
|
398
|
+
hideTimeoutRef.current = 0;
|
|
399
|
+
|
|
400
|
+
if (hoveredNodeIdRef.current === null) {
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
269
403
|
|
|
270
|
-
|
|
271
|
-
|
|
404
|
+
commitHoveredNode(null);
|
|
405
|
+
}, [commitHoveredNode]);
|
|
272
406
|
|
|
273
|
-
return tooltipState;
|
|
407
|
+
return { tooltipState, setPointer, hoveredNodeId, setHoveredNode, clearHoveredNode };
|
|
274
408
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './tile';
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/** Leaf wrapper button */
|
|
2
|
+
.root {
|
|
3
|
+
position: absolute;
|
|
4
|
+
appearance: none;
|
|
5
|
+
border: 0;
|
|
6
|
+
border-radius: var(--radius-xsmall);
|
|
7
|
+
padding: 0;
|
|
8
|
+
background: var(--color-background);
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
font-family: var(--font-family-fixed);
|
|
12
|
+
font-size: var(--size-small);
|
|
13
|
+
line-height: var(--line-height-heading);
|
|
14
|
+
text-align: left;
|
|
15
|
+
transition: var(--transition-out);
|
|
16
|
+
transition-property: opacity, background-color;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.root::before {
|
|
20
|
+
content: '';
|
|
21
|
+
display: block;
|
|
22
|
+
position: absolute;
|
|
23
|
+
z-index: 1;
|
|
24
|
+
left: 0;
|
|
25
|
+
top: 0;
|
|
26
|
+
width: 100%;
|
|
27
|
+
height: 100%;
|
|
28
|
+
border-radius: inherit;
|
|
29
|
+
background-color: currentColor;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.tileContent {
|
|
33
|
+
position: relative;
|
|
34
|
+
z-index: 1;
|
|
35
|
+
width: 100%;
|
|
36
|
+
height: 100%;
|
|
37
|
+
padding: var(--space-xxsmall);
|
|
38
|
+
line-height: var(--line-height-heading);
|
|
39
|
+
cursor: default;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Align label to other elements on the first column cells */
|
|
43
|
+
.tileFirstCol .tileContent {
|
|
44
|
+
padding-left: var(--space-small);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.tileContentLabel {
|
|
48
|
+
flex: 0 1 auto;
|
|
49
|
+
width: 100%;
|
|
50
|
+
min-width: 0;
|
|
51
|
+
line-height: var(--line-height-heading);
|
|
52
|
+
max-height: calc(2em * var(--line-height-heading)); /* render max 2 rows */
|
|
53
|
+
overflow-wrap: break-word;
|
|
54
|
+
word-wrap: break-word;
|
|
55
|
+
word-break: break-all;
|
|
56
|
+
word-break: break-word;
|
|
57
|
+
hyphens: auto;
|
|
58
|
+
white-space: normal;
|
|
59
|
+
overflow: hidden;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.tileContentValue {
|
|
63
|
+
flex: 0 0 auto;
|
|
64
|
+
max-width: calc(100% + var(--space-xxsmall));
|
|
65
|
+
white-space: nowrap;
|
|
66
|
+
overflow: hidden;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.tileContentMetric {
|
|
70
|
+
font-weight: bold;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.tileContentDelta {
|
|
74
|
+
margin-left: var(--space-xxxsmall);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Tile size variation */
|
|
78
|
+
.tileSizeSmall .tileContent {
|
|
79
|
+
padding: var(--space-xxxsmall);
|
|
80
|
+
font-size: var(--size-xsmall);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.tileSizeSmall .tileContentLabel {
|
|
84
|
+
margin-top: 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Tile diff variation */
|
|
88
|
+
.root {
|
|
89
|
+
outline: 1px solid rgba(255, 255, 255, 1);
|
|
90
|
+
color: var(--color-text);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.root::before {
|
|
94
|
+
color: var(--color-highlight);
|
|
95
|
+
transition: var(--transition-out);
|
|
96
|
+
transition-property: opacity;
|
|
97
|
+
opacity: 0.6;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.root:hover::before {
|
|
101
|
+
transition: var(--transition-in);
|
|
102
|
+
transition-property: opacity;
|
|
103
|
+
opacity: 0.8;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.root:hover .tileContentLabel {
|
|
107
|
+
text-decoration: underline;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.tile-NO_CHANGE {
|
|
111
|
+
color: var(--color-text-light);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.tile-NO_CHANGE::before {
|
|
115
|
+
color: var(--color-gray-50);
|
|
116
|
+
opacity: 0.4;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.tile-NO_CHANGE:hover::before {
|
|
120
|
+
opacity: 0.2;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.tile-HIGH_NEGATIVE::before {
|
|
124
|
+
color: var(--color-red-100);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.tile-NEGATIVE::before {
|
|
128
|
+
color: var(--color-red-50);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.tile-LOW_NEGATIVE::before {
|
|
132
|
+
color: var(--color-red-50);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.tile-LOW_POSITIVE::before {
|
|
136
|
+
color: var(--color-green-50);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.tile-POSITIVE::before {
|
|
140
|
+
color: var(--color-green-50);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.tile-HIGH_POSITIVE::before {
|
|
144
|
+
color: var(--color-green-100);
|
|
145
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { action } from 'storybook/actions';
|
|
4
|
+
|
|
5
|
+
import { getWrapperDecorator } from '../../../stories';
|
|
6
|
+
import { type TreeLeaf, PADDING_INNER } from '../metrics-treemap.constants';
|
|
7
|
+
import {
|
|
8
|
+
CURRENT_VALUE_BY_DELTA_TYPE,
|
|
9
|
+
createReportMetricRow,
|
|
10
|
+
} from '../metrics-treemap.stories.utils';
|
|
11
|
+
import { Tile } from '.';
|
|
12
|
+
|
|
13
|
+
function createTreeLeaf(current: number): TreeLeaf {
|
|
14
|
+
const item = createReportMetricRow('src/components/button/button.tsx', current);
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
id: item.key,
|
|
18
|
+
label: 'button.tsx',
|
|
19
|
+
value: current,
|
|
20
|
+
item,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const meta = {
|
|
25
|
+
title: 'Components/MetricsTreemap/Tile',
|
|
26
|
+
component: Tile,
|
|
27
|
+
decorators: [
|
|
28
|
+
// Tiles are absolutely positioned inside the treemap canvas
|
|
29
|
+
(Story, { args }) => (
|
|
30
|
+
<div
|
|
31
|
+
style={{
|
|
32
|
+
position: 'relative',
|
|
33
|
+
width: args.left + args.width,
|
|
34
|
+
height: args.top + args.height,
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
<Story />
|
|
38
|
+
</div>
|
|
39
|
+
),
|
|
40
|
+
getWrapperDecorator(),
|
|
41
|
+
],
|
|
42
|
+
args: {
|
|
43
|
+
left: 0,
|
|
44
|
+
top: 0,
|
|
45
|
+
width: 240,
|
|
46
|
+
height: 96,
|
|
47
|
+
data: createTreeLeaf(CURRENT_VALUE_BY_DELTA_TYPE.NEGATIVE),
|
|
48
|
+
onClick: action('CLICK'),
|
|
49
|
+
},
|
|
50
|
+
} satisfies Meta<typeof Tile>;
|
|
51
|
+
|
|
52
|
+
export default meta;
|
|
53
|
+
|
|
54
|
+
type Story = StoryObj<typeof meta>;
|
|
55
|
+
|
|
56
|
+
export const Default: Story = {};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Size
|
|
60
|
+
*/
|
|
61
|
+
export const SizeSmall: Story = {
|
|
62
|
+
args: {
|
|
63
|
+
width: 160,
|
|
64
|
+
height: 36,
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const SizeMinimal: Story = {
|
|
69
|
+
args: {
|
|
70
|
+
width: 48,
|
|
71
|
+
height: 24,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Position
|
|
77
|
+
*/
|
|
78
|
+
export const FirstColumn: Story = {
|
|
79
|
+
args: {
|
|
80
|
+
left: PADDING_INNER,
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Label
|
|
86
|
+
*/
|
|
87
|
+
export const LabelFallback: Story = {
|
|
88
|
+
args: {
|
|
89
|
+
data: {
|
|
90
|
+
...createTreeLeaf(CURRENT_VALUE_BY_DELTA_TYPE.NEGATIVE),
|
|
91
|
+
label: '',
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Delta type
|
|
98
|
+
*/
|
|
99
|
+
export const NoChange: Story = {
|
|
100
|
+
args: {
|
|
101
|
+
data: createTreeLeaf(CURRENT_VALUE_BY_DELTA_TYPE.NO_CHANGE),
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const LowNegative: Story = {
|
|
106
|
+
args: {
|
|
107
|
+
data: createTreeLeaf(CURRENT_VALUE_BY_DELTA_TYPE.LOW_NEGATIVE),
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export const Negative: Story = {
|
|
112
|
+
args: {
|
|
113
|
+
data: createTreeLeaf(CURRENT_VALUE_BY_DELTA_TYPE.NEGATIVE),
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export const HighNegative: Story = {
|
|
118
|
+
args: {
|
|
119
|
+
data: createTreeLeaf(CURRENT_VALUE_BY_DELTA_TYPE.HIGH_NEGATIVE),
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export const LowPositive: Story = {
|
|
124
|
+
args: {
|
|
125
|
+
data: createTreeLeaf(CURRENT_VALUE_BY_DELTA_TYPE.LOW_POSITIVE),
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export const Positive: Story = {
|
|
130
|
+
args: {
|
|
131
|
+
data: createTreeLeaf(CURRENT_VALUE_BY_DELTA_TYPE.POSITIVE),
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export const HighPositive: Story = {
|
|
136
|
+
args: {
|
|
137
|
+
data: createTreeLeaf(CURRENT_VALUE_BY_DELTA_TYPE.HIGH_POSITIVE),
|
|
138
|
+
},
|
|
139
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React, { type ComponentProps, type MouseEventHandler, useCallback, useMemo } from 'react';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import type { MetricRunInfo, ReportMetricRow } from '@bundle-stats/utils';
|
|
4
|
+
|
|
5
|
+
import { FlexStack } from '../../../layout/flex-stack';
|
|
6
|
+
import { Delta } from '../../delta';
|
|
7
|
+
import { type TreeLeaf, PADDING_INNER, TileSizeDisplay } from '../metrics-treemap.constants';
|
|
8
|
+
import * as I18N from '../metrics-treemap.i18n';
|
|
9
|
+
import { resolveTileSizeDisplay } from '../metrics-treemap.utils';
|
|
10
|
+
import css from './tile.module.css';
|
|
11
|
+
|
|
12
|
+
interface TileContentProps {
|
|
13
|
+
/**
|
|
14
|
+
* Node label
|
|
15
|
+
*/
|
|
16
|
+
label: string;
|
|
17
|
+
/**
|
|
18
|
+
* Tile id - metric label or basename for grouped tiles
|
|
19
|
+
*/
|
|
20
|
+
item: ReportMetricRow;
|
|
21
|
+
/**
|
|
22
|
+
* The estimated size of the tile
|
|
23
|
+
*/
|
|
24
|
+
sizeDisplay: TileSizeDisplay;
|
|
25
|
+
/**
|
|
26
|
+
* Metric run info
|
|
27
|
+
*/
|
|
28
|
+
runInfo: MetricRunInfo;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const TileContentContainer = (props: ComponentProps<'div'>) => (
|
|
32
|
+
<FlexStack
|
|
33
|
+
direction="column"
|
|
34
|
+
justifyContent="center"
|
|
35
|
+
gap="xxxsmall"
|
|
36
|
+
className={css.tileContent}
|
|
37
|
+
{...props}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const TileContent = (props: TileContentProps) => {
|
|
42
|
+
const { label, sizeDisplay, item, runInfo } = props;
|
|
43
|
+
|
|
44
|
+
// Render only the container
|
|
45
|
+
if (sizeDisplay === 'minimal') {
|
|
46
|
+
return <TileContentContainer />;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const resolvedLabel = label || item.label;
|
|
50
|
+
|
|
51
|
+
// Render only the label
|
|
52
|
+
if (sizeDisplay === 'small') {
|
|
53
|
+
return (
|
|
54
|
+
<TileContentContainer>
|
|
55
|
+
<p className={css.tileContentLabel}>{resolvedLabel}</p>
|
|
56
|
+
</TileContentContainer>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<TileContentContainer>
|
|
62
|
+
<p className={css.tileContentLabel}>{label || item.label}</p>
|
|
63
|
+
<p className={css.tileContentValue}>
|
|
64
|
+
<span className={css.tileContentMetric}>{runInfo.displayValue}</span>
|
|
65
|
+
<Delta
|
|
66
|
+
className={css.tileContentDelta}
|
|
67
|
+
displayValue={runInfo.displayDeltaPercentage}
|
|
68
|
+
deltaType={runInfo.deltaType}
|
|
69
|
+
/>
|
|
70
|
+
</p>
|
|
71
|
+
</TileContentContainer>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export interface TileProps {
|
|
76
|
+
left: number;
|
|
77
|
+
top: number;
|
|
78
|
+
width: number;
|
|
79
|
+
height: number;
|
|
80
|
+
data: TreeLeaf;
|
|
81
|
+
onClick?: (id: string) => void;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export const Tile = (props: TileProps) => {
|
|
85
|
+
const { left, top, width, height, data, onClick } = props;
|
|
86
|
+
|
|
87
|
+
const { item, label } = data;
|
|
88
|
+
const runInfo = item.runs?.[0] as MetricRunInfo;
|
|
89
|
+
|
|
90
|
+
const sizeDisplay = useMemo(() => resolveTileSizeDisplay(width, height), [width, height]);
|
|
91
|
+
const handleOnClick: MouseEventHandler<HTMLDivElement> = useCallback(
|
|
92
|
+
(event) => {
|
|
93
|
+
event.stopPropagation();
|
|
94
|
+
onClick?.(item.key);
|
|
95
|
+
},
|
|
96
|
+
[item.key, onClick],
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
const className = cx(
|
|
100
|
+
css.root,
|
|
101
|
+
css[`tile-${runInfo.deltaType}`],
|
|
102
|
+
sizeDisplay === 'small' && css.tileSizeSmall,
|
|
103
|
+
sizeDisplay === 'default' && css.tileSizeDefault,
|
|
104
|
+
left === PADDING_INNER && css.tileFirstCol,
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
/* eslint-disable jsx-a11y/click-events-have-key-events, jsx-a11y/interactive-supports-focus */
|
|
108
|
+
return (
|
|
109
|
+
<div
|
|
110
|
+
onClick={handleOnClick}
|
|
111
|
+
role="button"
|
|
112
|
+
aria-label={I18N.TILE_LABEL}
|
|
113
|
+
data-treemap-id={data.id}
|
|
114
|
+
data-treemap-tile
|
|
115
|
+
style={{ left, top, width, height }}
|
|
116
|
+
className={className}
|
|
117
|
+
>
|
|
118
|
+
<TileContent label={label} sizeDisplay={sizeDisplay} item={item} runInfo={runInfo} />
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
121
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './tile-group';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
border-radius: var(--radius-xsmall);
|
|
3
|
+
position: absolute;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/** Tile group size variation */
|
|
7
|
+
.root {
|
|
8
|
+
transition: var(--transition-out);
|
|
9
|
+
transition-property: background-color, outline;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Tile group nested variation */
|
|
13
|
+
.root.nested {
|
|
14
|
+
background-color: rgba(27, 26, 33, 0.03);
|
|
15
|
+
outline: 1px solid rgba(255, 255, 255, 0.8);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.root.nested:has(> [data-treemap-tile-group-title]:hover),
|
|
19
|
+
.root.nested:has(> [data-treemap-tile]:hover) {
|
|
20
|
+
background-color: rgba(27, 26, 33, 0.06);
|
|
21
|
+
outline: 1px solid rgba(255, 255, 255, 1);
|
|
22
|
+
transition: var(--transition-in);
|
|
23
|
+
transition-property: background-color, outline;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.nested.tileGroup--NEGATIVE {
|
|
27
|
+
background-color: rgba(194, 31, 37, 0.04);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.nested.tileGroup--NEGATIVE:has(> [data-treemap-tile-group-title]:hover),
|
|
31
|
+
.nested.tileGroup--NEGATIVE:has(> [data-treemap-tile]:hover) {
|
|
32
|
+
background-color: rgba(194, 31, 37, 0.1);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.nested.tileGroup--POSITIVE {
|
|
36
|
+
background-color: rgba(42, 147, 39, 0.04);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.nested.tileGroup--POSITIVE:has(> [data-treemap-tile-group-title]:hover),
|
|
40
|
+
.nested.tileGroup--POSITIVE:has(> [data-treemap-tile]:hover) {
|
|
41
|
+
background-color: rgba(42, 147, 39, 0.1);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* reset bacground color when having a not changed group */
|
|
45
|
+
.nested.tileGroup--POSITIVE > .tileGroup--NO_CHANGE,
|
|
46
|
+
.nested.tileGroup--NEGATIVE > .tileGroup--NO_CHANGE {
|
|
47
|
+
background-color: var(--color-background);
|
|
48
|
+
background-image: linear-gradient(rgba(27, 26, 33, 0.1), rgba(27, 26, 33, 0.1));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.nested.tileGroup--POSITIVE > .tileGroup--NO_CHANGE:has(> [data-treemap-tile-group-title]:hover),
|
|
52
|
+
.nested.tileGroup--POSITIVE > .tileGroup--NO_CHANGE:has(> [data-treemap-tile]:hover),
|
|
53
|
+
.nested.tileGroup--NEGATIVE > .tileGroup--NO_CHANGE:has(> [data-treemap-tile-group-title]:hover),
|
|
54
|
+
.nested.tileGroup--NEGATIVE > .tileGroup--NEGATIVE > .tileGroup--NO_CHANGE:has(> [data-treemap-tile]:hover) {
|
|
55
|
+
background-color: var(--color-background);
|
|
56
|
+
background-image: linear-gradient(rgba(27, 26, 33, 0.1), rgba(27, 26, 33, 0.1));
|
|
57
|
+
}
|