@bundle-stats/ui 3.2.1-alpha.0 → 3.2.1-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 +12 -1
- package/lib/utils.js +6 -3
- package/lib-esm/app/app.js +60 -50
- package/lib-esm/app/header/header.js +22 -19
- package/lib-esm/components/asset-info/asset-info.js +8 -6
- package/lib-esm/components/bundle-assets/bundle-assets.js +93 -80
- package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js +15 -12
- package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.js +6 -5
- package/lib-esm/components/bundle-modules/bundle-modules.js +82 -67
- package/lib-esm/components/bundle-modules/bundle-modules.utils.js +9 -6
- package/lib-esm/components/bundle-modules/index.js +6 -3
- package/lib-esm/components/bundle-packages/bundle-packages.js +29 -24
- package/lib-esm/components/component-link.js +7 -6
- package/lib-esm/components/delta/delta.js +7 -6
- package/lib-esm/components/job-meta/job-meta.js +5 -4
- package/lib-esm/components/job-name/job-name.js +14 -11
- package/lib-esm/components/metric/metric.js +10 -9
- package/lib-esm/components/metrics-table/metrics-table.js +24 -20
- package/lib-esm/components/metrics-table-options/metrics-table-options.js +7 -5
- package/lib-esm/components/summary/summary.js +44 -32
- package/lib-esm/components/summary/summary.stories.js +11 -8
- package/lib-esm/components/summary-item/summary-item.js +18 -15
- package/lib-esm/components/total-size-type-title/total-size-type-title.js +17 -14
- package/lib-esm/hooks/rows-filter.js +7 -6
- package/lib-esm/hooks/rows-sort.js +8 -7
- package/lib-esm/hooks/search-params.js +73 -69
- package/lib-esm/layout/footer/footer.js +33 -30
- package/lib-esm/layout/header/header.js +17 -14
- package/lib-esm/layout/header/header.stories.js +45 -30
- package/lib-esm/prototypes/typography.stories.js +5 -4
- package/lib-esm/stories/wrapper.js +20 -14
- package/lib-esm/ui/container/container.js +12 -9
- package/lib-esm/ui/dropdown/dropdown.stories.js +9 -6
- package/lib-esm/ui/file-name/file-name.js +10 -7
- package/lib-esm/ui/filters/filters.container.js +14 -8
- package/lib-esm/ui/filters/filters.js +41 -19
- package/lib-esm/ui/filters/filters.stories.js +4 -3
- package/lib-esm/ui/filters/filters.utils.js +12 -6
- package/lib-esm/ui/horizontal-bar-chart/horizontal-bar-chart.js +7 -6
- package/lib-esm/ui/icon/icon.js +16 -13
- package/lib-esm/ui/input/input.js +6 -5
- package/lib-esm/ui/loader/loader.js +10 -7
- package/lib-esm/ui/logo/logo.js +7 -6
- package/lib-esm/ui/logo/logo.stories.js +7 -1
- package/lib-esm/ui/panels/panels.js +10 -7
- package/lib-esm/ui/popover/popover.js +8 -7
- package/lib-esm/ui/sort-dropdown/sort-dropdown.js +10 -7
- package/lib-esm/ui/table/table.js +8 -7
- package/lib-esm/ui/tabs/tabs.js +9 -6
- package/lib-esm/ui/toolbar/toolbar.stories.js +10 -7
- package/lib-esm/utils.js +13 -4
- package/package.json +14 -14
- package/src/utils.jsx +5 -3
|
@@ -7,20 +7,23 @@ import { FlexStack } from '../../layout/flex-stack';
|
|
|
7
7
|
import { Stack } from '../../layout/stack';
|
|
8
8
|
import { Popover } from '../../ui/popover';
|
|
9
9
|
import css from './total-size-type-title.module.css';
|
|
10
|
-
export const TotalSizeTypeTitle =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}, /*#__PURE__*/React.createElement(
|
|
18
|
-
|
|
19
|
-
}, /*#__PURE__*/React.createElement(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
export const TotalSizeTypeTitle = _ref => {
|
|
11
|
+
let {
|
|
12
|
+
className
|
|
13
|
+
} = _ref;
|
|
14
|
+
return /*#__PURE__*/React.createElement(FlexStack, {
|
|
15
|
+
space: "xxxsmall",
|
|
16
|
+
className: cx(css.title, className)
|
|
17
|
+
}, /*#__PURE__*/React.createElement("span", null, I18N.ASSET_TOTALS), /*#__PURE__*/React.createElement(Popover, {
|
|
18
|
+
icon: "help"
|
|
19
|
+
}, /*#__PURE__*/React.createElement(Stack, {
|
|
20
|
+
space: "xxxsmall"
|
|
21
|
+
}, /*#__PURE__*/React.createElement("p", null, I18N.ASSET_TOTALS_INFO), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("a", {
|
|
22
|
+
href: config.documentation.assets,
|
|
23
|
+
target: "_blank",
|
|
24
|
+
rel: "noreferrer"
|
|
25
|
+
}, I18N.READ_MORE)))));
|
|
26
|
+
};
|
|
24
27
|
TotalSizeTypeTitle.propTypes = {
|
|
25
28
|
className: PropTypes.string
|
|
26
29
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
export const useRowsFilter =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
export const useRowsFilter = _ref => {
|
|
3
|
+
let {
|
|
4
|
+
rows,
|
|
5
|
+
searchPattern,
|
|
6
|
+
filters,
|
|
7
|
+
getRowFilter
|
|
8
|
+
} = _ref;
|
|
8
9
|
const filteredRows = useMemo(() => {
|
|
9
10
|
const filterRow = getRowFilter(filters);
|
|
10
11
|
return rows.filter(row => {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import _orderBy from "lodash/orderBy";
|
|
2
2
|
import { useState, useMemo } from 'react';
|
|
3
|
-
export const useRowsSort =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
export const useRowsSort = _ref => {
|
|
4
|
+
let {
|
|
5
|
+
rows,
|
|
6
|
+
sortFields,
|
|
7
|
+
sortBy = 'size',
|
|
8
|
+
sortDirection = 'desc',
|
|
9
|
+
getCustomSort
|
|
10
|
+
} = _ref;
|
|
10
11
|
const [sort, updateSort] = useState({
|
|
11
12
|
field: sortBy,
|
|
12
13
|
direction: sortDirection
|
|
@@ -24,74 +24,77 @@ const getSearchPattern = search => {
|
|
|
24
24
|
return searchPattern;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
const getSearchReducer =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
const getSearchReducer = _ref => {
|
|
28
|
+
let {
|
|
29
|
+
defaultFilters,
|
|
30
|
+
allEntriesFilters,
|
|
31
|
+
setParentState
|
|
32
|
+
} = _ref;
|
|
33
|
+
return (state, action) => {
|
|
34
|
+
const {
|
|
35
|
+
type,
|
|
36
|
+
payload
|
|
37
|
+
} = action;
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
switch (type) {
|
|
40
|
+
case ACTION_SET_FILTERS:
|
|
41
|
+
{
|
|
42
|
+
setParentState({
|
|
43
|
+
filters: payload,
|
|
44
|
+
search: state.search
|
|
45
|
+
});
|
|
46
|
+
return { ...state,
|
|
47
|
+
filters: payload
|
|
48
|
+
};
|
|
49
|
+
}
|
|
48
50
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
case ACTION_SET_SEARCH:
|
|
52
|
+
{
|
|
53
|
+
setParentState({
|
|
54
|
+
filters: state.filters,
|
|
55
|
+
search: payload
|
|
56
|
+
});
|
|
57
|
+
return { ...state,
|
|
58
|
+
search: payload,
|
|
59
|
+
searchPattern: getSearchPattern(payload)
|
|
60
|
+
};
|
|
61
|
+
}
|
|
60
62
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
63
|
+
case ACTION_RESET_DEFAULT:
|
|
64
|
+
{
|
|
65
|
+
setParentState({
|
|
66
|
+
filters: defaultFilters,
|
|
67
|
+
search: ''
|
|
68
|
+
});
|
|
69
|
+
return {
|
|
70
|
+
filters: defaultFilters,
|
|
71
|
+
search: '',
|
|
72
|
+
searchPattern: getSearchPattern()
|
|
73
|
+
};
|
|
74
|
+
}
|
|
73
75
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
76
|
+
case ACTION_RESET_ALL:
|
|
77
|
+
{
|
|
78
|
+
setParentState({
|
|
79
|
+
filters: allEntriesFilters,
|
|
80
|
+
search: ''
|
|
81
|
+
});
|
|
82
|
+
return {
|
|
83
|
+
filters: allEntriesFilters,
|
|
84
|
+
search: '',
|
|
85
|
+
searchPattern: getSearchPattern()
|
|
86
|
+
};
|
|
87
|
+
}
|
|
86
88
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
case ACTION_SET:
|
|
90
|
+
{
|
|
91
|
+
return payload;
|
|
92
|
+
}
|
|
91
93
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
default:
|
|
95
|
+
return state;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
95
98
|
};
|
|
96
99
|
|
|
97
100
|
export const generateState = (filters, search) => ({
|
|
@@ -99,13 +102,14 @@ export const generateState = (filters, search) => ({
|
|
|
99
102
|
search,
|
|
100
103
|
searchPattern: getSearchPattern(search)
|
|
101
104
|
});
|
|
102
|
-
export const useSearchParams =
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
export const useSearchParams = _ref2 => {
|
|
106
|
+
let {
|
|
107
|
+
search: parentSearch,
|
|
108
|
+
filters: parentFilters,
|
|
109
|
+
defaultFilters,
|
|
110
|
+
allEntriesFilters,
|
|
111
|
+
setState: setParentState
|
|
112
|
+
} = _ref2;
|
|
109
113
|
// When we pass custom filters, set the other flags to true (allEntries)
|
|
110
114
|
const initialFilters = parentFilters ? _merge({}, allEntriesFilters, parentFilters) : defaultFilters;
|
|
111
115
|
const [{
|
|
@@ -21,36 +21,39 @@ ExternalLink.propTypes = {
|
|
|
21
21
|
/** Link to value */
|
|
22
22
|
to: PropTypes.string.isRequired
|
|
23
23
|
};
|
|
24
|
-
export const Footer =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}, /*#__PURE__*/React.createElement(
|
|
36
|
-
|
|
37
|
-
}, /*#__PURE__*/React.createElement(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}, /*#__PURE__*/React.createElement(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
24
|
+
export const Footer = _ref => {
|
|
25
|
+
let {
|
|
26
|
+
className,
|
|
27
|
+
version
|
|
28
|
+
} = _ref;
|
|
29
|
+
return /*#__PURE__*/React.createElement(Container, {
|
|
30
|
+
as: "footer",
|
|
31
|
+
className: cx(css.root, className)
|
|
32
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
33
|
+
padding: ['medium', 'none'],
|
|
34
|
+
className: css.inner
|
|
35
|
+
}, /*#__PURE__*/React.createElement(Stack, {
|
|
36
|
+
space: "xsmall"
|
|
37
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("nav", {
|
|
38
|
+
className: css.nav
|
|
39
|
+
}, /*#__PURE__*/React.createElement(ExternalLink, {
|
|
40
|
+
href: config.githubUrl,
|
|
41
|
+
className: cx(css.navItem, css.navLink),
|
|
42
|
+
title: "In-depth bundle analyzer for webpack(bundle size, assets, modules, packages)"
|
|
43
|
+
}, `BundleStats `, version), /*#__PURE__*/React.createElement("span", {
|
|
44
|
+
className: css.navItem
|
|
45
|
+
}, /*#__PURE__*/React.createElement(ExternalLink, {
|
|
46
|
+
href: `${config.githubUrl}/issues`,
|
|
47
|
+
className: css.navLink,
|
|
48
|
+
title: "Navigate to GitHub and open issue"
|
|
49
|
+
}, "Report issue")), /*#__PURE__*/React.createElement("span", {
|
|
50
|
+
className: css.navItem
|
|
51
|
+
}, /*#__PURE__*/React.createElement("span", null, "Made by "), /*#__PURE__*/React.createElement(ExternalLink, {
|
|
52
|
+
className: css.navLink,
|
|
53
|
+
href: config.siteUrl,
|
|
54
|
+
title: "Go to RelativeCI - Specialized insights for web bundles"
|
|
55
|
+
}, "RelativeCI")))))));
|
|
56
|
+
};
|
|
54
57
|
Footer.defaultProps = {
|
|
55
58
|
className: '',
|
|
56
59
|
version: null
|
|
@@ -2,20 +2,23 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
import css from './header.module.css';
|
|
5
|
-
export const Header =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
}),
|
|
17
|
-
|
|
18
|
-
})
|
|
5
|
+
export const Header = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
className,
|
|
8
|
+
renderLeft,
|
|
9
|
+
renderRight,
|
|
10
|
+
render
|
|
11
|
+
} = _ref;
|
|
12
|
+
return /*#__PURE__*/React.createElement("header", {
|
|
13
|
+
className: cx(css.root, className)
|
|
14
|
+
}, renderLeft({
|
|
15
|
+
className: css.left
|
|
16
|
+
}), render({
|
|
17
|
+
className: css.center
|
|
18
|
+
}), renderRight({
|
|
19
|
+
className: css.right
|
|
20
|
+
}));
|
|
21
|
+
};
|
|
19
22
|
Header.defaultProps = {
|
|
20
23
|
className: '',
|
|
21
24
|
renderLeft: props => /*#__PURE__*/React.createElement("div", props),
|
|
@@ -7,36 +7,51 @@ import { Header } from '.';
|
|
|
7
7
|
const stories = storiesOf('Layout/Header', module);
|
|
8
8
|
stories.addDecorator(getWrapperDecorator());
|
|
9
9
|
stories.add('default', () => /*#__PURE__*/React.createElement(Header, {
|
|
10
|
-
renderLeft:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
10
|
+
renderLeft: _ref => {
|
|
11
|
+
let {
|
|
12
|
+
className
|
|
13
|
+
} = _ref;
|
|
14
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
15
|
+
className: className
|
|
16
|
+
}, /*#__PURE__*/React.createElement(Logo, null));
|
|
17
|
+
},
|
|
18
|
+
render: _ref2 => {
|
|
19
|
+
let {
|
|
20
|
+
className
|
|
21
|
+
} = _ref2;
|
|
22
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
23
|
+
className: className
|
|
24
|
+
}, /*#__PURE__*/React.createElement(Tabs, null, /*#__PURE__*/React.createElement("span", null, "Totals"), /*#__PURE__*/React.createElement("span", null, "Assets"), /*#__PURE__*/React.createElement("span", null, "Modules")));
|
|
25
|
+
},
|
|
26
|
+
renderRight: _ref3 => {
|
|
27
|
+
let {
|
|
28
|
+
className
|
|
29
|
+
} = _ref3;
|
|
30
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
31
|
+
className: className
|
|
32
|
+
}, /*#__PURE__*/React.createElement(Logo, {
|
|
33
|
+
kind: "github"
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
27
36
|
}));
|
|
28
37
|
stories.add('menu on the right', () => /*#__PURE__*/React.createElement(Header, {
|
|
29
|
-
renderLeft:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
38
|
+
renderLeft: _ref4 => {
|
|
39
|
+
let {
|
|
40
|
+
className
|
|
41
|
+
} = _ref4;
|
|
42
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
className: className
|
|
44
|
+
}, /*#__PURE__*/React.createElement(Logo, null));
|
|
45
|
+
},
|
|
46
|
+
renderRight: _ref5 => {
|
|
47
|
+
let {
|
|
48
|
+
className
|
|
49
|
+
} = _ref5;
|
|
50
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
className: className,
|
|
52
|
+
style: {
|
|
53
|
+
flexBasis: '100%'
|
|
54
|
+
}
|
|
55
|
+
}, /*#__PURE__*/React.createElement(Tabs, null, /*#__PURE__*/React.createElement("span", null, "Totals"), /*#__PURE__*/React.createElement("span", null, "Assets"), /*#__PURE__*/React.createElement("span", null, "Modules")));
|
|
56
|
+
}
|
|
42
57
|
}));
|
|
@@ -26,10 +26,11 @@ stories.add('typography', () => /*#__PURE__*/React.createElement(React.Fragment,
|
|
|
26
26
|
}
|
|
27
27
|
})))); // eslint-disable-next-line react/prop-types
|
|
28
28
|
|
|
29
|
-
const Item =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
const Item = _ref => {
|
|
30
|
+
let {
|
|
31
|
+
colorName,
|
|
32
|
+
valueName = 'normal'
|
|
33
|
+
} = _ref;
|
|
33
34
|
const colorFullName = valueName === 'normal' ? colorName : [colorName, valueName].join('-');
|
|
34
35
|
return /*#__PURE__*/React.createElement("div", {
|
|
35
36
|
style: {
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { MemoryRouter } from 'react-router-dom';
|
|
3
|
-
export const getWrapperDecorator = (customWrapperStyles
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
export const getWrapperDecorator = function (customWrapperStyles) {
|
|
4
|
+
if (customWrapperStyles === void 0) {
|
|
5
|
+
customWrapperStyles = {};
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
return storyFn => {
|
|
9
|
+
const wrapperStyles = {
|
|
10
|
+
width: '100%',
|
|
11
|
+
height: '100%',
|
|
12
|
+
padding: '24px',
|
|
13
|
+
...customWrapperStyles
|
|
14
|
+
};
|
|
15
|
+
return /*#__PURE__*/React.createElement(MemoryRouter, {
|
|
16
|
+
initialEntries: [{
|
|
17
|
+
pathname: '/',
|
|
18
|
+
key: 'home'
|
|
19
|
+
}]
|
|
20
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
style: wrapperStyles
|
|
22
|
+
}, storyFn()));
|
|
9
23
|
};
|
|
10
|
-
return /*#__PURE__*/React.createElement(MemoryRouter, {
|
|
11
|
-
initialEntries: [{
|
|
12
|
-
pathname: '/',
|
|
13
|
-
key: 'home'
|
|
14
|
-
}]
|
|
15
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
16
|
-
style: wrapperStyles
|
|
17
|
-
}, storyFn()));
|
|
18
24
|
};
|
|
@@ -4,15 +4,18 @@ import React from 'react';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import cx from 'classnames';
|
|
6
6
|
import css from './container.module.css';
|
|
7
|
-
export const Container =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
},
|
|
7
|
+
export const Container = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
className,
|
|
10
|
+
as: Component,
|
|
11
|
+
...restProps
|
|
12
|
+
} = _ref;
|
|
13
|
+
return /*#__PURE__*/React.createElement(Component, {
|
|
14
|
+
className: cx(css.root, className)
|
|
15
|
+
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
16
|
+
className: css.inner
|
|
17
|
+
}, restProps)));
|
|
18
|
+
};
|
|
16
19
|
Container.defaultProps = {
|
|
17
20
|
className: '',
|
|
18
21
|
as: 'div'
|
|
@@ -16,9 +16,12 @@ stories.add('with right alignement', () => /*#__PURE__*/React.createElement(Drop
|
|
|
16
16
|
stories.add('with render function', () => /*#__PURE__*/React.createElement(Dropdown, {
|
|
17
17
|
glyph: "filter",
|
|
18
18
|
label: "Toggle"
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
}, _ref => {
|
|
20
|
+
let {
|
|
21
|
+
dropdownToggle
|
|
22
|
+
} = _ref;
|
|
23
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
24
|
+
type: "button",
|
|
25
|
+
onClick: dropdownToggle
|
|
26
|
+
}, "Toggle dropdown");
|
|
27
|
+
}));
|
|
@@ -2,13 +2,16 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
import css from './file-name.module.css';
|
|
5
|
-
export const FileName =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
export const FileName = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
className,
|
|
8
|
+
as: Component,
|
|
9
|
+
name
|
|
10
|
+
} = _ref;
|
|
11
|
+
return /*#__PURE__*/React.createElement(Component, {
|
|
12
|
+
className: cx(css.root, className)
|
|
13
|
+
}, name);
|
|
14
|
+
};
|
|
12
15
|
FileName.defaultProps = {
|
|
13
16
|
className: '',
|
|
14
17
|
as: 'span',
|
|
@@ -13,7 +13,10 @@ const getInitialValues = (key, filters) => {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
if (typeof filters === 'object') {
|
|
16
|
-
return Object.entries(filters).map(
|
|
16
|
+
return Object.entries(filters).map(_ref => {
|
|
17
|
+
let [groupKey, groupFilters] = _ref;
|
|
18
|
+
return getInitialValues([...(key ? [key] : []), groupKey].join('.'), groupFilters);
|
|
19
|
+
}).reduce((agg, current) => ({ ...agg,
|
|
17
20
|
...current
|
|
18
21
|
}), {});
|
|
19
22
|
}
|
|
@@ -26,10 +29,11 @@ export const filtersDropdownContainer = BaseComponent => {
|
|
|
26
29
|
constructor(props) {
|
|
27
30
|
super(props);
|
|
28
31
|
|
|
29
|
-
this.toggleFilter = (key, value) => this.setState(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
this.toggleFilter = (key, value) => this.setState(_ref2 => {
|
|
33
|
+
let {
|
|
34
|
+
values,
|
|
35
|
+
...state
|
|
36
|
+
} = _ref2;
|
|
33
37
|
const newState = { ...state,
|
|
34
38
|
values: { ...values,
|
|
35
39
|
[key]: value
|
|
@@ -71,9 +75,11 @@ export const filtersDropdownContainer = BaseComponent => {
|
|
|
71
75
|
};
|
|
72
76
|
}
|
|
73
77
|
|
|
74
|
-
static getDerivedStateFromProps({
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
static getDerivedStateFromProps(_ref3, state) {
|
|
79
|
+
let {
|
|
80
|
+
filters
|
|
81
|
+
} = _ref3;
|
|
82
|
+
|
|
77
83
|
if (_isEqual(filters, state.values)) {
|
|
78
84
|
return null;
|
|
79
85
|
}
|