@bundle-stats/ui 4.16.0-beta.0 → 4.16.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/assets/icons.svg +6 -1
- package/lib/assets/icons.svg.js +3 -0
- package/lib/assets/icons.svg.js.map +1 -1
- package/lib/components/bundle-assets/bundle-assets.js +10 -3
- package/lib/components/bundle-assets/bundle-assets.js.map +1 -1
- package/lib/components/bundle-assets-totals/bundle-assets-totals.js +21 -9
- package/lib/components/bundle-assets-totals/bundle-assets-totals.js.map +1 -1
- package/lib/components/bundle-modules/bundle-modules.js +9 -2
- package/lib/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib/components/bundle-packages/bundle-packages.js +9 -2
- package/lib/components/bundle-packages/bundle-packages.js.map +1 -1
- package/lib/components/entry-info/entry-info.js +2 -2
- package/lib/components/entry-info/entry-info.js.map +1 -1
- package/lib/components/insights/insights.module.css +1 -0
- package/lib/components/metrics-table-export/index.js +18 -0
- package/lib/components/metrics-table-export/index.js.map +1 -0
- package/lib/components/metrics-table-export/metrics-table-export.js +82 -0
- package/lib/components/metrics-table-export/metrics-table-export.js.map +1 -0
- package/lib/components/metrics-table-options/index.js.map +1 -1
- package/lib/components/metrics-table-options/metrics-table-options.js +7 -15
- package/lib/components/metrics-table-options/metrics-table-options.js.map +1 -1
- package/lib/components/preview-source/index.js +18 -0
- package/lib/components/preview-source/index.js.map +1 -0
- package/lib/components/preview-source/preview-source.js +28 -0
- package/lib/components/preview-source/preview-source.js.map +1 -0
- package/lib/components/preview-source/preview-source.module.css +40 -0
- package/lib/css/variables.css +5 -0
- package/lib/i18n.js +3 -0
- package/lib/i18n.js.map +1 -1
- package/lib/ui/button/button.js +2 -1
- package/lib/ui/button/button.js.map +1 -1
- package/lib/ui/copy-to-clipboard/copy-to-clipboard.js +2 -6
- package/lib/ui/copy-to-clipboard/copy-to-clipboard.js.map +1 -1
- package/lib/ui/copy-to-clipboard/copy-to-clipboard.module.css +5 -48
- package/lib/ui/dialog/dialog.js +27 -0
- package/lib/ui/dialog/dialog.js.map +1 -0
- package/lib/ui/dialog/dialog.module.css +89 -0
- package/lib/ui/dialog/index.js +18 -0
- package/lib/ui/dialog/index.js.map +1 -0
- package/lib/ui/icon/icon.js +1 -0
- package/lib/ui/icon/icon.js.map +1 -1
- package/lib/ui/index.js +7 -1
- package/lib/ui/index.js.map +1 -1
- package/lib/ui/markdown/index.js +18 -0
- package/lib/ui/markdown/index.js.map +1 -0
- package/lib/ui/markdown/markdown.js +40 -0
- package/lib/ui/markdown/markdown.js.map +1 -0
- package/lib/ui/markdown/markdown.module.css +7 -0
- package/lib/ui/skeleton/skeleton.module.css +3 -3
- package/lib/ui/tabs/tabs.js +2 -2
- package/lib/ui/tabs/tabs.js.map +1 -1
- package/lib/ui/tabs/tabs.module.css +1 -0
- package/lib/ui/textarea/index.js +18 -0
- package/lib/ui/textarea/index.js.map +1 -0
- package/lib/ui/textarea/textarea.js +16 -0
- package/lib/ui/textarea/textarea.js.map +1 -0
- package/lib/ui/textarea/textarea.module.css +57 -0
- package/lib-esm/assets/icons.svg +6 -1
- package/lib-esm/assets/icons.svg.js +3 -0
- package/lib-esm/assets/icons.svg.js.map +1 -1
- package/lib-esm/components/bundle-assets/bundle-assets.js +10 -3
- package/lib-esm/components/bundle-assets/bundle-assets.js.map +1 -1
- package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.js +21 -9
- package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.js.map +1 -1
- package/lib-esm/components/bundle-modules/bundle-modules.js +9 -2
- package/lib-esm/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib-esm/components/bundle-packages/bundle-packages.js +9 -2
- package/lib-esm/components/bundle-packages/bundle-packages.js.map +1 -1
- package/lib-esm/components/entry-info/entry-info.js +2 -2
- package/lib-esm/components/entry-info/entry-info.js.map +1 -1
- package/lib-esm/components/insights/insights.module.css +1 -0
- package/lib-esm/components/metrics-table-export/index.js +2 -0
- package/lib-esm/components/metrics-table-export/index.js.map +1 -0
- package/lib-esm/components/metrics-table-export/metrics-table-export.js +60 -0
- package/lib-esm/components/metrics-table-export/metrics-table-export.js.map +1 -0
- package/lib-esm/components/metrics-table-options/index.js.map +1 -1
- package/lib-esm/components/metrics-table-options/metrics-table-options.js +7 -15
- package/lib-esm/components/metrics-table-options/metrics-table-options.js.map +1 -1
- package/lib-esm/components/preview-source/index.js +2 -0
- package/lib-esm/components/preview-source/index.js.map +1 -0
- package/lib-esm/components/preview-source/preview-source.js +21 -0
- package/lib-esm/components/preview-source/preview-source.js.map +1 -0
- package/lib-esm/components/preview-source/preview-source.module.css +40 -0
- package/lib-esm/css/variables.css +5 -0
- package/lib-esm/i18n.js +3 -0
- package/lib-esm/i18n.js.map +1 -1
- package/lib-esm/ui/button/button.js +1 -0
- package/lib-esm/ui/button/button.js.map +1 -1
- package/lib-esm/ui/copy-to-clipboard/copy-to-clipboard.js +2 -6
- package/lib-esm/ui/copy-to-clipboard/copy-to-clipboard.js.map +1 -1
- package/lib-esm/ui/copy-to-clipboard/copy-to-clipboard.module.css +5 -48
- package/lib-esm/ui/dialog/dialog.js +19 -0
- package/lib-esm/ui/dialog/dialog.js.map +1 -0
- package/lib-esm/ui/dialog/dialog.module.css +89 -0
- package/lib-esm/ui/dialog/index.js +2 -0
- package/lib-esm/ui/dialog/index.js.map +1 -0
- package/lib-esm/ui/icon/icon.js +1 -0
- package/lib-esm/ui/icon/icon.js.map +1 -1
- package/lib-esm/ui/index.js +3 -0
- package/lib-esm/ui/index.js.map +1 -1
- package/lib-esm/ui/markdown/index.js +2 -0
- package/lib-esm/ui/markdown/index.js.map +1 -0
- package/lib-esm/ui/markdown/markdown.js +10 -0
- package/lib-esm/ui/markdown/markdown.js.map +1 -0
- package/lib-esm/ui/markdown/markdown.module.css +7 -0
- package/lib-esm/ui/skeleton/skeleton.module.css +3 -3
- package/lib-esm/ui/tabs/tabs.js +2 -2
- package/lib-esm/ui/tabs/tabs.js.map +1 -1
- package/lib-esm/ui/tabs/tabs.module.css +1 -0
- package/lib-esm/ui/textarea/index.js +2 -0
- package/lib-esm/ui/textarea/index.js.map +1 -0
- package/lib-esm/ui/textarea/textarea.js +9 -0
- package/lib-esm/ui/textarea/textarea.js.map +1 -0
- package/lib-esm/ui/textarea/textarea.module.css +57 -0
- package/package.json +14 -13
- package/src/assets/icons/download.svg +4 -0
- package/src/assets/icons.svg +6 -1
- package/src/assets/icons.svg.jsx +9 -0
- package/src/components/bundle-assets/bundle-assets.jsx +20 -7
- package/src/components/bundle-assets-totals/bundle-assets-totals.jsx +54 -35
- package/src/components/bundle-modules/bundle-modules.tsx +15 -2
- package/src/components/bundle-packages/bundle-packages.jsx +15 -2
- package/src/components/entry-info/entry-info.tsx +2 -2
- package/src/components/insights/insights.module.css +1 -0
- package/src/components/metrics-table-export/index.ts +1 -0
- package/src/components/metrics-table-export/metrics-table-export.stories.tsx +30 -0
- package/src/components/metrics-table-export/metrics-table-export.tsx +102 -0
- package/src/components/metrics-table-options/metrics-table-options.stories.tsx +22 -0
- package/src/components/metrics-table-options/metrics-table-options.tsx +25 -0
- package/src/components/preview-source/index.ts +1 -0
- package/src/components/preview-source/preview-source.module.css +40 -0
- package/src/components/preview-source/preview-source.stories.tsx +53 -0
- package/src/components/preview-source/preview-source.tsx +56 -0
- package/src/css/variables.css +5 -0
- package/src/i18n.js +4 -0
- package/src/ui/button/button.tsx +2 -1
- package/src/ui/copy-to-clipboard/copy-to-clipboard.module.css +5 -48
- package/src/ui/copy-to-clipboard/copy-to-clipboard.tsx +4 -8
- package/src/ui/dialog/dialog.module.css +89 -0
- package/src/ui/dialog/dialog.stories.tsx +67 -0
- package/src/ui/dialog/dialog.tsx +62 -0
- package/src/ui/dialog/index.ts +1 -0
- package/src/ui/icon/icon.tsx +1 -0
- package/src/ui/index.js +3 -0
- package/src/ui/markdown/index.ts +1 -0
- package/src/ui/markdown/markdown.module.css +7 -0
- package/src/ui/markdown/markdown.stories.tsx +29 -0
- package/src/ui/markdown/markdown.tsx +24 -0
- package/src/ui/skeleton/skeleton.module.css +3 -3
- package/src/ui/tabs/tabs.jsx +2 -2
- package/src/ui/tabs/tabs.module.css +1 -0
- package/src/ui/textarea/index.ts +1 -0
- package/src/ui/textarea/textarea.module.css +57 -0
- package/src/ui/textarea/textarea.stories.tsx +37 -0
- package/src/ui/textarea/textarea.tsx +17 -0
- package/types/components/metrics-table-export/index.d.ts +1 -0
- package/types/components/metrics-table-export/metrics-table-export.d.ts +10 -0
- package/types/components/metrics-table-options/index.d.ts +1 -1
- package/types/components/metrics-table-options/metrics-table-options.d.ts +9 -17
- package/types/components/preview-source/index.d.ts +1 -0
- package/types/components/preview-source/preview-source.d.ts +9 -0
- package/types/i18n.d.ts +3 -0
- package/types/ui/button/button.d.ts +26 -0
- package/types/ui/dialog/dialog.d.ts +13 -0
- package/types/ui/dialog/index.d.ts +1 -0
- package/types/ui/icon/icon.d.ts +2 -0
- package/types/ui/index.d.ts +3 -0
- package/types/ui/markdown/index.d.ts +1 -0
- package/types/ui/markdown/markdown.d.ts +7 -0
- package/types/ui/tabs/tabs.d.ts +3 -3
- package/types/ui/textarea/index.d.ts +1 -0
- package/types/ui/textarea/textarea.d.ts +6 -0
- package/src/components/metrics-table-options/metrics-table-options.jsx +0 -30
- /package/src/components/metrics-table-options/{index.js → index.ts} +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import css from './textarea.module.css';
|
|
4
|
+
export const Textarea = (props) => {
|
|
5
|
+
const { className = '', size = '', ...restProps } = props;
|
|
6
|
+
const rootClassName = cx(css.root, size && css[size], className);
|
|
7
|
+
return React.createElement("textarea", { className: rootClassName, ...restProps });
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=textarea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textarea.js","sourceRoot":"","sources":["../../../src/ui/textarea/textarea.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,GAAG,MAAM,uBAAuB,CAAC;AAMxC,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAoB,EAAE,EAAE;IAC/C,MAAM,EAAE,SAAS,GAAG,EAAE,EAAE,IAAI,GAAG,EAAE,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAE1D,MAAM,aAAa,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,IAAI,GAAG,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC;IAEjE,OAAO,kCAAU,SAAS,EAAE,aAAa,KAAM,SAAS,GAAI,CAAC;AAC/D,CAAC,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
border: 1px solid var(--color-outline);
|
|
3
|
+
border-radius: var(--radius-small);
|
|
4
|
+
color: var(--color-text-light);
|
|
5
|
+
width: 100%;
|
|
6
|
+
resize: vertical;
|
|
7
|
+
transition: var(--transition-in);
|
|
8
|
+
appearance: none;
|
|
9
|
+
outline: none;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.root::-webkit-input-placeholder {
|
|
13
|
+
color: var(--color-text-light);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.root::-moz-placeholder {
|
|
17
|
+
color: var(--color-text-light);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.root:-ms-input-placeholder {
|
|
21
|
+
color: var(--color-text-light);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.root:-moz-placeholder {
|
|
25
|
+
color: var(--color-text-light);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.root:focus {
|
|
29
|
+
box-shadow: var(--outline-hover);
|
|
30
|
+
border-color: var(--color-outline-dark);
|
|
31
|
+
color: inherit;
|
|
32
|
+
transition: var(--transition-out);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.root[readonly=""] {
|
|
36
|
+
color: var(--color-text-light);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Size modifier */
|
|
40
|
+
/* default - medium */
|
|
41
|
+
.root {
|
|
42
|
+
padding: var(--space-xsmall);
|
|
43
|
+
font-size: var(--size-medium);
|
|
44
|
+
line-height: calc(var(--space-medium) - 2px);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.small {
|
|
48
|
+
padding: var(--space-xxsmall);
|
|
49
|
+
font-size: var(--size-small);
|
|
50
|
+
line-height: calc(var(--space-small) - 2px);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.large {
|
|
54
|
+
padding: var(--space-small);
|
|
55
|
+
font-size: var(--size-large);
|
|
56
|
+
line-height: calc(var(--space-large) - 2px);
|
|
57
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bundle-stats/ui",
|
|
3
|
-
"version": "4.16.0-beta.
|
|
3
|
+
"version": "4.16.0-beta.10",
|
|
4
4
|
"description": "UI components for BundleStats projects.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-esm/index.js",
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
},
|
|
37
37
|
"homepage": "https://github.com/relative-ci/bundle-stats/blob/master/packages/ui#readme",
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@babel/preset-env": "7.25.
|
|
40
|
-
"@babel/preset-react": "7.
|
|
41
|
-
"@babel/preset-typescript": "7.
|
|
42
|
-
"@storybook/addon-essentials": "8.3.
|
|
39
|
+
"@babel/preset-env": "7.25.7",
|
|
40
|
+
"@babel/preset-react": "7.25.7",
|
|
41
|
+
"@babel/preset-typescript": "7.25.7",
|
|
42
|
+
"@storybook/addon-essentials": "8.3.5",
|
|
43
43
|
"@storybook/addon-webpack5-compiler-babel": "3.0.3",
|
|
44
|
-
"@storybook/react": "8.3.
|
|
45
|
-
"@storybook/react-webpack5": "8.3.
|
|
44
|
+
"@storybook/react": "8.3.5",
|
|
45
|
+
"@storybook/react-webpack5": "8.3.5",
|
|
46
46
|
"@types/d3": "7.4.3",
|
|
47
|
-
"@types/react": "18.3.
|
|
47
|
+
"@types/react": "18.3.11",
|
|
48
48
|
"@types/react-router-dom": "5.3.3",
|
|
49
49
|
"babel-plugin-require-context-hook": "1.0.0",
|
|
50
50
|
"classnames": "2.5.1",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"react-dom": "18.3.1",
|
|
62
62
|
"react-router-dom": "5.3.4",
|
|
63
63
|
"rimraf": "6.0.1",
|
|
64
|
-
"storybook": "8.3.
|
|
64
|
+
"storybook": "8.3.5",
|
|
65
65
|
"typescript": "5.6.2",
|
|
66
66
|
"typescript-plugin-css-modules": "5.1.0"
|
|
67
67
|
},
|
|
@@ -74,12 +74,13 @@
|
|
|
74
74
|
"react-router-dom": "^5.0.0"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@bundle-stats/utils": "^4.16.0-beta.
|
|
77
|
+
"@bundle-stats/utils": "^4.16.0-beta.10",
|
|
78
78
|
"ariakit": "2.0.0-next.44",
|
|
79
|
-
"d3": "
|
|
79
|
+
"d3": "7.9.0",
|
|
80
80
|
"modern-css-reset": "1.4.0",
|
|
81
|
-
"react-use": "
|
|
81
|
+
"react-use": "17.5.1",
|
|
82
|
+
"snarkdown": "2.0.0",
|
|
82
83
|
"use-query-params": "2.2.1"
|
|
83
84
|
},
|
|
84
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "cb616111c85f4b0d28e4b049fe3f6c7b0d7551d7"
|
|
85
86
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="currentColor">
|
|
2
|
+
<path d="M0 0h24v24H0z" fill="none"/>
|
|
3
|
+
<path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM17 13l-5 5-5-5h3V9h4v4h3z"/>
|
|
4
|
+
</svg>
|
package/src/assets/icons.svg
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
<symbol fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" id="clipboard-check" xmlns="http://www.w3.org/2000/svg">
|
|
23
23
|
<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/>
|
|
24
24
|
<path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>
|
|
25
|
-
<path d="m9.277 15.145 2 2 4-4"
|
|
25
|
+
<path d="m9.277 15.145 2 2 4-4"/>
|
|
26
26
|
</symbol>
|
|
27
27
|
<symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-clock" id="clock" xmlns="http://www.w3.org/2000/svg">
|
|
28
28
|
<circle cx="12" cy="12" r="10"/>
|
|
@@ -36,6 +36,10 @@
|
|
|
36
36
|
<circle cx="12" cy="12" r="4"/>
|
|
37
37
|
<path d="M1.05 12H7M17.01 12h5.95"/>
|
|
38
38
|
</symbol>
|
|
39
|
+
<symbol fill="currentColor" viewBox="0 0 24 24" id="download" xmlns="http://www.w3.org/2000/svg">
|
|
40
|
+
<path d="M0 0h24v24H0z" fill="none"/>
|
|
41
|
+
<path d="M19.35 10.04A7.49 7.49 0 0 0 12 4C9.11 4 6.6 5.64 5.35 8.04A5.994 5.994 0 0 0 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM17 13l-5 5-5-5h3V9h4v4h3z"/>
|
|
42
|
+
</symbol>
|
|
39
43
|
<symbol fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" id="error" xmlns="http://www.w3.org/2000/svg">
|
|
40
44
|
<circle cx="12" cy="12" r="10"/>
|
|
41
45
|
<path d="M12 8v4M12 16h.01"/>
|
|
@@ -79,3 +83,4 @@
|
|
|
79
83
|
<path d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0zM12 9v4M12 17h.01"/>
|
|
80
84
|
</symbol>
|
|
81
85
|
</svg>
|
|
86
|
+
|
package/src/assets/icons.svg.jsx
CHANGED
|
@@ -129,6 +129,15 @@ export const SvgIcons = (props) => (
|
|
|
129
129
|
<circle cx="12" cy="12" r="4" />
|
|
130
130
|
<path d="M1.05 12H7M17.01 12h5.95" />
|
|
131
131
|
</symbol>
|
|
132
|
+
<symbol
|
|
133
|
+
fill="currentColor"
|
|
134
|
+
viewBox="0 0 24 24"
|
|
135
|
+
id="download"
|
|
136
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
137
|
+
>
|
|
138
|
+
<path d="M0 0h24v24H0z" fill="none" />
|
|
139
|
+
<path d="M19.35 10.04A7.49 7.49 0 0 0 12 4C9.11 4 6.6 5.64 5.35 8.04A5.994 5.994 0 0 0 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM17 13l-5 5-5-5h3V9h4v4h3z" />
|
|
140
|
+
</symbol>
|
|
132
141
|
<symbol
|
|
133
142
|
fill="none"
|
|
134
143
|
stroke="currentColor"
|
|
@@ -19,6 +19,7 @@ import { useMetricsDisplayType } from '../../hooks/metrics-display-type';
|
|
|
19
19
|
import { Box } from '../../layout/box';
|
|
20
20
|
import { FlexStack } from '../../layout/flex-stack';
|
|
21
21
|
import { Stack } from '../../layout/stack';
|
|
22
|
+
import { Dialog, useDialogState } from '../../ui/dialog';
|
|
22
23
|
import { Icon } from '../../ui/icon';
|
|
23
24
|
import { InputSearch } from '../../ui/input-search';
|
|
24
25
|
import { FileName } from '../../ui/file-name';
|
|
@@ -32,6 +33,7 @@ import { AssetInfo } from '../asset-info';
|
|
|
32
33
|
import { AssetNotPredictive } from '../asset-not-predictive';
|
|
33
34
|
import { ComponentLink } from '../component-link';
|
|
34
35
|
import { MetricsTable } from '../metrics-table';
|
|
36
|
+
import { MetricsTableExport } from '../metrics-table-export';
|
|
35
37
|
import { MetricsTableOptions } from '../metrics-table-options';
|
|
36
38
|
import { MetricsTableTitle } from '../metrics-table-title';
|
|
37
39
|
import { MetricsDisplaySelector } from '../metrics-display-selector';
|
|
@@ -50,10 +52,10 @@ const DISPLAY_TYPE_GROUPS = {
|
|
|
50
52
|
|
|
51
53
|
const getFileTypeFilters = (filters) =>
|
|
52
54
|
Object.entries(FILE_TYPE_LABELS).map(([key, label]) => ({
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
key,
|
|
56
|
+
label,
|
|
57
|
+
defaultValue: get(filters, `${ASSET_FILE_TYPE}.${key}`, true),
|
|
58
|
+
}));
|
|
57
59
|
|
|
58
60
|
const getFilters = ({ compareMode, filters }) => ({
|
|
59
61
|
[ASSET_FILTERS.CHANGED]: {
|
|
@@ -62,7 +64,7 @@ const getFilters = ({ compareMode, filters }) => ({
|
|
|
62
64
|
disabled: !compareMode,
|
|
63
65
|
},
|
|
64
66
|
[ASSET_ENTRY_TYPE]: {
|
|
65
|
-
label: '
|
|
67
|
+
label: 'Type',
|
|
66
68
|
children: [
|
|
67
69
|
{
|
|
68
70
|
key: ASSET_FILTERS.ENTRY,
|
|
@@ -313,6 +315,12 @@ export const BundleAssets = (props) => {
|
|
|
313
315
|
return allItems.find(({ key }) => key === entryId);
|
|
314
316
|
}, [allItems, entryId]);
|
|
315
317
|
|
|
318
|
+
const exportDialog = useDialogState();
|
|
319
|
+
|
|
320
|
+
const handleExportClick = useCallback(() => {
|
|
321
|
+
exportDialog.toggle();
|
|
322
|
+
}, []);
|
|
323
|
+
|
|
316
324
|
return (
|
|
317
325
|
<>
|
|
318
326
|
<Stack space="xsmall" as="section" className={cx(css.root, className)}>
|
|
@@ -326,8 +334,9 @@ export const BundleAssets = (props) => {
|
|
|
326
334
|
onSelect={setDisplayType}
|
|
327
335
|
/>
|
|
328
336
|
<MetricsTableOptions
|
|
329
|
-
|
|
330
|
-
|
|
337
|
+
onViewAllClick={resetAllFilters}
|
|
338
|
+
onResetClick={resetFilters}
|
|
339
|
+
onExportClick={handleExportClick}
|
|
331
340
|
/>
|
|
332
341
|
</FlexStack>
|
|
333
342
|
)}
|
|
@@ -385,6 +394,10 @@ export const BundleAssets = (props) => {
|
|
|
385
394
|
onClose={hideEntryInfo}
|
|
386
395
|
/>
|
|
387
396
|
)}
|
|
397
|
+
|
|
398
|
+
<Dialog title={I18N.EXPORT} width="wide" state={exportDialog}>
|
|
399
|
+
{exportDialog.open && <MetricsTableExport items={items} download="bundle-stats--assets" />}
|
|
400
|
+
</Dialog>
|
|
388
401
|
</>
|
|
389
402
|
);
|
|
390
403
|
};
|
|
@@ -15,12 +15,16 @@ import { Toolbar } from '../../ui/toolbar';
|
|
|
15
15
|
import { Table } from '../../ui/table';
|
|
16
16
|
import { Box } from '../../layout/box';
|
|
17
17
|
import { Stack } from '../../layout/stack';
|
|
18
|
+
import { Dialog, useDialogState } from '../../ui/dialog';
|
|
18
19
|
import { MetricsDisplaySelector } from '../metrics-display-selector';
|
|
19
20
|
import { MetricsTable } from '../metrics-table';
|
|
20
|
-
import {
|
|
21
|
+
import { MetricsTableExport } from '../metrics-table-export';
|
|
21
22
|
import { MetricsTableHeader } from '../metrics-table-header';
|
|
23
|
+
import { MetricsTableOptions } from '../metrics-table-options';
|
|
24
|
+
import { MetricsTableTitle } from '../metrics-table-title';
|
|
22
25
|
import { MetricsTreemap, getTreemapNodes } from '../metrics-treemap';
|
|
23
26
|
import { ComponentLink } from '../component-link';
|
|
27
|
+
import { FlexStack } from '../../layout';
|
|
24
28
|
|
|
25
29
|
const metricsTableTitle = (
|
|
26
30
|
<MetricsTableTitle
|
|
@@ -68,42 +72,57 @@ export const BundleAssetsTotals = ({
|
|
|
68
72
|
[history],
|
|
69
73
|
);
|
|
70
74
|
|
|
75
|
+
const exportDialog = useDialogState();
|
|
76
|
+
|
|
77
|
+
const handleExportClick = useCallback(() => {
|
|
78
|
+
exportDialog.toggle();
|
|
79
|
+
}, []);
|
|
80
|
+
|
|
71
81
|
return (
|
|
72
|
-
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
<Table compact>
|
|
92
|
-
<MetricsTableHeader
|
|
93
|
-
metricTitle={metricsTableTitle}
|
|
94
|
-
showSum
|
|
95
|
-
jobs={jobs}
|
|
96
|
-
rows={items}
|
|
97
|
-
/>
|
|
98
|
-
</Table>
|
|
99
|
-
<MetricsTreemap
|
|
100
|
-
treeNodes={getTreemapNodes(items)}
|
|
101
|
-
onItemClick={onTreemapItemClick || handleMetricsTreemapItemClick}
|
|
82
|
+
<>
|
|
83
|
+
<Stack space="xsmall" as="section" className={className}>
|
|
84
|
+
<Toolbar
|
|
85
|
+
renderActions={() => (
|
|
86
|
+
<FlexStack space="xxsmall">
|
|
87
|
+
<MetricsDisplaySelector onSelect={setDisplayType} value={displayType.value} />
|
|
88
|
+
<MetricsTableOptions onExportClick={handleExportClick} />
|
|
89
|
+
</FlexStack>
|
|
90
|
+
)}
|
|
91
|
+
/>
|
|
92
|
+
<Box outline as="main">
|
|
93
|
+
{displayType.value === MetricsDisplayType.TABLE && (
|
|
94
|
+
<MetricsTable
|
|
95
|
+
title={metricsTableTitle}
|
|
96
|
+
runs={jobs}
|
|
97
|
+
items={items}
|
|
98
|
+
renderRowHeader={renderRowHeader}
|
|
99
|
+
showHeaderSum
|
|
100
|
+
{...restProps}
|
|
102
101
|
/>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
)}
|
|
103
|
+
{displayType.value === MetricsDisplayType.TREEMAP && (
|
|
104
|
+
<>
|
|
105
|
+
<Table compact>
|
|
106
|
+
<MetricsTableHeader
|
|
107
|
+
metricTitle={metricsTableTitle}
|
|
108
|
+
showSum
|
|
109
|
+
jobs={jobs}
|
|
110
|
+
rows={items}
|
|
111
|
+
/>
|
|
112
|
+
</Table>
|
|
113
|
+
<MetricsTreemap
|
|
114
|
+
treeNodes={getTreemapNodes(items)}
|
|
115
|
+
onItemClick={onTreemapItemClick || handleMetricsTreemapItemClick}
|
|
116
|
+
/>
|
|
117
|
+
</>
|
|
118
|
+
)}
|
|
119
|
+
</Box>
|
|
120
|
+
</Stack>
|
|
121
|
+
|
|
122
|
+
<Dialog title={I18N.EXPORT} width="wide" state={exportDialog}>
|
|
123
|
+
{exportDialog.open && <MetricsTableExport items={items} download="bundle-stats--totals" />}
|
|
124
|
+
</Dialog>
|
|
125
|
+
</>
|
|
107
126
|
);
|
|
108
127
|
};
|
|
109
128
|
|
|
@@ -13,6 +13,7 @@ import { FlexStack } from '../../layout/flex-stack';
|
|
|
13
13
|
import { Stack } from '../../layout/stack';
|
|
14
14
|
import { Button } from '../../ui/button';
|
|
15
15
|
import { ControlGroup } from '../../ui/control-group';
|
|
16
|
+
import { Dialog, useDialogState } from '../../ui/dialog';
|
|
16
17
|
import { EmptySet } from '../../ui/empty-set';
|
|
17
18
|
import { FileName } from '../../ui/file-name';
|
|
18
19
|
import { Filters } from '../../ui/filters';
|
|
@@ -23,6 +24,7 @@ import { Toolbar } from '../../ui/toolbar';
|
|
|
23
24
|
import { Tooltip } from '../../ui/tooltip';
|
|
24
25
|
import { ComponentLink } from '../component-link';
|
|
25
26
|
import { MetricsTable } from '../metrics-table';
|
|
27
|
+
import { MetricsTableExport } from '../metrics-table-export';
|
|
26
28
|
import { MetricsTableHeader } from '../metrics-table-header';
|
|
27
29
|
import { MetricsTreemap, getTreemapNodes, getTreemapNodesGroupedByPath } from '../metrics-treemap';
|
|
28
30
|
import { MetricsTableOptions } from '../metrics-table-options';
|
|
@@ -252,6 +254,12 @@ export const BundleModules = (props: BundleModulesProps) => {
|
|
|
252
254
|
return allItems.find(({ key }) => key === entryId);
|
|
253
255
|
}, [allItems, entryId]);
|
|
254
256
|
|
|
257
|
+
const exportDialog = useDialogState();
|
|
258
|
+
|
|
259
|
+
const handleExportClick = useCallback(() => {
|
|
260
|
+
exportDialog.toggle();
|
|
261
|
+
}, []);
|
|
262
|
+
|
|
255
263
|
return (
|
|
256
264
|
<>
|
|
257
265
|
<Stack space="xsmall" as="section" className={rootClassName}>
|
|
@@ -266,8 +274,9 @@ export const BundleModules = (props: BundleModulesProps) => {
|
|
|
266
274
|
groups={DISPLAY_TYPE_GROUPS}
|
|
267
275
|
/>
|
|
268
276
|
<MetricsTableOptions
|
|
269
|
-
|
|
270
|
-
|
|
277
|
+
onViewAllClick={resetAllFilters}
|
|
278
|
+
onResetClick={resetFilters}
|
|
279
|
+
onExportClick={handleExportClick}
|
|
271
280
|
/>
|
|
272
281
|
</FlexStack>
|
|
273
282
|
)}
|
|
@@ -363,6 +372,10 @@ export const BundleModules = (props: BundleModulesProps) => {
|
|
|
363
372
|
onClose={hideEntryInfo}
|
|
364
373
|
/>
|
|
365
374
|
)}
|
|
375
|
+
|
|
376
|
+
<Dialog title={I18N.EXPORT} width="wide" state={exportDialog}>
|
|
377
|
+
{exportDialog.open && <MetricsTableExport items={items} download="bundle-stats--modules"/>}
|
|
378
|
+
</Dialog>
|
|
366
379
|
</>
|
|
367
380
|
);
|
|
368
381
|
};
|
|
@@ -9,6 +9,7 @@ import I18N from '../../i18n';
|
|
|
9
9
|
import { Box } from '../../layout/box';
|
|
10
10
|
import { FlexStack } from '../../layout/flex-stack';
|
|
11
11
|
import { Stack } from '../../layout/stack';
|
|
12
|
+
import { Dialog, useDialogState } from '../../ui/dialog';
|
|
12
13
|
import { InputSearch } from '../../ui/input-search';
|
|
13
14
|
import { EmptySet } from '../../ui/empty-set';
|
|
14
15
|
import { Filters } from '../../ui/filters';
|
|
@@ -17,6 +18,7 @@ import { Table } from '../../ui/table';
|
|
|
17
18
|
import { Toolbar } from '../../ui/toolbar';
|
|
18
19
|
import { ComponentLink } from '../component-link';
|
|
19
20
|
import { MetricsTable } from '../metrics-table';
|
|
21
|
+
import { MetricsTableExport } from '../metrics-table-export';
|
|
20
22
|
import { MetricsTableHeader } from '../metrics-table-header';
|
|
21
23
|
import { MetricsTableOptions } from '../metrics-table-options';
|
|
22
24
|
import { MetricsTableTitle } from '../metrics-table-title';
|
|
@@ -261,6 +263,12 @@ export const BundlePackages = (props) => {
|
|
|
261
263
|
return allItems.find(({ key }) => key === entryId)
|
|
262
264
|
}, [allItems, entryId]);
|
|
263
265
|
|
|
266
|
+
const exportDialog = useDialogState();
|
|
267
|
+
|
|
268
|
+
const handleExportClick = useCallback(() => {
|
|
269
|
+
exportDialog.toggle();
|
|
270
|
+
}, []);
|
|
271
|
+
|
|
264
272
|
return (
|
|
265
273
|
<>
|
|
266
274
|
<Stack space="xsmall" as="section" className={cx(css.root, className)}>
|
|
@@ -270,8 +278,9 @@ export const BundlePackages = (props) => {
|
|
|
270
278
|
<FlexStack space="xxsmall" className={cx(css.dropdown, actionClassName)}>
|
|
271
279
|
<MetricsDisplaySelector onSelect={setDisplayType} value={displayType.value} groupBy={displayType.groupBy} groups={DISPLAY_TYPE_GROUPS} />
|
|
272
280
|
<MetricsTableOptions
|
|
273
|
-
|
|
274
|
-
|
|
281
|
+
onViewAllClick={resetAllFilters}
|
|
282
|
+
onResetClick={resetFilters}
|
|
283
|
+
onExportClick={handleExportClick}
|
|
275
284
|
/>
|
|
276
285
|
</FlexStack>
|
|
277
286
|
)}
|
|
@@ -327,6 +336,10 @@ export const BundlePackages = (props) => {
|
|
|
327
336
|
onClose={hideEntryInfo}
|
|
328
337
|
/>
|
|
329
338
|
)}
|
|
339
|
+
|
|
340
|
+
<Dialog title={I18N.EXPORT} width="wide" state={exportDialog}>
|
|
341
|
+
{exportDialog.open && <MetricsTableExport items={items} download="bundle-stats--packages"/>}
|
|
342
|
+
</Dialog>
|
|
330
343
|
</>
|
|
331
344
|
);
|
|
332
345
|
};
|
|
@@ -105,7 +105,7 @@ export const EntryInfo = (props: EntryInfoProps & React.ComponentProps<'div'>) =
|
|
|
105
105
|
<Stack space="small">
|
|
106
106
|
<FlexStack space="xxxsmall" alignItems="center" as="h3" className={css.label}>
|
|
107
107
|
<FileName as="code" name={itemTitle || item.label} className={css.fileName} />
|
|
108
|
-
<CopyToClipboard text={item.label} />
|
|
108
|
+
<CopyToClipboard text={item.label} size="small" />
|
|
109
109
|
</FlexStack>
|
|
110
110
|
<div>{renderRunInfo(item)}</div>
|
|
111
111
|
</Stack>
|
|
@@ -156,7 +156,7 @@ export const EntryInfo = (props: EntryInfoProps & React.ComponentProps<'div'>) =
|
|
|
156
156
|
name={rowRun[runNameSelector]}
|
|
157
157
|
className={css.fileName}
|
|
158
158
|
/>
|
|
159
|
-
<CopyToClipboard text={item.label} />
|
|
159
|
+
<CopyToClipboard text={item.label} size="small" />
|
|
160
160
|
</FlexStack>
|
|
161
161
|
) : (
|
|
162
162
|
'-'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './metrics-table-export';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import { getWrapperDecorator } from '../../stories';
|
|
4
|
+
import { MetricsTableExport } from '.';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof MetricsTableExport> = {
|
|
7
|
+
title: 'Components/MetricsTableExport',
|
|
8
|
+
component: MetricsTableExport,
|
|
9
|
+
decorators: [getWrapperDecorator()],
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
13
|
+
|
|
14
|
+
type Story = StoryObj<typeof meta>;
|
|
15
|
+
|
|
16
|
+
const ITEMS = [
|
|
17
|
+
{
|
|
18
|
+
label: 'Hey',
|
|
19
|
+
runs: [
|
|
20
|
+
{ value: 1, name: 'a' },
|
|
21
|
+
{ value: 2, name: 'b' },
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
export const Default: Story = {
|
|
27
|
+
args: {
|
|
28
|
+
items: ITEMS,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import type { ReportMetricRow } from '@bundle-stats/utils';
|
|
4
|
+
|
|
5
|
+
import { Stack } from '../../layout/stack';
|
|
6
|
+
import { Tabs } from '../../ui/tabs';
|
|
7
|
+
import { PreviewSource } from '../preview-source';
|
|
8
|
+
|
|
9
|
+
const generateSourceJSON = (items: Array<ReportMetricRow>): string => {
|
|
10
|
+
const output = items.map((item) => ({
|
|
11
|
+
name: item.label,
|
|
12
|
+
runs: item.runs?.map((itemRun) => ({
|
|
13
|
+
name: itemRun?.name || '',
|
|
14
|
+
size: itemRun?.value || 0,
|
|
15
|
+
})),
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
return JSON.stringify(output, null, 2);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const CSV_SEPARATOR = ', ';
|
|
22
|
+
|
|
23
|
+
const generateSourceCSV = (items: Array<ReportMetricRow>): string => {
|
|
24
|
+
const output = [];
|
|
25
|
+
|
|
26
|
+
output.push(
|
|
27
|
+
[
|
|
28
|
+
'Name',
|
|
29
|
+
...(items?.[0]?.runs?.map((_, index) => {
|
|
30
|
+
if (index === 0) {
|
|
31
|
+
return `Run ${index + 1}(current)`;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return `Run ${index + 1}(baseline)`;
|
|
35
|
+
}) || []),
|
|
36
|
+
].join(CSV_SEPARATOR),
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
items?.forEach((item) => {
|
|
40
|
+
const row: Array<string | number> = [item.label];
|
|
41
|
+
|
|
42
|
+
item.runs?.forEach((itemRun) => {
|
|
43
|
+
row.push(itemRun?.value || 0);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
output.push(row.join(CSV_SEPARATOR));
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
return output.join('\r');
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const SOURCES = [
|
|
53
|
+
{
|
|
54
|
+
label: 'CSV',
|
|
55
|
+
transformFn: generateSourceCSV,
|
|
56
|
+
extension: 'csv',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
label: 'JSON',
|
|
60
|
+
transformFn: generateSourceJSON,
|
|
61
|
+
extension: 'json',
|
|
62
|
+
},
|
|
63
|
+
];
|
|
64
|
+
|
|
65
|
+
type MetricsTableExportProps = {
|
|
66
|
+
items: Array<ReportMetricRow>;
|
|
67
|
+
download: string;
|
|
68
|
+
} & ComponentProps<typeof Stack>;
|
|
69
|
+
|
|
70
|
+
export const MetricsTableExport = (props: MetricsTableExportProps) => {
|
|
71
|
+
const { items, download, ...restProps } = props;
|
|
72
|
+
const [selectedId, setSelectedId] = useState(SOURCES[0].label);
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<Stack space="small" {...restProps}>
|
|
76
|
+
<Tabs>
|
|
77
|
+
{SOURCES.map((source) => (
|
|
78
|
+
<Tabs.Item
|
|
79
|
+
onClick={() => setSelectedId(source.label)}
|
|
80
|
+
isTabActive={selectedId === source.label}
|
|
81
|
+
key={source.label}
|
|
82
|
+
>
|
|
83
|
+
{source.label}
|
|
84
|
+
</Tabs.Item>
|
|
85
|
+
))}
|
|
86
|
+
</Tabs>
|
|
87
|
+
<div>
|
|
88
|
+
{SOURCES.map(
|
|
89
|
+
(source) =>
|
|
90
|
+
selectedId === source.label && (
|
|
91
|
+
<PreviewSource
|
|
92
|
+
source={source.transformFn(items)}
|
|
93
|
+
rows={20}
|
|
94
|
+
download={`${download}.${source.extension}`}
|
|
95
|
+
key={source.label}
|
|
96
|
+
/>
|
|
97
|
+
),
|
|
98
|
+
)}
|
|
99
|
+
</div>
|
|
100
|
+
</Stack>
|
|
101
|
+
);
|
|
102
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
|
+
import { action } from '@storybook/addon-actions';
|
|
4
|
+
|
|
5
|
+
import { getWrapperDecorator } from '../../stories';
|
|
6
|
+
import { MetricsTableOptions } from '.';
|
|
7
|
+
|
|
8
|
+
const meta: Meta<typeof MetricsTableOptions> = {
|
|
9
|
+
title: 'Components/MetricsTableOptions',
|
|
10
|
+
component: MetricsTableOptions,
|
|
11
|
+
decorators: [getWrapperDecorator()],
|
|
12
|
+
args: {
|
|
13
|
+
onResetClick: action('RESET'),
|
|
14
|
+
onViewAllClick: action('VIEW_ALL'),
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default meta;
|
|
19
|
+
|
|
20
|
+
type Story = StoryObj<typeof meta>;
|
|
21
|
+
|
|
22
|
+
export const Default: Story = {};
|