@bundle-stats/ui 3.2.4 → 3.2.5-alpha.0
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/CHANGELOG.md +32 -0
- package/lib/app/app.js +13 -6
- package/lib/app/app.module.css +17 -15
- package/lib/app/header/header.js +14 -8
- package/lib/app/header/header.module.css +11 -18
- package/lib/components/bundle-assets/bundle-assets.module.css +1 -0
- package/lib/components/bundle-packages/bundle-packages.module.css +9 -5
- package/lib/components/delta/delta.js +22 -15
- package/lib/components/delta/delta.module.css +13 -6
- package/lib/components/duplicate-packages-warning/duplicate-packages-warning.js +2 -2
- package/lib/components/job-header/job-header.js +8 -5
- package/lib/components/job-header/job-header.module.css +6 -10
- package/lib/components/jobs-header/jobs-header.js +1 -1
- package/lib/components/jobs-header/jobs-header.module.css +1 -4
- package/lib/components/metric/metric.js +1 -4
- package/lib/components/metric/metric.module.css +7 -7
- package/lib/components/metrics-table-search/metrics-table-search.module.css +5 -4
- package/lib/components/summary-item/summary-item.js +3 -3
- package/lib/components/summary-item/summary-item.module.css +2 -9
- package/lib/css/default.css +13 -7
- package/lib/css/variables.css +24 -24
- package/lib/layout/box/box.module.css +9 -0
- package/lib/layout/footer/footer.module.css +2 -1
- package/lib/layout/index.js +8 -0
- package/lib/layout/separator.js +48 -0
- package/lib/layout/separator.module.css +5 -0
- package/lib/ui/dropdown/dropdown.js +1 -2
- package/lib/ui/dropdown/dropdown.module.css +7 -8
- package/lib/ui/filters/filters.js +10 -5
- package/lib/ui/filters/filters.module.css +10 -0
- package/lib/ui/popover/popover.module.css +1 -1
- package/lib/ui/table/table.module.css +1 -9
- package/lib/ui/tabs/tabs.module.css +1 -2
- package/lib/ui/tooltip/tooltip.module.css +1 -1
- package/lib-esm/app/app.js +12 -6
- package/lib-esm/app/app.module.css +17 -15
- package/lib-esm/app/header/header.js +13 -8
- package/lib-esm/app/header/header.module.css +11 -18
- package/lib-esm/components/bundle-assets/bundle-assets.module.css +1 -0
- package/lib-esm/components/bundle-packages/bundle-packages.module.css +9 -5
- package/lib-esm/components/delta/delta.js +20 -13
- package/lib-esm/components/delta/delta.module.css +13 -6
- package/lib-esm/components/duplicate-packages-warning/duplicate-packages-warning.js +2 -2
- package/lib-esm/components/job-header/job-header.js +8 -5
- package/lib-esm/components/job-header/job-header.module.css +6 -10
- package/lib-esm/components/jobs-header/jobs-header.js +1 -1
- package/lib-esm/components/jobs-header/jobs-header.module.css +1 -4
- package/lib-esm/components/metric/metric.js +1 -4
- package/lib-esm/components/metric/metric.module.css +7 -7
- package/lib-esm/components/metrics-table-search/metrics-table-search.module.css +5 -4
- package/lib-esm/components/summary-item/summary-item.js +3 -3
- package/lib-esm/components/summary-item/summary-item.module.css +2 -9
- package/lib-esm/css/default.css +13 -7
- package/lib-esm/css/variables.css +24 -24
- package/lib-esm/layout/box/box.module.css +9 -0
- package/lib-esm/layout/footer/footer.module.css +2 -1
- package/lib-esm/layout/index.js +1 -0
- package/lib-esm/layout/separator.js +28 -0
- package/lib-esm/layout/separator.module.css +5 -0
- package/lib-esm/ui/dropdown/dropdown.js +1 -2
- package/lib-esm/ui/dropdown/dropdown.module.css +7 -8
- package/lib-esm/ui/filters/filters.js +9 -4
- package/lib-esm/ui/filters/filters.module.css +10 -0
- package/lib-esm/ui/popover/popover.module.css +1 -1
- package/lib-esm/ui/table/table.module.css +1 -9
- package/lib-esm/ui/tabs/tabs.module.css +1 -2
- package/lib-esm/ui/tooltip/tooltip.module.css +1 -1
- package/package.json +13 -11
- package/src/app/app.jsx +23 -15
- package/src/app/app.module.css +17 -15
- package/src/app/header/header.jsx +15 -10
- package/src/app/header/header.module.css +11 -18
- package/src/components/bundle-assets/bundle-assets.module.css +1 -0
- package/src/components/bundle-packages/bundle-packages.module.css +9 -5
- package/src/components/delta/delta.jsx +17 -9
- package/src/components/delta/delta.module.css +13 -6
- package/src/components/duplicate-packages-warning/duplicate-packages-warning.jsx +7 -2
- package/src/components/job-header/job-header.jsx +9 -5
- package/src/components/job-header/job-header.module.css +6 -10
- package/src/components/jobs-header/jobs-header.jsx +1 -1
- package/src/components/jobs-header/jobs-header.module.css +1 -4
- package/src/components/metric/metric.jsx +2 -9
- package/src/components/metric/metric.module.css +7 -7
- package/src/components/metrics-table-search/metrics-table-search.module.css +5 -4
- package/src/components/summary-item/summary-item.jsx +1 -1
- package/src/components/summary-item/summary-item.module.css +2 -9
- package/src/css/default.css +13 -7
- package/src/css/variables.css +24 -24
- package/src/layout/box/box.module.css +9 -0
- package/src/layout/footer/footer.module.css +2 -1
- package/src/layout/index.js +1 -0
- package/src/layout/separator.jsx +25 -0
- package/src/layout/separator.module.css +5 -0
- package/src/ui/dropdown/dropdown.jsx +4 -6
- package/src/ui/dropdown/dropdown.module.css +7 -8
- package/src/ui/filters/filters.jsx +53 -50
- package/src/ui/filters/filters.module.css +10 -0
- package/src/ui/popover/popover.module.css +1 -1
- package/src/ui/table/table.module.css +1 -9
- package/src/ui/tabs/tabs.module.css +1 -2
- package/src/ui/tooltip/tooltip.module.css +1 -1
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
.root {
|
|
2
2
|
display: block;
|
|
3
|
-
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.display {
|
|
6
|
+
vertical-align: middle;
|
|
4
7
|
}
|
|
5
8
|
|
|
6
9
|
.displayUnit {
|
|
@@ -8,7 +11,9 @@
|
|
|
8
11
|
}
|
|
9
12
|
|
|
10
13
|
.delta {
|
|
11
|
-
display:
|
|
14
|
+
display: inline;
|
|
15
|
+
vertical-align: middle;
|
|
16
|
+
margin: 0 0 0 var(--space-xxxsmall);
|
|
12
17
|
font-size: var(--size-xsmall);
|
|
13
18
|
}
|
|
14
19
|
|
|
@@ -23,8 +28,3 @@
|
|
|
23
28
|
line-height: 1;
|
|
24
29
|
margin-top: -2px;
|
|
25
30
|
}
|
|
26
|
-
|
|
27
|
-
.inline .delta {
|
|
28
|
-
display: inline-block;
|
|
29
|
-
margin: 0 0 0 var(--space-xxxsmall);
|
|
30
|
-
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
.input {
|
|
8
|
+
border-radius: var(--radius-medium) 0 0 var(--radius-medium);
|
|
8
9
|
height: var(--space-large);
|
|
9
10
|
border-color: var(--color-outline);
|
|
10
11
|
}
|
|
@@ -21,12 +22,12 @@
|
|
|
21
22
|
cursor: pointer;
|
|
22
23
|
border-radius: 50%;
|
|
23
24
|
position: absolute;
|
|
24
|
-
right:
|
|
25
|
+
right: 2px;
|
|
25
26
|
top: 50%;
|
|
26
27
|
transform: translateY(-50%);
|
|
27
|
-
padding: var(--space-
|
|
28
|
-
width: var(--space-
|
|
29
|
-
height: var(--space-
|
|
28
|
+
padding: var(--space-xxxsmall);
|
|
29
|
+
width: var(--space-medium);
|
|
30
|
+
height: var(--space-medium);
|
|
30
31
|
background: radial-gradient(var(--color-background) 50%, transparent);
|
|
31
32
|
color: var(--color-text-ultra-light);
|
|
32
33
|
transition: var(--transition-in);
|
|
@@ -78,13 +78,13 @@ export const SummaryItem = ({
|
|
|
78
78
|
value={current}
|
|
79
79
|
formatter={metric.formatter}
|
|
80
80
|
enhanced
|
|
81
|
-
inline
|
|
82
81
|
>
|
|
83
82
|
{showDelta && (
|
|
84
83
|
<Delta
|
|
85
84
|
className={css.delta}
|
|
86
85
|
displayValue={runInfo.displayDeltaPercentage}
|
|
87
86
|
deltaType={runInfo.deltaType}
|
|
87
|
+
inverted
|
|
88
88
|
/>
|
|
89
89
|
)}
|
|
90
90
|
</Metric>
|
|
@@ -29,21 +29,14 @@
|
|
|
29
29
|
.currentMetric {
|
|
30
30
|
display: block;
|
|
31
31
|
color: var(--color-heading);
|
|
32
|
-
font-size: var(--size-
|
|
32
|
+
font-size: var(--size-xlarge);
|
|
33
33
|
line-height: var(--space-medium);
|
|
34
34
|
white-space: nowrap;
|
|
35
35
|
font-weight: bold;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
.delta {
|
|
39
|
-
font-size: var(--size-small);
|
|
40
|
-
line-height: var(--space-medium);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
38
|
.baselineMetric {
|
|
44
39
|
color: var(--color-text-light);
|
|
45
|
-
font-size: var(--size-small);
|
|
46
|
-
line-height: var(--space-small);
|
|
47
40
|
}
|
|
48
41
|
|
|
49
42
|
/* Loading state */
|
|
@@ -57,6 +50,6 @@
|
|
|
57
50
|
|
|
58
51
|
/* Size large */
|
|
59
52
|
.large .currentMetric {
|
|
60
|
-
font-size: var(--size-
|
|
53
|
+
font-size: var(--size-xxlarge);
|
|
61
54
|
line-height: var(--space-medium);
|
|
62
55
|
}
|
package/src/css/default.css
CHANGED
|
@@ -1,25 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
@import url("~modern-css-reset/dist/reset.css");
|
|
2
|
+
|
|
3
|
+
/** modern-css-reset updates */
|
|
4
|
+
pre,
|
|
5
|
+
ul,
|
|
6
|
+
ol,
|
|
7
|
+
button {
|
|
8
|
+
margin: 0;
|
|
3
9
|
}
|
|
4
10
|
|
|
5
11
|
html {
|
|
12
|
+
font-family: var(--font-family);
|
|
6
13
|
font-size: 81.25%;
|
|
7
|
-
line-height: 1.8461;
|
|
8
14
|
}
|
|
9
15
|
|
|
10
16
|
body {
|
|
17
|
+
background: var(--color-background);
|
|
11
18
|
color: var(--color-text);
|
|
19
|
+
line-height: var(--line-height);
|
|
12
20
|
}
|
|
13
21
|
|
|
14
|
-
h1, h2, h3, h4, h5 {
|
|
15
|
-
margin-bottom: var(--space-small);
|
|
22
|
+
h1, h2, h3, h4, h5, h6 {
|
|
16
23
|
color: var(--color-heading);
|
|
17
|
-
font-weight:
|
|
24
|
+
font-weight: bold;
|
|
18
25
|
}
|
|
19
26
|
|
|
20
27
|
h1 {
|
|
21
28
|
font-size: var(--size-xxxlarge);
|
|
22
|
-
line-height: var(--space-xlarge)
|
|
23
29
|
}
|
|
24
30
|
|
|
25
31
|
h2 {
|
package/src/css/variables.css
CHANGED
|
@@ -13,40 +13,40 @@
|
|
|
13
13
|
--space-xxlarge: 48px;
|
|
14
14
|
--space-xxxlarge: 64px;
|
|
15
15
|
|
|
16
|
-
/* Typography scale */
|
|
17
|
-
--size-xsmall: 0.
|
|
16
|
+
/* Typography scale - https://type-scale.com 1.2 */
|
|
17
|
+
--size-xsmall: 0.8rem;
|
|
18
18
|
--size-small: 0.92rem;
|
|
19
19
|
--size: 1rem;
|
|
20
20
|
--size-medium: var(--size);
|
|
21
|
-
--size-large: 1.
|
|
22
|
-
--size-xlarge: 1.
|
|
23
|
-
--size-xxlarge: 1.
|
|
24
|
-
--size-xxxlarge:
|
|
21
|
+
--size-large: 1.2rem;
|
|
22
|
+
--size-xlarge: 1.44rem;
|
|
23
|
+
--size-xxlarge: 1.728rem;
|
|
24
|
+
--size-xxxlarge: 2.074rem;
|
|
25
25
|
|
|
26
|
-
--line-height:
|
|
26
|
+
--line-height: 1.66em;
|
|
27
27
|
|
|
28
28
|
/*
|
|
29
29
|
* Color scheme:
|
|
30
|
-
* http://mcg.mbitson.com/#!?mcgpalette0=%23dd555e&mcgpalette1=%2363bf5e&mcgpalette2=%23f7e37d&mcgpalette3=%23636568&mcgpalette4=%233385d6&themename=mcgtheme
|
|
31
30
|
* https://coolors.co/3385d6-dd555e-63bf5e-f7e37d-192339
|
|
31
|
+
* http://mcg.mbitson.com/#!?mcgpalette0=%23dd555e&mcgpalette1=%2363bf5e&mcgpalette2=%23f7e37d&mcgpalette3=%235b5d60&mcgpalette4=%233385d6&themename=mcgtheme
|
|
32
32
|
*/
|
|
33
33
|
--color-gray-25: #fafafa;
|
|
34
|
-
--color-gray-50: #
|
|
35
|
-
--color-gray-100: #
|
|
36
|
-
--color-gray-200: #
|
|
37
|
-
--color-gray-300: #
|
|
38
|
-
--color-gray-400: #
|
|
39
|
-
--color-gray-500: #
|
|
40
|
-
--color-gray-600: #
|
|
41
|
-
--color-gray-700: #
|
|
42
|
-
--color-gray-800: #
|
|
43
|
-
--color-gray-900: #
|
|
34
|
+
--color-gray-50: #e4e4e5;
|
|
35
|
+
--color-gray-100: #cececf;
|
|
36
|
+
--color-gray-200: #adaeb0;
|
|
37
|
+
--color-gray-300: #8c8e90;
|
|
38
|
+
--color-gray-400: #747578;
|
|
39
|
+
--color-gray-500: #5b5d60;
|
|
40
|
+
--color-gray-600: #535558;
|
|
41
|
+
--color-gray-700: #494b4e;
|
|
42
|
+
--color-gray-800: #404144;
|
|
43
|
+
--color-gray-900: #2f3033;
|
|
44
44
|
|
|
45
45
|
--color-gray-ultra-light: var(--color-gray-200);
|
|
46
46
|
--color-gray-light: var(--color-gray-300);
|
|
47
47
|
--color-gray: var(--color-gray-500);
|
|
48
|
-
--color-gray-dark: var(--color-gray-
|
|
49
|
-
--color-gray-ultra-dark: var(--color-gray-
|
|
48
|
+
--color-gray-dark: var(--color-gray-600);
|
|
49
|
+
--color-gray-ultra-dark: var(--color-gray-700);
|
|
50
50
|
|
|
51
51
|
--color-red-25: #fdf5f6;
|
|
52
52
|
--color-red-50: #fbebec;
|
|
@@ -170,7 +170,7 @@
|
|
|
170
170
|
--color-outline-warning: var(--color-yellow-200);
|
|
171
171
|
--color-outline-danger: var(--color-red-100);
|
|
172
172
|
|
|
173
|
-
--color-shadow: rgba(0, 0, 0, 0.
|
|
173
|
+
--color-shadow: rgba(0, 0, 0, 0.1);
|
|
174
174
|
|
|
175
175
|
--transition-in: all 0.2s ease-in;
|
|
176
176
|
--transition-out: all 0.17s ease-out;
|
|
@@ -181,9 +181,9 @@
|
|
|
181
181
|
--layer-high: 1000;
|
|
182
182
|
--layer-xhigh: 10000;
|
|
183
183
|
|
|
184
|
-
--radius-small: var(--space-xxxsmall);
|
|
185
|
-
--radius-medium: var(--space-
|
|
186
|
-
--radius-large: var(--space-
|
|
184
|
+
--radius-small: calc(var(--space-xxxsmall) / 2);
|
|
185
|
+
--radius-medium: var(--space-xxxsmall);
|
|
186
|
+
--radius-large: var(--space-xxsmall);
|
|
187
187
|
|
|
188
188
|
/** Layout */
|
|
189
189
|
--max-width: 80rem;
|
|
@@ -4,6 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
.outline {
|
|
6
6
|
border: 1px solid var(--color-outline);
|
|
7
|
+
border-radius: var(--radius-medium);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.outline > :first-child {
|
|
11
|
+
border-radius: var(--radius-large) var(--radius-medium) 0 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.outline > :last-child {
|
|
15
|
+
border-radius: 0 0 var(--radius-large) var(--radius-medium);
|
|
7
16
|
}
|
|
8
17
|
|
|
9
18
|
.padding-xxxsmall {
|
package/src/layout/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { Box } from './box';
|
|
2
2
|
export { Footer } from './footer';
|
|
3
3
|
export { Header } from './header';
|
|
4
|
+
export { Separator } from './separator';
|
|
4
5
|
export { SubHeader } from './sub-header';
|
|
5
6
|
export { Stack } from './stack';
|
|
6
7
|
export { FlexStack } from './flex-stack';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import cx from 'classnames';
|
|
4
|
+
|
|
5
|
+
import css from './separator.module.css';
|
|
6
|
+
|
|
7
|
+
const propTypes = {
|
|
8
|
+
className: PropTypes.string,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const defaultProps = {
|
|
12
|
+
className: '',
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {PropTypes.InferProps<typeof propTypes>} props
|
|
17
|
+
* @return {React.FunctionComponentElement}
|
|
18
|
+
*/
|
|
19
|
+
export const Separator = (props) => {
|
|
20
|
+
const { className, ...restProps } = props;
|
|
21
|
+
return <div className={cx(css.root, className)} {...restProps} />;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
Separator.propTypes = propTypes;
|
|
25
|
+
Separator.defaultProps = defaultProps;
|
|
@@ -11,27 +11,25 @@ export const Dropdown = (props) => {
|
|
|
11
11
|
const { className, label, ariaLabel, glyph, activeLabel, children } = props;
|
|
12
12
|
const rootClassName = cx(css.root, activeLabel && css.activeLabel, className);
|
|
13
13
|
|
|
14
|
-
const menu = useMenuState({baseId: process.env.NODE_ENV === 'test' && 'id-test', modal: true });
|
|
14
|
+
const menu = useMenuState({ baseId: process.env.NODE_ENV === 'test' && 'id-test', modal: true });
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
17
|
<>
|
|
18
18
|
<MenuButton {...menu} className={rootClassName} tabIndex={null}>
|
|
19
|
-
<FlexStack space="xxxsmall"
|
|
19
|
+
<FlexStack space="xxxsmall">
|
|
20
20
|
{glyph && <Icon className={css.labelIcon} glyph={glyph} />}
|
|
21
21
|
{label}
|
|
22
22
|
</FlexStack>
|
|
23
23
|
</MenuButton>
|
|
24
24
|
<Menu {...menu} aria-label={ariaLabel || label} className={css.dropdown}>
|
|
25
25
|
{typeof children === 'function'
|
|
26
|
-
?
|
|
27
|
-
children({
|
|
26
|
+
? children({
|
|
28
27
|
MenuItem,
|
|
29
28
|
menu,
|
|
30
29
|
menuItemClassName: css.menuItem,
|
|
31
30
|
menuItemActiveClassName: css.menuItemActive,
|
|
32
31
|
})
|
|
33
|
-
: children
|
|
34
|
-
}
|
|
32
|
+
: children}
|
|
35
33
|
</Menu>
|
|
36
34
|
</>
|
|
37
35
|
);
|
|
@@ -2,15 +2,9 @@
|
|
|
2
2
|
background: none;
|
|
3
3
|
border: none;
|
|
4
4
|
padding: 0;
|
|
5
|
-
}
|
|
6
5
|
|
|
7
|
-
.root:focus {
|
|
8
|
-
outline: none;
|
|
9
|
-
box-shadow: 0 0 var(--space-xxxsmall) var(--color-shadow);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.label {
|
|
13
6
|
border: 1px solid var(--color-outline);
|
|
7
|
+
border-radius: var(--radius-medium);
|
|
14
8
|
padding: calc(var(--space-xxsmall) - 1px);
|
|
15
9
|
display: flex;
|
|
16
10
|
align-items: center;
|
|
@@ -24,7 +18,11 @@
|
|
|
24
18
|
color: var(--color-text-light);
|
|
25
19
|
}
|
|
26
20
|
|
|
27
|
-
.
|
|
21
|
+
.root:hover,
|
|
22
|
+
.root:focus,
|
|
23
|
+
.root:active {
|
|
24
|
+
outline: none;
|
|
25
|
+
box-shadow: 0 0 var(--space-xxxsmall) var(--color-shadow);
|
|
28
26
|
border-color: var(--color-outline-dark);
|
|
29
27
|
color: var(--color-text);
|
|
30
28
|
}
|
|
@@ -33,6 +31,7 @@
|
|
|
33
31
|
position: absolute;
|
|
34
32
|
left: 0;
|
|
35
33
|
top: 100%;
|
|
34
|
+
border-radius: var(--radius-medium);
|
|
36
35
|
box-shadow: 0 2px var(--space-xxsmall) var(--color-shadow);
|
|
37
36
|
background: var(--color-background);
|
|
38
37
|
min-width: 180px;
|
|
@@ -18,25 +18,15 @@ const Filter = (props) => {
|
|
|
18
18
|
<div className={rootClassName}>
|
|
19
19
|
{/* eslint-disable */}
|
|
20
20
|
<FlexStack space="xxxsmall" as="label" className={css.filterCheckbox}>
|
|
21
|
-
|
|
22
|
-
<input
|
|
23
|
-
className={css.filterInput}
|
|
24
|
-
type="checkbox"
|
|
25
|
-
id={id}
|
|
26
|
-
name={name}
|
|
27
|
-
{...inputProps}
|
|
28
|
-
/>
|
|
21
|
+
{/* eslint-enabled */}
|
|
22
|
+
<input className={css.filterInput} type="checkbox" id={id} name={name} {...inputProps} />
|
|
29
23
|
<span className={css.filterLabel} title={label}>
|
|
30
24
|
{label}
|
|
31
25
|
</span>
|
|
32
26
|
</FlexStack>
|
|
33
27
|
|
|
34
28
|
{getOnOnlyClick && (
|
|
35
|
-
<button
|
|
36
|
-
className={css.filterOnlyButton}
|
|
37
|
-
type="button"
|
|
38
|
-
onClick={getOnOnlyClick(name)}
|
|
39
|
-
>
|
|
29
|
+
<button className={css.filterOnlyButton} type="button" onClick={getOnOnlyClick(name)}>
|
|
40
30
|
only
|
|
41
31
|
</button>
|
|
42
32
|
)}
|
|
@@ -57,13 +47,17 @@ Filter.defaultProps = {
|
|
|
57
47
|
};
|
|
58
48
|
|
|
59
49
|
const FilterGroup = (props) => {
|
|
60
|
-
const { groupKey, data, values, onCheckboxChange, toggleFilters } = props;
|
|
50
|
+
const { className, groupKey, data, values, onCheckboxChange, toggleFilters } = props;
|
|
61
51
|
|
|
62
52
|
const { label: groupLabel, ...groupData } = data;
|
|
63
53
|
|
|
64
54
|
const groupItems = Object.entries(groupData);
|
|
65
|
-
const groupCheckboxes = groupItems.filter(
|
|
66
|
-
|
|
55
|
+
const groupCheckboxes = groupItems.filter(
|
|
56
|
+
([itemKey, item]) => typeof item?.defaultValue !== 'undefined',
|
|
57
|
+
);
|
|
58
|
+
const isGroupChecked = groupCheckboxes
|
|
59
|
+
.map(([itemKey]) => get(values, `${groupKey}.${itemKey}`))
|
|
60
|
+
.reduce((agg, val) => agg && val, true);
|
|
67
61
|
|
|
68
62
|
const filterSuffix = getGroupFiltersLabelSuffix(groupItems);
|
|
69
63
|
const hasCustomFilterSuffix = !Object.values(LABELS).includes(filterSuffix);
|
|
@@ -71,26 +65,33 @@ const FilterGroup = (props) => {
|
|
|
71
65
|
<>
|
|
72
66
|
{`${groupLabel}:`}
|
|
73
67
|
|
|
74
|
-
<span className={cx(hasCustomFilterSuffix && css.labelSuffixCustom)}>
|
|
75
|
-
{filterSuffix}
|
|
76
|
-
</span>
|
|
68
|
+
<span className={cx(hasCustomFilterSuffix && css.labelSuffixCustom)}>{filterSuffix}</span>
|
|
77
69
|
</>
|
|
78
70
|
);
|
|
79
71
|
|
|
80
|
-
const getOnGroupCheck =
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
72
|
+
const getOnGroupCheck =
|
|
73
|
+
(value, overrides = {}) =>
|
|
74
|
+
() => {
|
|
75
|
+
const newFilters = groupCheckboxes.reduce(
|
|
76
|
+
(agg, [itemKey]) => ({
|
|
77
|
+
...agg,
|
|
78
|
+
[`${groupKey}.${itemKey}`]: value,
|
|
79
|
+
}),
|
|
80
|
+
{},
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
toggleFilters({
|
|
84
|
+
...newFilters,
|
|
85
|
+
...overrides,
|
|
86
|
+
});
|
|
87
|
+
};
|
|
91
88
|
|
|
92
89
|
return (
|
|
93
|
-
<Dropdown
|
|
90
|
+
<Dropdown
|
|
91
|
+
className={className}
|
|
92
|
+
label={dropdownLabel}
|
|
93
|
+
ariaLabel={`${groupLabel}: ${filterSuffix}`}
|
|
94
|
+
>
|
|
94
95
|
{({ MenuItem, menu, menuItemClassName }) => {
|
|
95
96
|
return (
|
|
96
97
|
<>
|
|
@@ -100,7 +101,11 @@ const FilterGroup = (props) => {
|
|
|
100
101
|
const getOnOnlyClick = () => getOnGroupCheck(false, { [id]: true });
|
|
101
102
|
|
|
102
103
|
return (
|
|
103
|
-
<MenuItem
|
|
104
|
+
<MenuItem
|
|
105
|
+
key={id}
|
|
106
|
+
{...menu}
|
|
107
|
+
className={cx(menuItemClassName, css.filterGroupItem)}
|
|
108
|
+
>
|
|
104
109
|
<Filter
|
|
105
110
|
name={id}
|
|
106
111
|
label={itemData.label}
|
|
@@ -138,12 +143,13 @@ const FilterGroup = (props) => {
|
|
|
138
143
|
</div>
|
|
139
144
|
</>
|
|
140
145
|
);
|
|
141
|
-
|
|
146
|
+
}}
|
|
142
147
|
</Dropdown>
|
|
143
148
|
);
|
|
144
149
|
};
|
|
145
150
|
|
|
146
151
|
FilterGroup.propTypes = {
|
|
152
|
+
className: PropTypes.string,
|
|
147
153
|
groupKey: PropTypes.string.isRequired,
|
|
148
154
|
data: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
|
|
149
155
|
values: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
|
|
@@ -151,14 +157,12 @@ FilterGroup.propTypes = {
|
|
|
151
157
|
toggleFilters: PropTypes.func.isRequired,
|
|
152
158
|
};
|
|
153
159
|
|
|
160
|
+
FilterGroup.defaultProps = {
|
|
161
|
+
className: '',
|
|
162
|
+
};
|
|
163
|
+
|
|
154
164
|
export const Filters = (props) => {
|
|
155
|
-
const {
|
|
156
|
-
className,
|
|
157
|
-
values,
|
|
158
|
-
filters,
|
|
159
|
-
toggleFilter,
|
|
160
|
-
toggleFilters,
|
|
161
|
-
} = props;
|
|
165
|
+
const { className, values, filters, toggleFilter, toggleFilters } = props;
|
|
162
166
|
|
|
163
167
|
const onCheckboxChange = ({ target }) => toggleFilter(target.name, target.checked);
|
|
164
168
|
const rootClassName = cx(css.root, className);
|
|
@@ -182,16 +186,15 @@ export const Filters = (props) => {
|
|
|
182
186
|
}
|
|
183
187
|
|
|
184
188
|
return (
|
|
185
|
-
<
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
</div>
|
|
189
|
+
<FilterGroup
|
|
190
|
+
className={css.item}
|
|
191
|
+
key={name}
|
|
192
|
+
groupKey={name}
|
|
193
|
+
data={data}
|
|
194
|
+
values={values}
|
|
195
|
+
onCheckboxChange={onCheckboxChange}
|
|
196
|
+
toggleFilters={toggleFilters}
|
|
197
|
+
/>
|
|
195
198
|
);
|
|
196
199
|
})}
|
|
197
200
|
</FlexStack>
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
.filterInput {
|
|
14
|
+
border-radius: var(--radius-medium) 0 0 var(--radius-medium);
|
|
14
15
|
flex: 0 0 auto;
|
|
15
16
|
height: 1em;
|
|
16
17
|
cursor: pointer;
|
|
@@ -129,11 +130,20 @@
|
|
|
129
130
|
}
|
|
130
131
|
|
|
131
132
|
.item {
|
|
133
|
+
border-radius: 0;
|
|
132
134
|
position: relative;
|
|
133
135
|
flex: 0 0 auto;
|
|
134
136
|
margin-right: -1px;
|
|
135
137
|
}
|
|
136
138
|
|
|
139
|
+
.item:first-child {
|
|
140
|
+
border-radius: var(--radius-medium) 0 0 var(--radius-medium);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.item:last-child {
|
|
144
|
+
border-radius: 0 var(--radius-medium) var(--radius-medium) 0;
|
|
145
|
+
}
|
|
146
|
+
|
|
137
147
|
.item:hover {
|
|
138
148
|
z-index: var(--layer-low); /* show collapsed border */
|
|
139
149
|
}
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
.popover {
|
|
26
26
|
padding: var(--space-small) var(--space-large) var(--space-small) var(--space-small);
|
|
27
|
-
border-radius: var(--radius-
|
|
27
|
+
border-radius: var(--radius-large);
|
|
28
28
|
max-width: 360px;
|
|
29
29
|
outline: none;
|
|
30
30
|
filter: drop-shadow(0 0 var(--space-xxxsmall) var(--color-shadow));
|
|
@@ -13,12 +13,8 @@
|
|
|
13
13
|
text-align: left;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
tr:last-child .cell {
|
|
17
|
-
border-bottom-width: 1px;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
16
|
.root thead .cell {
|
|
21
|
-
border-width: 0 0
|
|
17
|
+
border-width: 0 0 1px;
|
|
22
18
|
text-transform: uppercase;
|
|
23
19
|
vertical-align: top;
|
|
24
20
|
}
|
|
@@ -44,10 +40,6 @@ tr:last-child .cell {
|
|
|
44
40
|
text-decoration: underline;
|
|
45
41
|
}
|
|
46
42
|
|
|
47
|
-
.root tbody tr:nth-child(odd) .cell {
|
|
48
|
-
background-color: var(--color-highlight);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
43
|
.root tbody tr:hover .cell {
|
|
52
44
|
background-color: var(--color-highlight-warning);
|
|
53
45
|
}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
.tooltip {
|
|
14
14
|
padding: var(--space-xxxsmall) var(--space-xxsmall);
|
|
15
|
-
border-radius: var(--radius-
|
|
15
|
+
border-radius: var(--radius-large);
|
|
16
16
|
background: var(--color-light);
|
|
17
17
|
color: var(--color-text);
|
|
18
18
|
filter: drop-shadow(0 0 var(--space-xxxsmall) var(--color-shadow));
|