@bundle-stats/ui 4.23.0-beta.1 → 4.23.0-beta.3
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.module.css +1 -1
- package/lib/chart-colors.json +58 -44
- package/lib/components/entry-info/entry-info.js +1 -1
- package/lib/components/entry-info/entry-info.js.map +1 -1
- package/lib/components/entry-info/entry-info.module.css +1 -1
- package/lib/components/metric-change-legend/metric-change-legend.js +2 -2
- package/lib/components/metric-change-legend/metric-change-legend.js.map +1 -1
- package/lib/components/metric-change-legend/metric-change-legend.module.css +11 -0
- package/lib/components/metric-run-info/metric-run-info.js +1 -9
- package/lib/components/metric-run-info/metric-run-info.js.map +1 -1
- package/lib/components/metrics-table-options/metrics-table-options.js +3 -4
- package/lib/components/metrics-table-options/metrics-table-options.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 +68 -57
- package/lib/components/metrics-treemap/metrics-treemap.js.map +1 -1
- package/lib/components/metrics-treemap/metrics-treemap.module.css +9 -16
- package/lib/components/metrics-treemap/metrics-treemap.utils.js +72 -16
- package/lib/components/metrics-treemap/metrics-treemap.utils.js.map +1 -1
- package/lib/ui/button/button.js +2 -2
- package/lib/ui/button/button.js.map +1 -1
- package/lib/ui/dropdown/dropdown.js +11 -3
- package/lib/ui/dropdown/dropdown.js.map +1 -1
- package/lib/ui/dropdown/dropdown.module.css +40 -6
- package/lib/ui/filters/filters.js +22 -11
- package/lib/ui/filters/filters.js.map +1 -1
- package/lib/ui/filters/filters.module.css +0 -14
- package/lib/ui/hover-card/hover-card.js +7 -1
- package/lib/ui/hover-card/hover-card.js.map +1 -1
- package/lib/ui/tooltip/tooltip.js +6 -1
- package/lib/ui/tooltip/tooltip.js.map +1 -1
- package/lib-esm/app/app.module.css +1 -1
- package/lib-esm/chart-colors.json +58 -44
- package/lib-esm/components/entry-info/entry-info.js +1 -1
- package/lib-esm/components/entry-info/entry-info.js.map +1 -1
- package/lib-esm/components/entry-info/entry-info.module.css +1 -1
- package/lib-esm/components/metric-change-legend/metric-change-legend.js +2 -2
- package/lib-esm/components/metric-change-legend/metric-change-legend.js.map +1 -1
- package/lib-esm/components/metric-change-legend/metric-change-legend.module.css +11 -0
- package/lib-esm/components/metric-run-info/metric-run-info.js +2 -10
- package/lib-esm/components/metric-run-info/metric-run-info.js.map +1 -1
- package/lib-esm/components/metrics-table-options/metrics-table-options.js +4 -5
- package/lib-esm/components/metrics-table-options/metrics-table-options.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 +74 -63
- package/lib-esm/components/metrics-treemap/metrics-treemap.js.map +1 -1
- package/lib-esm/components/metrics-treemap/metrics-treemap.module.css +9 -16
- package/lib-esm/components/metrics-treemap/metrics-treemap.utils.js +71 -17
- package/lib-esm/components/metrics-treemap/metrics-treemap.utils.js.map +1 -1
- package/lib-esm/ui/button/button.js +2 -2
- package/lib-esm/ui/button/button.js.map +1 -1
- package/lib-esm/ui/dropdown/dropdown.js +9 -2
- package/lib-esm/ui/dropdown/dropdown.js.map +1 -1
- package/lib-esm/ui/dropdown/dropdown.module.css +40 -6
- package/lib-esm/ui/filters/filters.js +23 -12
- package/lib-esm/ui/filters/filters.js.map +1 -1
- package/lib-esm/ui/filters/filters.module.css +0 -14
- 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/tooltip/tooltip.js +6 -1
- package/lib-esm/ui/tooltip/tooltip.js.map +1 -1
- package/package.json +12 -12
- package/src/app/app.module.css +1 -1
- package/src/chart-colors.json +58 -44
- package/src/components/entry-info/entry-info.module.css +1 -1
- package/src/components/entry-info/entry-info.tsx +2 -2
- package/src/components/metric-change-legend/metric-change-legend.module.css +11 -0
- package/src/components/metric-change-legend/metric-change-legend.tsx +2 -2
- package/src/components/metric-run-info/metric-run-info.tsx +2 -11
- package/src/components/metrics-table-options/metrics-table-options.tsx +6 -7
- package/src/components/metrics-treemap/metrics-treemap.constants.ts +8 -0
- package/src/components/metrics-treemap/metrics-treemap.module.css +9 -16
- package/src/components/metrics-treemap/metrics-treemap.tsx +160 -135
- package/src/components/metrics-treemap/metrics-treemap.utils.ts +141 -27
- package/src/ui/button/button.tsx +2 -1
- package/src/ui/dropdown/dropdown.module.css +40 -6
- package/src/ui/dropdown/dropdown.tsx +13 -2
- package/src/ui/filters/filters.module.css +0 -14
- package/src/ui/filters/filters.tsx +111 -47
- package/src/ui/hover-card/hover-card.tsx +7 -1
- package/src/ui/tooltip/tooltip.tsx +6 -1
- package/types/components/metric-run-info/metric-run-info.d.ts +1 -0
- package/types/components/metrics-treemap/metrics-treemap.constants.d.ts +2 -0
- package/types/components/metrics-treemap/metrics-treemap.utils.d.ts +11 -5
- package/types/ui/dropdown/dropdown.d.ts +3 -1
- package/types/ui/filters/filters.d.ts +2 -1
- 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/metrics-table-options/metrics-table-options.module.css +0 -15
|
@@ -13,9 +13,12 @@
|
|
|
13
13
|
border-radius: var(--radius-small);
|
|
14
14
|
box-shadow: var(--shadow-layer);
|
|
15
15
|
background: var(--color-background);
|
|
16
|
-
min-width:
|
|
16
|
+
min-width: 16em;
|
|
17
17
|
z-index: var(--layer-high);
|
|
18
|
-
padding:
|
|
18
|
+
padding: var(--space-xxxsmall);
|
|
19
|
+
color: var(--color-text-light);
|
|
20
|
+
font-size: var(--size-small);
|
|
21
|
+
line-height: var(--line-height);
|
|
19
22
|
opacity: 0;
|
|
20
23
|
transition: var(--transition-out);
|
|
21
24
|
}
|
|
@@ -40,12 +43,9 @@
|
|
|
40
43
|
outline: none;
|
|
41
44
|
border: 0;
|
|
42
45
|
border-radius: var(--radius-small);
|
|
43
|
-
padding:
|
|
46
|
+
padding: var(--space-xxxsmall);
|
|
44
47
|
background: none;
|
|
45
48
|
text-align: left;
|
|
46
|
-
color: var(--color-text-light);
|
|
47
|
-
font-size: var(--size-small);
|
|
48
|
-
line-height: var(--line-height);
|
|
49
49
|
text-decoration: none;
|
|
50
50
|
cursor: default;
|
|
51
51
|
}
|
|
@@ -69,3 +69,37 @@
|
|
|
69
69
|
background: var(--color-highlight-info);
|
|
70
70
|
color: var(--color-primary-dark);
|
|
71
71
|
}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
.group {
|
|
75
|
+
position: relative;
|
|
76
|
+
padding: calc(var(--space-xxxsmall) / 2 + 1px) 0 calc(var(--space-xxxsmall) / 2);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.group::before {
|
|
80
|
+
content: " ";
|
|
81
|
+
display: block;
|
|
82
|
+
position: absolute;
|
|
83
|
+
left: var(--space-xxxsmall);
|
|
84
|
+
right: var(--space-xxxsmall);
|
|
85
|
+
top: 0px;
|
|
86
|
+
height: 1px;
|
|
87
|
+
border: none;
|
|
88
|
+
background: var(--color-outline);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.group:first-child {
|
|
92
|
+
padding-top: 0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.group:first-child::before {
|
|
96
|
+
display: none;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.group:last-child {
|
|
100
|
+
padding-bottom: 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.group:empty {
|
|
104
|
+
display: none;
|
|
105
|
+
}
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ComponentProps } from 'react';
|
|
2
2
|
import cx from 'classnames';
|
|
3
3
|
import { Menu, MenuButton, MenuItem, MenuStateProps, useMenuState } from 'ariakit/menu';
|
|
4
|
+
import isNull from 'lodash/isNull';
|
|
5
|
+
import isUndefined from 'lodash/isUndefined';
|
|
4
6
|
|
|
5
7
|
import { Button, BUTTON_SIZE } from '../button';
|
|
6
8
|
import css from './dropdown.module.css';
|
|
7
9
|
import { Icon } from '../icon';
|
|
8
10
|
|
|
11
|
+
export type DropdownGroupProps = ComponentProps<'div'>;
|
|
12
|
+
|
|
13
|
+
export const DropdownGroup = (props: DropdownGroupProps) => {
|
|
14
|
+
const { className, ...restProps } = props;
|
|
15
|
+
return <div className={cx(css.group, className)} {...restProps} />;
|
|
16
|
+
};
|
|
17
|
+
|
|
9
18
|
interface DropdownItemProps {
|
|
10
19
|
isActive?: boolean;
|
|
11
20
|
}
|
|
@@ -37,7 +46,7 @@ export const Dropdown = (props: DropdownProps & React.ComponentProps<'div'>) =>
|
|
|
37
46
|
label = null,
|
|
38
47
|
ariaLabel = '',
|
|
39
48
|
glyph = '',
|
|
40
|
-
showChevron
|
|
49
|
+
showChevron: initialShowChevron,
|
|
41
50
|
disabled = false,
|
|
42
51
|
placement,
|
|
43
52
|
gutter = 4,
|
|
@@ -47,6 +56,7 @@ export const Dropdown = (props: DropdownProps & React.ComponentProps<'div'>) =>
|
|
|
47
56
|
|
|
48
57
|
const dropdownAriaLabel = ariaLabel || (typeof label === 'string' ? label : '');
|
|
49
58
|
const menuState = useMenuState({ animated: true, placement, gutter, shift });
|
|
59
|
+
const showChevron = isUndefined(initialShowChevron) ? !isNull(label) : initialShowChevron;
|
|
50
60
|
|
|
51
61
|
return (
|
|
52
62
|
<>
|
|
@@ -58,6 +68,7 @@ export const Dropdown = (props: DropdownProps & React.ComponentProps<'div'>) =>
|
|
|
58
68
|
rightGlyph={showChevron ? Icon.ICONS.CHEVRON_DOWN : undefined}
|
|
59
69
|
disabled={disabled}
|
|
60
70
|
state={menuState}
|
|
71
|
+
toggleOnClick
|
|
61
72
|
tabIndex={null}
|
|
62
73
|
className={cx(css.button, className)}
|
|
63
74
|
>
|
|
@@ -101,23 +101,9 @@
|
|
|
101
101
|
text-transform: lowercase;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
.filterGroupSearchWrapper {
|
|
105
|
-
padding-bottom: var(--space-xxxsmall);
|
|
106
|
-
margin-bottom: var(--space-xxxsmall);
|
|
107
|
-
border-bottom: 1px solid var(--color-outline);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
104
|
.filterGroupSearchNotFound {
|
|
111
105
|
padding: var(--space-xxsmall) 0;
|
|
112
106
|
text-align: center;
|
|
113
107
|
font-size: var(--size-small);
|
|
114
108
|
color: var(--color-text-light);
|
|
115
109
|
}
|
|
116
|
-
|
|
117
|
-
.filterGroupActions {
|
|
118
|
-
margin-top: var(--space-xxxsmall);
|
|
119
|
-
padding-top: var(--space-xxxsmall);
|
|
120
|
-
padding-bottom: var(--space-xxxsmall);
|
|
121
|
-
margin-bottom: calc(0px - var(--space-xxxsmall));
|
|
122
|
-
border-top: 1px solid var(--color-outline);
|
|
123
|
-
}
|
|
@@ -6,7 +6,7 @@ import { FlexStack } from '../../layout/flex-stack';
|
|
|
6
6
|
import { Stack } from '../../layout/stack';
|
|
7
7
|
import { Button } from '../button';
|
|
8
8
|
import { ControlGroup } from '../control-group';
|
|
9
|
-
import { Dropdown, DropdownItem } from '../dropdown';
|
|
9
|
+
import { Dropdown, DropdownGroup, DropdownItem } from '../dropdown';
|
|
10
10
|
import { InputSearch } from '../input-search';
|
|
11
11
|
import * as I18N from './filters.i18n';
|
|
12
12
|
import { getGroupFiltersLabelSuffix, LABELS } from './filters.utils';
|
|
@@ -40,12 +40,86 @@ const Filter = (props: FilterBooleanProps) => {
|
|
|
40
40
|
);
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
+
const getGroupItemKey = (groupKey: string, itemKey: string): string => `${groupKey}.${itemKey}`;
|
|
44
|
+
|
|
45
|
+
type ToggleFilters = (newFilters: Record<string, boolean>) => void;
|
|
46
|
+
|
|
47
|
+
type GetOnGroupCheck = (value: boolean, overrides?: Record<string, boolean>) => () => void;
|
|
48
|
+
|
|
49
|
+
interface FilterDropdownItemProps {
|
|
50
|
+
className?: string;
|
|
51
|
+
id: string;
|
|
52
|
+
label: string;
|
|
53
|
+
checked: boolean;
|
|
54
|
+
disabled?: boolean;
|
|
55
|
+
onChange: FilterBooleanProps['onChange'];
|
|
56
|
+
toggleFilters: ToggleFilters;
|
|
57
|
+
getOnGroupCheck: GetOnGroupCheck;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const FilterDropdownItem = (props: FilterDropdownItemProps) => {
|
|
61
|
+
const { className, id, label, checked, disabled, onChange, toggleFilters, getOnGroupCheck } =
|
|
62
|
+
props;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Toggle the filter when the menu item itself is activated: ariakit fires a click on the menu
|
|
66
|
+
* item when pressing Enter/Space, and clicking the item padding targets it directly. Clicks on
|
|
67
|
+
* the nested label/checkbox and on the only button are handled by their own handlers.
|
|
68
|
+
*/
|
|
69
|
+
const onItemClick = useCallback(
|
|
70
|
+
(event: React.MouseEvent<HTMLDivElement>) => {
|
|
71
|
+
if (disabled || event.target !== event.currentTarget) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
toggleFilters({ [id]: !checked });
|
|
76
|
+
},
|
|
77
|
+
[disabled, toggleFilters, id, checked],
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Check only the current filter of the group
|
|
82
|
+
*/
|
|
83
|
+
const onOnlyClick = useCallback(
|
|
84
|
+
() => getOnGroupCheck(false, { [id]: true })(),
|
|
85
|
+
[getOnGroupCheck, id],
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<DropdownItem
|
|
90
|
+
onClick={onItemClick}
|
|
91
|
+
hideOnClick={false}
|
|
92
|
+
className={cx(css.filterGroupItem, className)}
|
|
93
|
+
>
|
|
94
|
+
<Filter
|
|
95
|
+
label={label}
|
|
96
|
+
name={id}
|
|
97
|
+
onChange={onChange}
|
|
98
|
+
checked={checked}
|
|
99
|
+
disabled={disabled}
|
|
100
|
+
className={css.filterGroupItemFilter}
|
|
101
|
+
/>
|
|
102
|
+
<Button
|
|
103
|
+
kind="info"
|
|
104
|
+
solid
|
|
105
|
+
size="small"
|
|
106
|
+
type="button"
|
|
107
|
+
onClick={onOnlyClick}
|
|
108
|
+
disabled={disabled}
|
|
109
|
+
className={css.filterGroupOnlyButton}
|
|
110
|
+
>
|
|
111
|
+
{I18N.ONLY}
|
|
112
|
+
</Button>
|
|
113
|
+
</DropdownItem>
|
|
114
|
+
);
|
|
115
|
+
};
|
|
116
|
+
|
|
43
117
|
interface FilterGroupProps extends React.ComponentProps<'div'> {
|
|
44
118
|
groupKey: string;
|
|
45
119
|
data: FilterGroupFieldData;
|
|
46
120
|
values: Record<string, boolean>;
|
|
47
121
|
onCheckboxChange: FilterBooleanProps['onChange'];
|
|
48
|
-
toggleFilters:
|
|
122
|
+
toggleFilters: ToggleFilters;
|
|
49
123
|
}
|
|
50
124
|
|
|
51
125
|
const FilterGroup = (props: FilterGroupProps) => {
|
|
@@ -70,22 +144,24 @@ const FilterGroup = (props: FilterGroupProps) => {
|
|
|
70
144
|
</>
|
|
71
145
|
);
|
|
72
146
|
|
|
73
|
-
const getOnGroupCheck =
|
|
74
|
-
(value
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
147
|
+
const getOnGroupCheck: GetOnGroupCheck = useCallback(
|
|
148
|
+
(value, overrides = {}) =>
|
|
149
|
+
() => {
|
|
150
|
+
const newFilters = groupItems.reduce(
|
|
151
|
+
(agg, { key: itemKey }) => ({
|
|
152
|
+
...agg,
|
|
153
|
+
[getGroupItemKey(groupKey, itemKey)]: value,
|
|
154
|
+
}),
|
|
155
|
+
{},
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
toggleFilters({
|
|
159
|
+
...newFilters,
|
|
160
|
+
...overrides,
|
|
161
|
+
});
|
|
162
|
+
},
|
|
163
|
+
[groupItems, groupKey, toggleFilters],
|
|
164
|
+
);
|
|
89
165
|
|
|
90
166
|
const filteredGroupItems = useMemo(() => {
|
|
91
167
|
if (!search) {
|
|
@@ -102,16 +178,16 @@ const FilterGroup = (props: FilterGroupProps) => {
|
|
|
102
178
|
ariaLabel={`${groupLabel}: ${filterSuffix}`}
|
|
103
179
|
>
|
|
104
180
|
{groupItems.length > 10 && (
|
|
105
|
-
<
|
|
181
|
+
<DropdownGroup>
|
|
106
182
|
<InputSearch
|
|
107
183
|
defaultValue={search}
|
|
108
184
|
onChange={setSearch}
|
|
109
185
|
placeholder={I18N.GROUP_SEARCH}
|
|
110
186
|
debounceWait={0}
|
|
111
187
|
/>
|
|
112
|
-
</
|
|
188
|
+
</DropdownGroup>
|
|
113
189
|
)}
|
|
114
|
-
<
|
|
190
|
+
<DropdownGroup className={css.filterGroupItems}>
|
|
115
191
|
{filteredGroupItems.length === 0 && (
|
|
116
192
|
<Stack className={css.filterGroupSearchNotFound}>
|
|
117
193
|
<p>{I18N.GROUP_NOT_FOUND}</p>
|
|
@@ -129,36 +205,24 @@ const FilterGroup = (props: FilterGroupProps) => {
|
|
|
129
205
|
</Stack>
|
|
130
206
|
)}
|
|
131
207
|
{filteredGroupItems.map(({ key: itemKey, ...itemData }) => {
|
|
132
|
-
const id =
|
|
133
|
-
const getOnOnlyClick = () => getOnGroupCheck(false, { [id]: true });
|
|
208
|
+
const id = getGroupItemKey(groupKey, itemKey);
|
|
134
209
|
|
|
135
210
|
return (
|
|
136
|
-
<
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
kind="info"
|
|
147
|
-
solid
|
|
148
|
-
size="small"
|
|
149
|
-
type="button"
|
|
150
|
-
onClick={getOnOnlyClick()}
|
|
151
|
-
disabled={itemData.disabled}
|
|
152
|
-
className={css.filterGroupOnlyButton}
|
|
153
|
-
>
|
|
154
|
-
{I18N.ONLY}
|
|
155
|
-
</Button>
|
|
156
|
-
</DropdownItem>
|
|
211
|
+
<FilterDropdownItem
|
|
212
|
+
key={id}
|
|
213
|
+
id={id}
|
|
214
|
+
label={itemData.label}
|
|
215
|
+
checked={values[id]}
|
|
216
|
+
disabled={itemData.disabled}
|
|
217
|
+
onChange={onCheckboxChange}
|
|
218
|
+
toggleFilters={toggleFilters}
|
|
219
|
+
getOnGroupCheck={getOnGroupCheck}
|
|
220
|
+
/>
|
|
157
221
|
);
|
|
158
222
|
})}
|
|
159
|
-
</
|
|
223
|
+
</DropdownGroup>
|
|
160
224
|
{filteredGroupItems.length !== 0 && (
|
|
161
|
-
<
|
|
225
|
+
<DropdownGroup className={css.filterGroupActions}>
|
|
162
226
|
{areAllGroupItemsChecked ? (
|
|
163
227
|
<DropdownItem id="clear-all" onClick={getOnGroupCheck(false)} role="button">
|
|
164
228
|
{I18N.CLEAR}
|
|
@@ -168,7 +232,7 @@ const FilterGroup = (props: FilterGroupProps) => {
|
|
|
168
232
|
{I18N.CHECK}
|
|
169
233
|
</DropdownItem>
|
|
170
234
|
)}
|
|
171
|
-
</
|
|
235
|
+
</DropdownGroup>
|
|
172
236
|
)}
|
|
173
237
|
</Dropdown>
|
|
174
238
|
);
|
|
@@ -31,7 +31,13 @@ export const HoverCard = (props: HoverCardProps) => {
|
|
|
31
31
|
children,
|
|
32
32
|
} = props;
|
|
33
33
|
|
|
34
|
-
const state = useHovercardState({
|
|
34
|
+
const state = useHovercardState({
|
|
35
|
+
animated: true,
|
|
36
|
+
gutter: 8,
|
|
37
|
+
timeout: 300,
|
|
38
|
+
overflowPadding: 48,
|
|
39
|
+
placement: 'top',
|
|
40
|
+
});
|
|
35
41
|
const hovercardProps = useHovercard({ state, portal: true });
|
|
36
42
|
|
|
37
43
|
// Fallback to span if no href
|
|
@@ -29,7 +29,12 @@ export const Tooltip = <T extends React.ElementType = 'span'>(
|
|
|
29
29
|
...restProps
|
|
30
30
|
} = props;
|
|
31
31
|
|
|
32
|
-
const tooltip = useTooltipState({
|
|
32
|
+
const tooltip = useTooltipState({
|
|
33
|
+
animated: true,
|
|
34
|
+
placement: 'top',
|
|
35
|
+
overflowPadding: 48,
|
|
36
|
+
timeout: 300,
|
|
37
|
+
});
|
|
33
38
|
|
|
34
39
|
return (
|
|
35
40
|
<>
|
|
@@ -6,5 +6,6 @@ export type MetricRunInfoProps = {
|
|
|
6
6
|
baseline?: number;
|
|
7
7
|
showMetricDescription?: boolean;
|
|
8
8
|
titleWrapper?: ElementType;
|
|
9
|
+
showDeltaValue?: boolean;
|
|
9
10
|
} & Pick<RunInfoProps, 'showDelta' | 'showBaseline' | 'size' | 'loading'>;
|
|
10
11
|
export declare const MetricRunInfo: (props: MetricRunInfoProps & React.ComponentProps<"div">) => React.JSX.Element;
|
|
@@ -20,6 +20,8 @@ export type TreeNode = Tree | TreeLeaf;
|
|
|
20
20
|
export type TreeNodeChildren = Array<TreeNode>;
|
|
21
21
|
export type TileGroupSizeDisplay = 'minimal' | 'small' | 'default';
|
|
22
22
|
export type TileSizeDisplay = 'minimal' | 'small' | 'default';
|
|
23
|
+
export declare const NODE_ID_ATTRIBUTE = "data-treemap-id";
|
|
24
|
+
export declare const NODE_ID_SELECTOR = "[data-treemap-id]";
|
|
23
25
|
export declare const SQUARIFY_RATIO = 1.66;
|
|
24
26
|
export declare const PADDING_OUTER = 1;
|
|
25
27
|
export declare const PADDING_INNER = 2;
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
import { type RefObject } from 'react';
|
|
2
1
|
import { DeltaType, type MetricRunInfoBaseline, type MetricRunInfo, type ReportMetricRow } from '@bundle-stats/utils';
|
|
3
|
-
import { type Tree, type TileSizeDisplay, type TileGroupSizeDisplay } from './metrics-treemap.constants';
|
|
2
|
+
import { type TreeNode, type Tree, type TileSizeDisplay, type TileGroupSizeDisplay } from './metrics-treemap.constants';
|
|
4
3
|
export declare function getTreemapNodes(items: Array<ReportMetricRow>): Tree;
|
|
5
4
|
export declare function getTreemapNodesGroupedByPath(items: Array<ReportMetricRow>): Tree;
|
|
5
|
+
export declare function getTreemapNodesIndex(node: Tree, index?: Map<string, TreeNode>): Map<string, TreeNode>;
|
|
6
6
|
export declare function resolveGroupDeltaType(metricRunInfo?: MetricRunInfo | MetricRunInfoBaseline): DeltaType.NO_CHANGE | DeltaType.NEGATIVE | DeltaType.POSITIVE;
|
|
7
7
|
export declare function resolveTileGroupSizeDisplay(width: number, height: number): TileGroupSizeDisplay;
|
|
8
8
|
export declare function resolveTileSizeDisplay(width: number, height: number): TileSizeDisplay;
|
|
9
|
-
interface
|
|
10
|
-
parentRef: RefObject<Element>;
|
|
9
|
+
interface UseTreemapTooltipStateOptions {
|
|
11
10
|
gutter?: number;
|
|
12
11
|
timeout?: number;
|
|
12
|
+
hideTimeout?: number;
|
|
13
13
|
}
|
|
14
|
-
export declare function
|
|
14
|
+
export declare function useTreemapTooltipState(options?: UseTreemapTooltipStateOptions): {
|
|
15
|
+
tooltipState: import("ariakit/tooltip").TooltipState;
|
|
16
|
+
setPointer: (x: number, y: number) => void;
|
|
17
|
+
hoveredNodeId: string | null;
|
|
18
|
+
setHoveredNode: (nodeId: string | null) => void;
|
|
19
|
+
clearHoveredNode: () => void;
|
|
20
|
+
};
|
|
15
21
|
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ComponentProps } from 'react';
|
|
2
2
|
import { MenuItem, MenuStateProps } from 'ariakit/menu';
|
|
3
|
+
export type DropdownGroupProps = ComponentProps<'div'>;
|
|
4
|
+
export declare const DropdownGroup: (props: DropdownGroupProps) => React.JSX.Element;
|
|
3
5
|
interface DropdownItemProps {
|
|
4
6
|
isActive?: boolean;
|
|
5
7
|
}
|
|
@@ -3,12 +3,13 @@ import type { FilterFieldsData, FilterGroupFieldData } from '../../types';
|
|
|
3
3
|
interface FilterBooleanProps extends React.ComponentProps<'input'> {
|
|
4
4
|
label: string;
|
|
5
5
|
}
|
|
6
|
+
type ToggleFilters = (newFilters: Record<string, boolean>) => void;
|
|
6
7
|
interface FilterGroupProps extends React.ComponentProps<'div'> {
|
|
7
8
|
groupKey: string;
|
|
8
9
|
data: FilterGroupFieldData;
|
|
9
10
|
values: Record<string, boolean>;
|
|
10
11
|
onCheckboxChange: FilterBooleanProps['onChange'];
|
|
11
|
-
toggleFilters:
|
|
12
|
+
toggleFilters: ToggleFilters;
|
|
12
13
|
}
|
|
13
14
|
interface FiltersProps extends React.ComponentProps<'div'> {
|
|
14
15
|
values: Record<string, boolean>;
|
package/vitest.config.ts
CHANGED
|
@@ -35,6 +35,10 @@ export default defineConfig({
|
|
|
35
35
|
},
|
|
36
36
|
test: {
|
|
37
37
|
name: 'ui:storybook',
|
|
38
|
+
// Same `configDir` misassumption as `fix-storybook-vitest-root` above, but on the Vitest
|
|
39
|
+
// side: `storybookTest` resolves the story globs and `setupFiles` against a root it derives
|
|
40
|
+
// from `configDir`. `dir` is the first source it reads, so set it explicitly.
|
|
41
|
+
dir: PACKAGE_ROOT,
|
|
38
42
|
setupFiles: ['./vitest.setup.ts'],
|
|
39
43
|
retry: 2,
|
|
40
44
|
browser: {
|
|
@@ -1,15 +0,0 @@
|
|
|
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;
|
|
15
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
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;
|
|
15
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
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;
|
|
15
|
-
}
|