@bundle-stats/ui 4.18.3 → 4.19.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/bundle-assets/bundle-assets.js +1 -1
- package/lib/components/bundle-assets/bundle-assets.js.map +1 -1
- package/lib/components/bundle-modules/bundle-modules.js +1 -1
- package/lib/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib/components/bundle-packages/bundle-packages.js +1 -1
- package/lib/components/bundle-packages/bundle-packages.js.map +1 -1
- package/lib/components/metric/metric.module.css +1 -1
- package/lib/components/metrics-display-selector/metrics-display-selector.js +16 -15
- package/lib/components/metrics-display-selector/metrics-display-selector.js.map +1 -1
- package/lib/components/metrics-display-selector/metrics-display-selector.module.css +30 -1
- package/lib/components/metrics-table-options/metrics-table-options.module.css +14 -4
- package/lib/components/run-info/run-info.module.css +1 -1
- package/lib/constants.js +8 -1
- package/lib/constants.js.map +1 -1
- package/lib/hooks/metrics-display-type.js +7 -6
- package/lib/hooks/metrics-display-type.js.map +1 -1
- package/lib/ui/dropdown/dropdown.js +2 -2
- package/lib/ui/dropdown/dropdown.js.map +1 -1
- package/lib/ui/dropdown/dropdown.module.css +1 -1
- package/lib-esm/components/bundle-assets/bundle-assets.js +2 -2
- package/lib-esm/components/bundle-assets/bundle-assets.js.map +1 -1
- package/lib-esm/components/bundle-modules/bundle-modules.js +2 -2
- package/lib-esm/components/bundle-modules/bundle-modules.js.map +1 -1
- package/lib-esm/components/bundle-packages/bundle-packages.js +2 -2
- package/lib-esm/components/bundle-packages/bundle-packages.js.map +1 -1
- package/lib-esm/components/metric/metric.module.css +1 -1
- package/lib-esm/components/metrics-display-selector/metrics-display-selector.js +17 -16
- 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 +30 -1
- package/lib-esm/components/metrics-table-options/metrics-table-options.module.css +14 -4
- package/lib-esm/components/run-info/run-info.module.css +1 -1
- package/lib-esm/constants.js +7 -0
- package/lib-esm/constants.js.map +1 -1
- package/lib-esm/hooks/metrics-display-type.js +8 -7
- package/lib-esm/hooks/metrics-display-type.js.map +1 -1
- package/lib-esm/ui/dropdown/dropdown.js +2 -2
- package/lib-esm/ui/dropdown/dropdown.js.map +1 -1
- package/lib-esm/ui/dropdown/dropdown.module.css +1 -1
- package/package.json +8 -8
- package/src/components/bundle-assets/bundle-assets.tsx +2 -2
- package/src/components/bundle-modules/bundle-modules.tsx +7 -2
- package/src/components/bundle-packages/bundle-packages.jsx +2 -2
- package/src/components/metric/metric.module.css +1 -1
- package/src/components/metrics-display-selector/metrics-display-selector.module.css +30 -1
- package/src/components/metrics-display-selector/metrics-display-selector.tsx +56 -31
- package/src/components/metrics-table-options/metrics-table-options.module.css +14 -4
- package/src/components/run-info/run-info.module.css +1 -1
- package/src/constants.ts +9 -0
- package/src/hooks/metrics-display-type.ts +10 -7
- package/src/ui/dropdown/dropdown.module.css +1 -1
- package/src/ui/dropdown/dropdown.tsx +8 -2
- package/types/constants.d.ts +11 -1
- package/types/ui/dropdown/dropdown.d.ts +4 -1
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
.group:empty {
|
|
2
|
+
display: none;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.group {
|
|
6
|
+
margin-bottom: calc(var(--space-xxxsmall) / 2);
|
|
7
|
+
border-bottom: 1px solid var(--color-outline);
|
|
8
|
+
padding-bottom: calc(var(--space-xxxsmall) / 2);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.group:last-child {
|
|
12
|
+
margin-bottom: 0;
|
|
13
|
+
padding-bottom: 0;
|
|
14
|
+
border-bottom: none;
|
|
5
15
|
}
|
package/src/constants.ts
CHANGED
|
@@ -46,6 +46,15 @@ export enum MetricsDisplayType {
|
|
|
46
46
|
TREEMAP = 'treemap',
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
export const MetricsDisplayTypeDefault = MetricsDisplayType.TABLE;
|
|
50
|
+
|
|
51
|
+
export enum MetricsDisplayGroupBy {
|
|
52
|
+
FOLDER = 'folder',
|
|
53
|
+
NONE = 'no-group',
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export const MetricsDisplayGroupByDefault = MetricsDisplayGroupBy.FOLDER;
|
|
57
|
+
|
|
49
58
|
export enum ModuleSizeMetric {
|
|
50
59
|
SIZE = 'value',
|
|
51
60
|
DUPLICATE_SIZE = 'duplicateSize',
|
|
@@ -2,10 +2,10 @@ import { useCallback, useEffect, useMemo } from 'react';
|
|
|
2
2
|
import { useLocalStorage } from 'react-use';
|
|
3
3
|
import { StringParam, useQueryParams } from 'use-query-params';
|
|
4
4
|
|
|
5
|
-
import { MetricsDisplayType } from '../constants';
|
|
5
|
+
import { MetricsDisplayType, MetricsDisplayGroupBy } from '../constants';
|
|
6
6
|
|
|
7
7
|
const DEFAULT_VALUE = MetricsDisplayType.TABLE;
|
|
8
|
-
const
|
|
8
|
+
const GROUP_BY_DEFAULT = MetricsDisplayGroupBy.FOLDER;
|
|
9
9
|
|
|
10
10
|
// Display type query param name
|
|
11
11
|
const QUERY_PARAM_VALUE = 'dt';
|
|
@@ -36,7 +36,7 @@ export const useMetricsDisplayType = (
|
|
|
36
36
|
'storage',
|
|
37
37
|
{
|
|
38
38
|
value: DEFAULT_VALUE,
|
|
39
|
-
groupBy:
|
|
39
|
+
groupBy: GROUP_BY_DEFAULT,
|
|
40
40
|
},
|
|
41
41
|
);
|
|
42
42
|
|
|
@@ -64,11 +64,14 @@ export const useMetricsDisplayType = (
|
|
|
64
64
|
const resolvedValue = queryParamGroupBy ?? localStorage?.groupBy;
|
|
65
65
|
|
|
66
66
|
if (!resolvedValue) {
|
|
67
|
-
return
|
|
67
|
+
return GROUP_BY_DEFAULT;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
if (
|
|
71
|
-
|
|
70
|
+
if (
|
|
71
|
+
resolvedValue !== MetricsDisplayGroupBy.NONE &&
|
|
72
|
+
!groups?.[value]?.includes(resolvedValue as MetricsDisplayType)
|
|
73
|
+
) {
|
|
74
|
+
return GROUP_BY_DEFAULT;
|
|
72
75
|
}
|
|
73
76
|
|
|
74
77
|
return resolvedValue;
|
|
@@ -93,7 +96,7 @@ export const useMetricsDisplayType = (
|
|
|
93
96
|
}, [value, groupBy, setLocalStorage, localStorage]);
|
|
94
97
|
|
|
95
98
|
const setDisplayType = useCallback(
|
|
96
|
-
(newValue: MetricsDisplayType, newGroupBy: string =
|
|
99
|
+
(newValue: MetricsDisplayType, newGroupBy: string = GROUP_BY_DEFAULT) => {
|
|
97
100
|
setQueryParams({
|
|
98
101
|
[QUERY_PARAM_VALUE]: newValue,
|
|
99
102
|
[QUERY_PARAM_GROUP_BY]: newGroupBy,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import cx from 'classnames';
|
|
3
|
-
import { Menu, MenuButton, MenuItem, useMenuState } from 'ariakit/menu';
|
|
3
|
+
import { Menu, MenuButton, MenuItem, MenuStateProps, useMenuState } from 'ariakit/menu';
|
|
4
4
|
|
|
5
5
|
import { Button, BUTTON_SIZE } from '../button';
|
|
6
6
|
import css from './dropdown.module.css';
|
|
@@ -23,6 +23,9 @@ interface DropdownProps {
|
|
|
23
23
|
ariaLabel?: string;
|
|
24
24
|
glyph?: string;
|
|
25
25
|
disabled?: boolean;
|
|
26
|
+
placement?: MenuStateProps['placement'];
|
|
27
|
+
gutter?: MenuStateProps['gutter'];
|
|
28
|
+
shift?: MenuStateProps['shift'];
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
export const Dropdown = (props: DropdownProps & React.ComponentProps<'div'>) => {
|
|
@@ -33,11 +36,14 @@ export const Dropdown = (props: DropdownProps & React.ComponentProps<'div'>) =>
|
|
|
33
36
|
ariaLabel = '',
|
|
34
37
|
glyph = '',
|
|
35
38
|
disabled = false,
|
|
39
|
+
placement,
|
|
40
|
+
gutter = 4,
|
|
41
|
+
shift,
|
|
36
42
|
children,
|
|
37
43
|
} = props;
|
|
38
44
|
|
|
39
45
|
const dropdownAriaLabel = ariaLabel || (typeof label === 'string' ? label : '');
|
|
40
|
-
const menuState = useMenuState();
|
|
46
|
+
const menuState = useMenuState({ placement, gutter, shift });
|
|
41
47
|
|
|
42
48
|
return (
|
|
43
49
|
<>
|
package/types/constants.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SECTIONS } from '@bundle-stats/utils';
|
|
1
2
|
export declare const URLS: {
|
|
2
3
|
OVERVIEW: string;
|
|
3
4
|
ASSETS: string;
|
|
@@ -5,7 +6,10 @@ export declare const URLS: {
|
|
|
5
6
|
PACKAGES: string;
|
|
6
7
|
};
|
|
7
8
|
export declare const SECTION_URLS: {
|
|
8
|
-
[
|
|
9
|
+
[SECTIONS.TOTALS]: string;
|
|
10
|
+
[SECTIONS.ASSETS]: string;
|
|
11
|
+
[SECTIONS.MODULES]: string;
|
|
12
|
+
[SECTIONS.PACKAGES]: string;
|
|
9
13
|
};
|
|
10
14
|
export declare const ASSETS_SIZES_FILE_TYPE_MAP: {};
|
|
11
15
|
export declare const METRICS_WEBPACK_GENERAL: string[];
|
|
@@ -20,6 +24,12 @@ export declare enum MetricsDisplayType {
|
|
|
20
24
|
TABLE = "table",
|
|
21
25
|
TREEMAP = "treemap"
|
|
22
26
|
}
|
|
27
|
+
export declare const MetricsDisplayTypeDefault = MetricsDisplayType.TABLE;
|
|
28
|
+
export declare enum MetricsDisplayGroupBy {
|
|
29
|
+
FOLDER = "folder",
|
|
30
|
+
NONE = "no-group"
|
|
31
|
+
}
|
|
32
|
+
export declare const MetricsDisplayGroupByDefault = MetricsDisplayGroupBy.FOLDER;
|
|
23
33
|
export declare enum ModuleSizeMetric {
|
|
24
34
|
SIZE = "value",
|
|
25
35
|
DUPLICATE_SIZE = "duplicateSize",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { MenuItem } from 'ariakit/menu';
|
|
2
|
+
import { MenuItem, MenuStateProps } from 'ariakit/menu';
|
|
3
3
|
interface DropdownItemProps {
|
|
4
4
|
isActive?: boolean;
|
|
5
5
|
}
|
|
@@ -10,6 +10,9 @@ interface DropdownProps {
|
|
|
10
10
|
ariaLabel?: string;
|
|
11
11
|
glyph?: string;
|
|
12
12
|
disabled?: boolean;
|
|
13
|
+
placement?: MenuStateProps['placement'];
|
|
14
|
+
gutter?: MenuStateProps['gutter'];
|
|
15
|
+
shift?: MenuStateProps['shift'];
|
|
13
16
|
}
|
|
14
17
|
export declare const Dropdown: (props: DropdownProps & React.ComponentProps<"div">) => React.JSX.Element;
|
|
15
18
|
export {};
|