@bundle-stats/ui 3.2.6-beta.4 → 3.2.7-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/CHANGELOG.md +20 -3
- package/lib/app/app.module.css +1 -1
- package/lib/app/header/header.js +1 -10
- package/lib/components/bundle-assets/bundle-assets.js +4 -2
- package/lib/components/bundle-modules/bundle-modules.js +3 -1
- package/lib/components/bundle-packages/bundle-packages.js +3 -1
- package/lib/components/job-header/job-header.js +3 -1
- package/lib/components/job-header/job-header.module.css +6 -8
- package/lib/components/jobs-header/jobs-header.module.css +5 -0
- package/lib/components/metrics-table-search/metrics-table-search.module.css +1 -1
- package/lib/components/summary-item/summary-item.js +1 -1
- package/lib/css/variables.css +1 -1
- package/lib/layout/footer/footer.module.css +1 -1
- package/lib/ui/dropdown/dropdown.js +6 -1
- package/lib/ui/filters/filters.js +13 -3
- package/lib/ui/filters/filters.module.css +2 -12
- package/lib/ui/hover-card/hover-card.js +12 -2
- package/lib/ui/hover-card/hover-card.module.css +1 -1
- package/lib/ui/table/table.module.css +25 -9
- package/lib-esm/app/app.module.css +1 -1
- package/lib-esm/app/header/header.js +1 -9
- package/lib-esm/components/bundle-assets/bundle-assets.js +4 -2
- package/lib-esm/components/bundle-modules/bundle-modules.js +3 -1
- package/lib-esm/components/bundle-packages/bundle-packages.js +3 -1
- package/lib-esm/components/job-header/job-header.js +2 -1
- package/lib-esm/components/job-header/job-header.module.css +6 -8
- package/lib-esm/components/jobs-header/jobs-header.module.css +5 -0
- package/lib-esm/components/metrics-table-search/metrics-table-search.module.css +1 -1
- package/lib-esm/components/summary-item/summary-item.js +1 -1
- package/lib-esm/css/variables.css +1 -1
- package/lib-esm/layout/footer/footer.module.css +1 -1
- package/lib-esm/ui/dropdown/dropdown.js +6 -1
- package/lib-esm/ui/filters/filters.js +12 -2
- package/lib-esm/ui/filters/filters.module.css +2 -12
- package/lib-esm/ui/hover-card/hover-card.js +6 -2
- package/lib-esm/ui/hover-card/hover-card.module.css +1 -1
- package/lib-esm/ui/table/table.module.css +25 -9
- package/package.json +10 -10
- package/src/app/app.module.css +1 -1
- package/src/app/header/header.jsx +0 -10
- package/src/components/bundle-assets/bundle-assets.jsx +2 -2
- package/src/components/bundle-modules/bundle-modules.jsx +1 -1
- package/src/components/bundle-packages/bundle-packages.jsx +1 -1
- package/src/components/job-header/job-header.jsx +2 -1
- package/src/components/job-header/job-header.module.css +6 -8
- package/src/components/jobs-header/jobs-header.module.css +5 -0
- package/src/components/metrics-table-search/metrics-table-search.module.css +1 -1
- package/src/components/summary-item/summary-item.jsx +1 -1
- package/src/css/variables.css +1 -1
- package/src/layout/footer/footer.module.css +1 -1
- package/src/ui/dropdown/dropdown.jsx +6 -2
- package/src/ui/filters/filters.jsx +12 -4
- package/src/ui/filters/filters.module.css +2 -12
- package/src/ui/hover-card/hover-card.jsx +10 -2
- package/src/ui/hover-card/hover-card.module.css +1 -1
- package/src/ui/table/table.module.css +25 -9
|
@@ -57,7 +57,7 @@ export const SummaryItem = _ref2 => {
|
|
|
57
57
|
const showMetricDescriptionTooltip = showMetricDescription && (metric == null ? void 0 : metric.description);
|
|
58
58
|
const rootClassName = cx(css.root, className, css[size], showDelta && css.showDelta);
|
|
59
59
|
return /*#__PURE__*/React.createElement(Stack, _extends({
|
|
60
|
-
space: "
|
|
60
|
+
space: "xxxsmall",
|
|
61
61
|
as: Component,
|
|
62
62
|
className: rootClassName
|
|
63
63
|
}, props), /*#__PURE__*/React.createElement(FlexStack, {
|
|
@@ -8,6 +8,7 @@ import css from './dropdown.module.css';
|
|
|
8
8
|
export const Dropdown = props => {
|
|
9
9
|
const {
|
|
10
10
|
className,
|
|
11
|
+
buttonClassName,
|
|
11
12
|
label,
|
|
12
13
|
ariaLabel,
|
|
13
14
|
glyph,
|
|
@@ -19,7 +20,7 @@ export const Dropdown = props => {
|
|
|
19
20
|
className: rootClassName
|
|
20
21
|
}, /*#__PURE__*/React.createElement(MenuButton, {
|
|
21
22
|
state: menuState,
|
|
22
|
-
className: css.button,
|
|
23
|
+
className: cx(css.button, buttonClassName),
|
|
23
24
|
tabIndex: null
|
|
24
25
|
}, /*#__PURE__*/React.createElement(FlexStack, {
|
|
25
26
|
space: "xxxsmall"
|
|
@@ -39,6 +40,7 @@ export const Dropdown = props => {
|
|
|
39
40
|
};
|
|
40
41
|
Dropdown.defaultProps = {
|
|
41
42
|
className: '',
|
|
43
|
+
buttonClassName: '',
|
|
42
44
|
label: null,
|
|
43
45
|
ariaLabel: '',
|
|
44
46
|
glyph: null
|
|
@@ -47,6 +49,9 @@ Dropdown.propTypes = {
|
|
|
47
49
|
/** Adopted child class name */
|
|
48
50
|
className: PropTypes.string,
|
|
49
51
|
|
|
52
|
+
/** Button adopted child class name */
|
|
53
|
+
buttonClassName: PropTypes.string,
|
|
54
|
+
|
|
50
55
|
/** Button label */
|
|
51
56
|
label: PropTypes.node,
|
|
52
57
|
|
|
@@ -13,6 +13,7 @@ import css from './filters.module.css';
|
|
|
13
13
|
const Filter = props => {
|
|
14
14
|
const {
|
|
15
15
|
className,
|
|
16
|
+
buttonClassName,
|
|
16
17
|
label,
|
|
17
18
|
name,
|
|
18
19
|
getOnOnlyClick,
|
|
@@ -25,7 +26,7 @@ const Filter = props => {
|
|
|
25
26
|
}, /*#__PURE__*/React.createElement(FlexStack, {
|
|
26
27
|
space: "xxxsmall",
|
|
27
28
|
as: "label",
|
|
28
|
-
className: css.filterCheckbox
|
|
29
|
+
className: cx(css.filterCheckbox, buttonClassName)
|
|
29
30
|
}, /*#__PURE__*/React.createElement("input", _extends({
|
|
30
31
|
className: css.filterInput,
|
|
31
32
|
type: "checkbox",
|
|
@@ -43,18 +44,21 @@ const Filter = props => {
|
|
|
43
44
|
|
|
44
45
|
Filter.propTypes = {
|
|
45
46
|
className: PropTypes.string,
|
|
47
|
+
buttonClassName: PropTypes.string,
|
|
46
48
|
name: PropTypes.string.isRequired,
|
|
47
49
|
label: PropTypes.string.isRequired,
|
|
48
50
|
getOnOnlyClick: PropTypes.func
|
|
49
51
|
};
|
|
50
52
|
Filter.defaultProps = {
|
|
51
53
|
className: '',
|
|
54
|
+
buttonClassName: '',
|
|
52
55
|
getOnOnlyClick: null
|
|
53
56
|
};
|
|
54
57
|
|
|
55
58
|
const FilterGroup = props => {
|
|
56
59
|
const {
|
|
57
60
|
className,
|
|
61
|
+
buttonClassName,
|
|
58
62
|
groupKey,
|
|
59
63
|
data,
|
|
60
64
|
values,
|
|
@@ -100,6 +104,7 @@ const FilterGroup = props => {
|
|
|
100
104
|
|
|
101
105
|
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
102
106
|
className: className,
|
|
107
|
+
buttonClassName: buttonClassName,
|
|
103
108
|
label: dropdownLabel,
|
|
104
109
|
ariaLabel: `${groupLabel}: ${filterSuffix}`
|
|
105
110
|
}, _ref4 => {
|
|
@@ -150,6 +155,7 @@ const FilterGroup = props => {
|
|
|
150
155
|
|
|
151
156
|
FilterGroup.propTypes = {
|
|
152
157
|
className: PropTypes.string,
|
|
158
|
+
buttonClassName: PropTypes.string,
|
|
153
159
|
groupKey: PropTypes.string.isRequired,
|
|
154
160
|
data: PropTypes.object.isRequired,
|
|
155
161
|
// eslint-disable-line react/forbid-prop-types
|
|
@@ -159,7 +165,8 @@ FilterGroup.propTypes = {
|
|
|
159
165
|
toggleFilters: PropTypes.func.isRequired
|
|
160
166
|
};
|
|
161
167
|
FilterGroup.defaultProps = {
|
|
162
|
-
className: ''
|
|
168
|
+
className: '',
|
|
169
|
+
buttonClassName: ''
|
|
163
170
|
};
|
|
164
171
|
export const Filters = props => {
|
|
165
172
|
const {
|
|
@@ -181,6 +188,7 @@ export const Filters = props => {
|
|
|
181
188
|
return /*#__PURE__*/React.createElement("form", {
|
|
182
189
|
className: rootClassName
|
|
183
190
|
}, /*#__PURE__*/React.createElement(FlexStack, {
|
|
191
|
+
space: "xxsmall",
|
|
184
192
|
className: css.items
|
|
185
193
|
}, Object.entries(filters).map(_ref7 => {
|
|
186
194
|
let [name, data] = _ref7;
|
|
@@ -189,6 +197,7 @@ export const Filters = props => {
|
|
|
189
197
|
return /*#__PURE__*/React.createElement(Filter, {
|
|
190
198
|
key: name,
|
|
191
199
|
className: cx(css.item, css.filterStandalone),
|
|
200
|
+
buttonClassName: css.itemButton,
|
|
192
201
|
name: name,
|
|
193
202
|
label: data.label,
|
|
194
203
|
onChange: onCheckboxChange,
|
|
@@ -199,6 +208,7 @@ export const Filters = props => {
|
|
|
199
208
|
|
|
200
209
|
return /*#__PURE__*/React.createElement(FilterGroup, {
|
|
201
210
|
className: css.item,
|
|
211
|
+
buttonClassName: css.itemButton,
|
|
202
212
|
key: name,
|
|
203
213
|
groupKey: name,
|
|
204
214
|
data: data,
|
|
@@ -130,20 +130,10 @@
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
.item {
|
|
133
|
-
border-radius: 0;
|
|
134
133
|
position: relative;
|
|
135
134
|
flex: 0 0 auto;
|
|
136
|
-
margin-right: -1px;
|
|
137
135
|
}
|
|
138
136
|
|
|
139
|
-
.
|
|
140
|
-
border-radius: var(--radius-small)
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.item:last-child {
|
|
144
|
-
border-radius: 0 var(--radius-small) var(--radius-small) 0;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.item:hover {
|
|
148
|
-
z-index: var(--layer-low); /* show collapsed border */
|
|
137
|
+
.itemButton {
|
|
138
|
+
border-radius: var(--radius-small);
|
|
149
139
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { useCallback } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import cx from 'classnames';
|
|
6
6
|
import { Hovercard, HovercardAnchor, HovercardArrow, useHovercard, useHovercardState } from 'ariakit/hovercard';
|
|
@@ -36,6 +36,10 @@ export const HoverCard = props => {
|
|
|
36
36
|
}); // Fallback to span if no href
|
|
37
37
|
|
|
38
38
|
const Component = resolveComponent(as, href);
|
|
39
|
+
const handleOnClose = useCallback(event => {
|
|
40
|
+
state.hide();
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
}, [state]);
|
|
39
43
|
return /*#__PURE__*/React.createElement("div", {
|
|
40
44
|
className: cx(css.root, className)
|
|
41
45
|
}, /*#__PURE__*/React.createElement(HovercardAnchor, {
|
|
@@ -59,7 +63,7 @@ export const HoverCard = props => {
|
|
|
59
63
|
as: "button",
|
|
60
64
|
type: "button",
|
|
61
65
|
className: css.closeBtn,
|
|
62
|
-
onClick:
|
|
66
|
+
onClick: handleOnClose
|
|
63
67
|
})));
|
|
64
68
|
};
|
|
65
69
|
HoverCard.propTypes = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
.root {
|
|
2
2
|
border-width: 0;
|
|
3
3
|
width: 100%;
|
|
4
|
-
border-
|
|
4
|
+
border-spacing: 0;
|
|
5
5
|
empty-cells: show;
|
|
6
6
|
background: var(--color-background);
|
|
7
7
|
}
|
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.root thead .cell {
|
|
17
|
-
border-width: 0 0
|
|
17
|
+
border-width: 0 0 1px;
|
|
18
18
|
text-transform: uppercase;
|
|
19
19
|
vertical-align: top;
|
|
20
|
+
background: var(--color-highlight);
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
.root thead .cell:empty {
|
|
@@ -27,6 +28,10 @@
|
|
|
27
28
|
font-weight: normal;
|
|
28
29
|
}
|
|
29
30
|
|
|
31
|
+
.root tbody tr:first-child .cell {
|
|
32
|
+
border-top: 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
30
35
|
.root tbody .cell a {
|
|
31
36
|
color: inherit;
|
|
32
37
|
text-decoration: none;
|
|
@@ -40,10 +45,6 @@
|
|
|
40
45
|
text-decoration: underline;
|
|
41
46
|
}
|
|
42
47
|
|
|
43
|
-
.root tbody tr:nth-child(odd) .cell {
|
|
44
|
-
background-color: var(--color-highlight);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
48
|
.root tbody tr:hover .cell {
|
|
48
49
|
background-color: var(--color-highlight-warning);
|
|
49
50
|
}
|
|
@@ -58,12 +59,27 @@
|
|
|
58
59
|
|
|
59
60
|
/* outline variation */
|
|
60
61
|
.outline {
|
|
62
|
+
--table-radius: var(--radius-medium);
|
|
61
63
|
border: 1px solid var(--color-outline);
|
|
62
|
-
border-
|
|
64
|
+
border-radius: var(--table-radius);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.outline thead tr:first-child .cell:first-child,
|
|
68
|
+
.outline tbody:first-child tr:first-child .cell:first-child {
|
|
69
|
+
border-top-left-radius: var(--table-radius);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.outline thead tr:first-child .cell:last-child,
|
|
73
|
+
.outline tbody:first-child tr:first-child .cell:last-child {
|
|
74
|
+
border-top-right-radius: var(--table-radius);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.outline tbody:last-child tr:last-child .cell:first-child {
|
|
78
|
+
border-bottom-left-radius: var(--table-radius);
|
|
63
79
|
}
|
|
64
80
|
|
|
65
|
-
.outline
|
|
66
|
-
border-
|
|
81
|
+
.outline tbody:last-child tr:last-child .cell:last-child {
|
|
82
|
+
border-bottom-right-radius: var(--table-radius);
|
|
67
83
|
}
|
|
68
84
|
|
|
69
85
|
.outline.empty {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bundle-stats/ui",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.7-beta.3",
|
|
4
4
|
"description": "UI components for BundleStats projects.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-esm/index.js",
|
|
@@ -76,21 +76,21 @@
|
|
|
76
76
|
"rimraf": "3.0.2"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
|
-
"classnames": "
|
|
80
|
-
"core-js": "
|
|
81
|
-
"lodash": "
|
|
82
|
-
"prop-types": "
|
|
83
|
-
"react": "
|
|
84
|
-
"react-dom": "
|
|
79
|
+
"classnames": "2.2.6",
|
|
80
|
+
"core-js": "3.20.2",
|
|
81
|
+
"lodash": "4.17.21",
|
|
82
|
+
"prop-types": "15.7.2",
|
|
83
|
+
"react": "16.14.0",
|
|
84
|
+
"react-dom": "16.14.0",
|
|
85
85
|
"react-router-dom": "5.3.0"
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
|
-
"@bundle-stats/utils": "^3.2.
|
|
89
|
-
"ariakit": "2.0.0-alpha.
|
|
88
|
+
"@bundle-stats/utils": "^3.2.7-beta.3",
|
|
89
|
+
"ariakit": "2.0.0-alpha.19",
|
|
90
90
|
"date-fns": "2.28.0",
|
|
91
91
|
"modern-css-reset": "1.4.0",
|
|
92
92
|
"query-string": "7.1.1",
|
|
93
93
|
"use-query-params": "1.2.3"
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "23478e08f6882f7c20f373f5bb9bc3beaaea4ea7"
|
|
96
96
|
}
|
package/src/app/app.module.css
CHANGED
|
@@ -4,21 +4,11 @@ import cx from 'classnames';
|
|
|
4
4
|
|
|
5
5
|
import { Container } from '../../ui/container';
|
|
6
6
|
import { JobsHeader } from '../../components/jobs-header';
|
|
7
|
-
import { Logo } from '../../ui/logo';
|
|
8
|
-
|
|
9
7
|
import css from './header.module.css';
|
|
10
8
|
|
|
11
9
|
export const Header = ({ className, jobs }) => (
|
|
12
10
|
<Container as="header" className={cx(css.root, className)}>
|
|
13
11
|
<div className={css.inner}>
|
|
14
|
-
<a
|
|
15
|
-
className={css.branding}
|
|
16
|
-
href="https://github.com/relative-ci/bundle-stats"
|
|
17
|
-
target="_blank"
|
|
18
|
-
rel="noopener noreferrer nofollow"
|
|
19
|
-
>
|
|
20
|
-
<Logo className={css.brandingLogo}>BundleStats</Logo>
|
|
21
|
-
</a>
|
|
22
12
|
<JobsHeader className={css.jobs} jobs={jobs} />
|
|
23
13
|
</div>
|
|
24
14
|
</Container>
|
|
@@ -172,7 +172,7 @@ export const BundleAssets = (props) => {
|
|
|
172
172
|
<Toolbar
|
|
173
173
|
className={css.toolbar}
|
|
174
174
|
renderActions={({ actionClassName }) => (
|
|
175
|
-
<FlexStack space="
|
|
175
|
+
<FlexStack space="xxsmall" className={cx(css.dropdown, actionClassName)}>
|
|
176
176
|
<SortDropdown fields={sortFields} {...sort} onChange={updateSort} />
|
|
177
177
|
<MetricsTableOptions
|
|
178
178
|
handleViewAll={resetAllFilters}
|
|
@@ -181,7 +181,7 @@ export const BundleAssets = (props) => {
|
|
|
181
181
|
</FlexStack>
|
|
182
182
|
)}
|
|
183
183
|
>
|
|
184
|
-
<FlexStack>
|
|
184
|
+
<FlexStack space="xxsmall">
|
|
185
185
|
<MetricsTableSearch
|
|
186
186
|
className={css.toolbarSearch}
|
|
187
187
|
placeholder="Search by name"
|
|
@@ -8,6 +8,7 @@ import { SOURCE_PATH_WEBPACK_STATS, formatDate, formatTime } from '@bundle-stats
|
|
|
8
8
|
import { FlexStack } from '../../layout/flex-stack';
|
|
9
9
|
import { Stack } from '../../layout/stack';
|
|
10
10
|
import { Icon } from '../../ui/icon';
|
|
11
|
+
import { Tag } from '../../ui/tag';
|
|
11
12
|
import css from './job-header.module.css';
|
|
12
13
|
|
|
13
14
|
export const JobHeader = (props) => {
|
|
@@ -20,7 +21,7 @@ export const JobHeader = (props) => {
|
|
|
20
21
|
<Stack className={rootClassName} space="xxsmall">
|
|
21
22
|
<h1 className={css.title}>
|
|
22
23
|
<span>{`#${job.internalBuildNumber}`}</span>
|
|
23
|
-
{tag && <
|
|
24
|
+
{tag && <Tag className={css.tag}>{tag}</Tag>}
|
|
24
25
|
</h1>
|
|
25
26
|
<FlexStack className={css.meta} space="xxsmall">
|
|
26
27
|
{builtAt && (
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
.title {
|
|
2
|
+
font-size: var(--size-xlarge);
|
|
2
3
|
line-height: 1;
|
|
3
4
|
font-weight: bold;
|
|
4
5
|
vertical-align: top;
|
|
5
6
|
}
|
|
6
7
|
|
|
7
8
|
.tag {
|
|
8
|
-
|
|
9
|
-
margin-left: var(--space-xxxsmall);
|
|
10
|
-
background-color: var(--color-highlight);
|
|
11
|
-
color: var(--color-text-light);
|
|
12
|
-
display: inline-block;
|
|
13
|
-
font-size: 9px;
|
|
14
|
-
line-height: var(--space-xxsmall);
|
|
15
|
-
font-weight: normal;
|
|
9
|
+
margin-left: var(--space-xxsmall);
|
|
16
10
|
vertical-align: top;
|
|
11
|
+
outline: 1px solid var(--color-outline);
|
|
12
|
+
background: var(--color-highlight);
|
|
13
|
+
color: var(--color-text-light);
|
|
17
14
|
}
|
|
18
15
|
|
|
19
16
|
.meta {
|
|
17
|
+
font-size: var(--size-small);
|
|
20
18
|
color: var(--color-text-light);
|
|
21
19
|
}
|
|
22
20
|
|
|
@@ -54,7 +54,7 @@ export const SummaryItem = ({
|
|
|
54
54
|
const rootClassName = cx(css.root, className, css[size], showDelta && css.showDelta);
|
|
55
55
|
|
|
56
56
|
return (
|
|
57
|
-
<Stack space="
|
|
57
|
+
<Stack space="xxxsmall" as={Component} className={rootClassName} {...props}>
|
|
58
58
|
<FlexStack as="h3" space="xxxsmall" className={css.title}>
|
|
59
59
|
<span>{metric.label}</span>
|
|
60
60
|
|
package/src/css/variables.css
CHANGED
|
@@ -8,13 +8,13 @@ import { Icon } from '../icon';
|
|
|
8
8
|
import css from './dropdown.module.css';
|
|
9
9
|
|
|
10
10
|
export const Dropdown = (props) => {
|
|
11
|
-
const { className, label, ariaLabel, glyph, children } = props;
|
|
11
|
+
const { className, buttonClassName, label, ariaLabel, glyph, children } = props;
|
|
12
12
|
const rootClassName = cx(css.root, className);
|
|
13
13
|
const menuState = useMenuState();
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
16
|
<div className={rootClassName}>
|
|
17
|
-
<MenuButton state={menuState} className={css.button} tabIndex={null}>
|
|
17
|
+
<MenuButton state={menuState} className={cx(css.button, buttonClassName)} tabIndex={null}>
|
|
18
18
|
<FlexStack space="xxxsmall">
|
|
19
19
|
{glyph && <Icon className={css.labelIcon} glyph={glyph} />}
|
|
20
20
|
{label}
|
|
@@ -36,6 +36,7 @@ export const Dropdown = (props) => {
|
|
|
36
36
|
|
|
37
37
|
Dropdown.defaultProps = {
|
|
38
38
|
className: '',
|
|
39
|
+
buttonClassName: '',
|
|
39
40
|
label: null,
|
|
40
41
|
ariaLabel: '',
|
|
41
42
|
glyph: null,
|
|
@@ -45,6 +46,9 @@ Dropdown.propTypes = {
|
|
|
45
46
|
/** Adopted child class name */
|
|
46
47
|
className: PropTypes.string,
|
|
47
48
|
|
|
49
|
+
/** Button adopted child class name */
|
|
50
|
+
buttonClassName: PropTypes.string,
|
|
51
|
+
|
|
48
52
|
/** Button label */
|
|
49
53
|
label: PropTypes.node,
|
|
50
54
|
|
|
@@ -9,7 +9,7 @@ import { getGroupFiltersLabelSuffix, LABELS } from './filters.utils';
|
|
|
9
9
|
import css from './filters.module.css';
|
|
10
10
|
|
|
11
11
|
const Filter = (props) => {
|
|
12
|
-
const { className, label, name, getOnOnlyClick, ...inputProps } = props;
|
|
12
|
+
const { className, buttonClassName, label, name, getOnOnlyClick, ...inputProps } = props;
|
|
13
13
|
const id = `filter-${name}`;
|
|
14
14
|
|
|
15
15
|
const rootClassName = cx(css.filter, className);
|
|
@@ -17,7 +17,7 @@ const Filter = (props) => {
|
|
|
17
17
|
return (
|
|
18
18
|
<div className={rootClassName}>
|
|
19
19
|
{/* eslint-disable */}
|
|
20
|
-
<FlexStack space="xxxsmall" as="label" className={css.filterCheckbox}>
|
|
20
|
+
<FlexStack space="xxxsmall" as="label" className={cx(css.filterCheckbox, buttonClassName)}>
|
|
21
21
|
{/* eslint-enabled */}
|
|
22
22
|
<input className={css.filterInput} type="checkbox" id={id} name={name} {...inputProps} />
|
|
23
23
|
<span className={css.filterLabel} title={label}>
|
|
@@ -36,6 +36,7 @@ const Filter = (props) => {
|
|
|
36
36
|
|
|
37
37
|
Filter.propTypes = {
|
|
38
38
|
className: PropTypes.string,
|
|
39
|
+
buttonClassName: PropTypes.string,
|
|
39
40
|
name: PropTypes.string.isRequired,
|
|
40
41
|
label: PropTypes.string.isRequired,
|
|
41
42
|
getOnOnlyClick: PropTypes.func,
|
|
@@ -43,11 +44,13 @@ Filter.propTypes = {
|
|
|
43
44
|
|
|
44
45
|
Filter.defaultProps = {
|
|
45
46
|
className: '',
|
|
47
|
+
buttonClassName: '',
|
|
46
48
|
getOnOnlyClick: null,
|
|
47
49
|
};
|
|
48
50
|
|
|
49
51
|
const FilterGroup = (props) => {
|
|
50
|
-
const { className, groupKey, data, values, onCheckboxChange, toggleFilters } =
|
|
52
|
+
const { className, buttonClassName, groupKey, data, values, onCheckboxChange, toggleFilters } =
|
|
53
|
+
props;
|
|
51
54
|
|
|
52
55
|
const { label: groupLabel, ...groupData } = data;
|
|
53
56
|
|
|
@@ -89,6 +92,7 @@ const FilterGroup = (props) => {
|
|
|
89
92
|
return (
|
|
90
93
|
<Dropdown
|
|
91
94
|
className={className}
|
|
95
|
+
buttonClassName={buttonClassName}
|
|
92
96
|
label={dropdownLabel}
|
|
93
97
|
ariaLabel={`${groupLabel}: ${filterSuffix}`}
|
|
94
98
|
>
|
|
@@ -150,6 +154,7 @@ const FilterGroup = (props) => {
|
|
|
150
154
|
|
|
151
155
|
FilterGroup.propTypes = {
|
|
152
156
|
className: PropTypes.string,
|
|
157
|
+
buttonClassName: PropTypes.string,
|
|
153
158
|
groupKey: PropTypes.string.isRequired,
|
|
154
159
|
data: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
|
|
155
160
|
values: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
|
|
@@ -159,6 +164,7 @@ FilterGroup.propTypes = {
|
|
|
159
164
|
|
|
160
165
|
FilterGroup.defaultProps = {
|
|
161
166
|
className: '',
|
|
167
|
+
buttonClassName: '',
|
|
162
168
|
};
|
|
163
169
|
|
|
164
170
|
export const Filters = (props) => {
|
|
@@ -169,13 +175,14 @@ export const Filters = (props) => {
|
|
|
169
175
|
|
|
170
176
|
return (
|
|
171
177
|
<form className={rootClassName}>
|
|
172
|
-
<FlexStack className={css.items}>
|
|
178
|
+
<FlexStack space="xxsmall" className={css.items}>
|
|
173
179
|
{Object.entries(filters).map(([name, data]) => {
|
|
174
180
|
if (typeof data?.defaultValue !== 'undefined') {
|
|
175
181
|
return (
|
|
176
182
|
<Filter
|
|
177
183
|
key={name}
|
|
178
184
|
className={cx(css.item, css.filterStandalone)}
|
|
185
|
+
buttonClassName={css.itemButton}
|
|
179
186
|
name={name}
|
|
180
187
|
label={data.label}
|
|
181
188
|
onChange={onCheckboxChange}
|
|
@@ -188,6 +195,7 @@ export const Filters = (props) => {
|
|
|
188
195
|
return (
|
|
189
196
|
<FilterGroup
|
|
190
197
|
className={css.item}
|
|
198
|
+
buttonClassName={css.itemButton}
|
|
191
199
|
key={name}
|
|
192
200
|
groupKey={name}
|
|
193
201
|
data={data}
|
|
@@ -130,20 +130,10 @@
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
.item {
|
|
133
|
-
border-radius: 0;
|
|
134
133
|
position: relative;
|
|
135
134
|
flex: 0 0 auto;
|
|
136
|
-
margin-right: -1px;
|
|
137
135
|
}
|
|
138
136
|
|
|
139
|
-
.
|
|
140
|
-
border-radius: var(--radius-small)
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.item:last-child {
|
|
144
|
-
border-radius: 0 var(--radius-small) var(--radius-small) 0;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.item:hover {
|
|
148
|
-
z-index: var(--layer-low); /* show collapsed border */
|
|
137
|
+
.itemButton {
|
|
138
|
+
border-radius: var(--radius-small);
|
|
149
139
|
}
|