@bundle-stats/ui 3.2.4-alpha.0 → 3.2.4
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 +2 -1
- package/lib/components/bundle-assets/bundle-assets.js +7 -9
- package/lib/components/bundle-assets/bundle-assets.module.css +0 -5
- package/lib/components/bundle-modules/bundle-modules.js +63 -34
- package/lib/components/bundle-modules/bundle-modules.module.css +4 -0
- package/lib/components/bundle-packages/bundle-packages.js +24 -29
- package/lib/components/bundle-packages/bundle-packages.module.css +20 -37
- package/lib/components/metrics-table-title/metrics-table-title.js +3 -7
- package/lib/components/summary-item/summary-item.js +18 -16
- package/lib/components/total-size-type-title/total-size-type-title.js +3 -7
- package/lib/ui/dropdown/dropdown.js +19 -15
- package/lib/ui/filters/filters.js +5 -3
- package/lib/ui/index.js +8 -8
- package/lib/ui/{hover-card → popover}/index.js +4 -4
- package/lib/ui/popover/popover.js +92 -0
- package/lib/ui/popover/popover.module.css +66 -0
- package/lib/ui/popover/popover.stories.js +26 -0
- package/lib/ui/sort-dropdown/sort-dropdown.js +5 -2
- package/lib/ui/tooltip/tooltip.js +14 -22
- package/lib/ui/tooltip/tooltip.module.css +3 -5
- package/lib-esm/components/bundle-assets/bundle-assets.js +7 -9
- package/lib-esm/components/bundle-assets/bundle-assets.module.css +0 -5
- package/lib-esm/components/bundle-modules/bundle-modules.js +29 -17
- package/lib-esm/components/bundle-modules/bundle-modules.module.css +4 -0
- package/lib-esm/components/bundle-packages/bundle-packages.js +23 -28
- package/lib-esm/components/bundle-packages/bundle-packages.module.css +20 -37
- package/lib-esm/components/metrics-table-title/metrics-table-title.js +3 -6
- package/lib-esm/components/summary-item/summary-item.js +18 -15
- package/lib-esm/components/total-size-type-title/total-size-type-title.js +3 -6
- package/lib-esm/ui/dropdown/dropdown.js +19 -9
- package/lib-esm/ui/filters/filters.js +5 -3
- package/lib-esm/ui/index.js +1 -1
- package/lib-esm/ui/popover/index.js +1 -0
- package/lib-esm/ui/popover/popover.js +71 -0
- package/lib-esm/ui/popover/popover.module.css +66 -0
- package/lib-esm/ui/popover/popover.stories.js +14 -0
- package/lib-esm/ui/sort-dropdown/sort-dropdown.js +5 -2
- package/lib-esm/ui/tooltip/tooltip.js +14 -15
- package/lib-esm/ui/tooltip/tooltip.module.css +3 -5
- package/package.json +4 -7
- package/src/components/bundle-assets/bundle-assets.jsx +42 -51
- package/src/components/bundle-assets/bundle-assets.module.css +0 -5
- package/src/components/bundle-modules/bundle-modules.jsx +31 -28
- package/src/components/bundle-modules/bundle-modules.module.css +4 -0
- package/src/components/bundle-packages/bundle-packages.jsx +25 -31
- package/src/components/bundle-packages/bundle-packages.module.css +20 -37
- package/src/components/metrics-table-options/metrics-table-options.jsx +1 -1
- package/src/components/metrics-table-title/metrics-table-title.jsx +3 -4
- package/src/components/summary-item/summary-item.jsx +26 -21
- package/src/components/total-size-type-title/total-size-type-title.jsx +9 -6
- package/src/ui/dropdown/dropdown.jsx +18 -14
- package/src/ui/filters/filters.jsx +39 -30
- package/src/ui/index.js +1 -1
- package/src/ui/popover/index.js +1 -0
- package/src/ui/popover/popover.jsx +79 -0
- package/src/ui/popover/popover.module.css +66 -0
- package/src/ui/sort-dropdown/sort-dropdown.jsx +11 -9
- package/src/ui/tooltip/tooltip.jsx +27 -20
- package/src/ui/tooltip/tooltip.module.css +3 -5
- package/lib/ui/hover-card/hover-card.js +0 -65
- package/lib/ui/hover-card/hover-card.module.css +0 -29
- package/lib/ui/hover-card/hover-card.stories.js +0 -26
- package/lib-esm/ui/hover-card/hover-card.js +0 -45
- package/lib-esm/ui/hover-card/hover-card.module.css +0 -29
- package/lib-esm/ui/hover-card/hover-card.stories.js +0 -9
- package/lib-esm/ui/hover-card/index.js +0 -1
- package/src/ui/hover-card/hover-card.jsx +0 -42
- package/src/ui/hover-card/hover-card.module.css +0 -29
- package/src/ui/hover-card/index.js +0 -1
|
@@ -12,8 +12,20 @@
|
|
|
12
12
|
margin-right: -1px; /** collapse border */
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
.
|
|
16
|
-
|
|
15
|
+
.duplicate {
|
|
16
|
+
margin-right: var(--space-xxxsmall);
|
|
17
|
+
display: inline-block;
|
|
18
|
+
width: var(--space-small);
|
|
19
|
+
height: var(--space-small);
|
|
20
|
+
font-size: 10px;
|
|
21
|
+
font-weight: bold;
|
|
22
|
+
line-height: var(--space-small);
|
|
23
|
+
text-align: center;
|
|
24
|
+
text-transform: uppercase;
|
|
25
|
+
vertical-align: middle;
|
|
26
|
+
|
|
27
|
+
background: var(--color-danger);
|
|
28
|
+
color: var(--color-light);
|
|
17
29
|
}
|
|
18
30
|
|
|
19
31
|
.packageName {
|
|
@@ -26,56 +38,27 @@
|
|
|
26
38
|
|
|
27
39
|
.packageName + .packageName::before {
|
|
28
40
|
display: inline-block;
|
|
29
|
-
margin: 0 var(--space-xxxsmall)
|
|
41
|
+
margin: 0 var(--space-xxxsmall);
|
|
30
42
|
content: '/';
|
|
31
43
|
color: var(--color-text-ultra-light);
|
|
32
44
|
}
|
|
33
45
|
|
|
34
|
-
.
|
|
35
|
-
|
|
36
|
-
align-items: center;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.packageNameDuplicate {
|
|
40
|
-
margin-right: var(--space-xxxsmall);
|
|
41
|
-
display: inline-block;
|
|
42
|
-
width: var(--space-xsmall);
|
|
43
|
-
height: var(--space-xsmall);
|
|
44
|
-
font-size: 8px;
|
|
45
|
-
font-weight: bold;
|
|
46
|
-
line-height: var(--space-xsmall);
|
|
47
|
-
text-align: center;
|
|
48
|
-
text-transform: uppercase;
|
|
49
|
-
vertical-align: middle;
|
|
50
|
-
|
|
51
|
-
background: var(--color-danger);
|
|
52
|
-
color: var(--color-light);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.packageName:hover,
|
|
56
|
-
.packageName:active,
|
|
57
|
-
.packageName:focus {
|
|
58
|
-
text-decoration: none !important;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.packageName:hover .packageNameText,
|
|
62
|
-
.packageName:active .packageNameText,
|
|
63
|
-
.packageName:focus .packageNameText {
|
|
64
|
-
text-decoration: underline !important;
|
|
46
|
+
.packagePopover {
|
|
47
|
+
min-width: 320px;
|
|
65
48
|
}
|
|
66
49
|
|
|
67
|
-
.
|
|
50
|
+
.packagePopoverTitleIndex {
|
|
68
51
|
color: var(--color-text-light);
|
|
69
52
|
font-weight: normal;
|
|
70
53
|
}
|
|
71
54
|
|
|
72
|
-
.
|
|
55
|
+
.packagePopoverPathValue {
|
|
73
56
|
padding: var(--space-xxxsmall);
|
|
74
57
|
background: var(--color-highlight-warning);
|
|
75
58
|
font-family: var(--font-family-monospace);
|
|
76
59
|
}
|
|
77
60
|
|
|
78
|
-
.
|
|
61
|
+
.packagePopoverList {
|
|
79
62
|
padding: 0;
|
|
80
63
|
list-style: inside;
|
|
81
64
|
}
|
|
@@ -4,8 +4,7 @@ import cx from 'classnames';
|
|
|
4
4
|
import I18N from '../../i18n';
|
|
5
5
|
import { FlexStack } from '../../layout/flex-stack';
|
|
6
6
|
import { Stack } from '../../layout/stack';
|
|
7
|
-
import {
|
|
8
|
-
import { HoverCard } from '../../ui/hover-card';
|
|
7
|
+
import { Popover } from '../../ui/popover';
|
|
9
8
|
import css from './metrics-table-title.module.css';
|
|
10
9
|
export const MetricsTableTitle = props => {
|
|
11
10
|
const {
|
|
@@ -23,10 +22,8 @@ export const MetricsTableTitle = props => {
|
|
|
23
22
|
space: "xxxsmall"
|
|
24
23
|
}, /*#__PURE__*/React.createElement("span", null, title), info && /*#__PURE__*/React.createElement("span", {
|
|
25
24
|
className: css.info
|
|
26
|
-
}, info), (popoverInfo || popoverHref) && /*#__PURE__*/React.createElement(
|
|
27
|
-
|
|
28
|
-
glyph: "help"
|
|
29
|
-
})
|
|
25
|
+
}, info), (popoverInfo || popoverHref) && /*#__PURE__*/React.createElement(Popover, {
|
|
26
|
+
icon: "help"
|
|
30
27
|
}, /*#__PURE__*/React.createElement(Stack, {
|
|
31
28
|
space: "xxxsmall"
|
|
32
29
|
}, popoverInfo && /*#__PURE__*/React.createElement("p", null, popoverInfo), popoverHref && /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("a", {
|
|
@@ -4,8 +4,7 @@ import React from 'react';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import cx from 'classnames';
|
|
6
6
|
import { getGlobalMetricType, getMetricRunInfo } from '@bundle-stats/utils';
|
|
7
|
-
import {
|
|
8
|
-
import { HoverCard } from '../../ui/hover-card';
|
|
7
|
+
import { Popover } from '../../ui/popover';
|
|
9
8
|
import { Skeleton } from '../../ui/skeleton';
|
|
10
9
|
import { Stack } from '../../layout/stack';
|
|
11
10
|
import { FlexStack } from '../../layout/flex-stack';
|
|
@@ -13,25 +12,31 @@ import { Metric } from '../metric';
|
|
|
13
12
|
import { Delta } from '../delta';
|
|
14
13
|
import css from './summary-item.module.css';
|
|
15
14
|
|
|
16
|
-
const
|
|
15
|
+
const MetricInfoPopover = _ref => {
|
|
17
16
|
let {
|
|
18
17
|
description,
|
|
19
18
|
url
|
|
20
19
|
} = _ref;
|
|
20
|
+
|
|
21
|
+
// Workaround cases where the parent is a link
|
|
22
|
+
const readMoreOnClick = () => {
|
|
23
|
+
window.open(url);
|
|
24
|
+
};
|
|
25
|
+
|
|
21
26
|
return /*#__PURE__*/React.createElement(Stack, {
|
|
22
|
-
space: "
|
|
23
|
-
}, /*#__PURE__*/React.createElement("p", null, description), url && /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
space: "xxxsmall"
|
|
28
|
+
}, /*#__PURE__*/React.createElement("p", null, description), url && /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("button", {
|
|
29
|
+
type: "button",
|
|
30
|
+
className: css.readMoreBtn,
|
|
31
|
+
onClick: readMoreOnClick
|
|
27
32
|
}, "Read more")));
|
|
28
33
|
};
|
|
29
34
|
|
|
30
|
-
|
|
35
|
+
MetricInfoPopover.propTypes = {
|
|
31
36
|
description: PropTypes.string.isRequired,
|
|
32
37
|
url: PropTypes.string
|
|
33
38
|
};
|
|
34
|
-
|
|
39
|
+
MetricInfoPopover.defaultProps = {
|
|
35
40
|
url: ''
|
|
36
41
|
};
|
|
37
42
|
export const SummaryItem = _ref2 => {
|
|
@@ -65,12 +70,10 @@ export const SummaryItem = _ref2 => {
|
|
|
65
70
|
as: "h3",
|
|
66
71
|
space: "xxxsmall",
|
|
67
72
|
className: css.title
|
|
68
|
-
}, /*#__PURE__*/React.createElement("span", null, metric.label), showMetricDescriptionTooltip && /*#__PURE__*/React.createElement(
|
|
73
|
+
}, /*#__PURE__*/React.createElement("span", null, metric.label), showMetricDescriptionTooltip && /*#__PURE__*/React.createElement(Popover, {
|
|
69
74
|
className: css.icon,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
})
|
|
73
|
-
}, /*#__PURE__*/React.createElement(MetricDescriptionCard, metric))), !loading ? /*#__PURE__*/React.createElement(Stack, null, /*#__PURE__*/React.createElement(Metric, {
|
|
75
|
+
icon: "help"
|
|
76
|
+
}, /*#__PURE__*/React.createElement(MetricInfoPopover, metric))), !loading ? /*#__PURE__*/React.createElement(Stack, null, /*#__PURE__*/React.createElement(Metric, {
|
|
74
77
|
className: css.currentMetric,
|
|
75
78
|
value: current,
|
|
76
79
|
formatter: metric.formatter,
|
|
@@ -5,8 +5,7 @@ import config from '../../config.json';
|
|
|
5
5
|
import I18N from '../../i18n';
|
|
6
6
|
import { FlexStack } from '../../layout/flex-stack';
|
|
7
7
|
import { Stack } from '../../layout/stack';
|
|
8
|
-
import {
|
|
9
|
-
import { HoverCard } from '../../ui/hover-card';
|
|
8
|
+
import { Popover } from '../../ui/popover';
|
|
10
9
|
import css from './total-size-type-title.module.css';
|
|
11
10
|
export const TotalSizeTypeTitle = _ref => {
|
|
12
11
|
let {
|
|
@@ -15,10 +14,8 @@ export const TotalSizeTypeTitle = _ref => {
|
|
|
15
14
|
return /*#__PURE__*/React.createElement(FlexStack, {
|
|
16
15
|
space: "xxxsmall",
|
|
17
16
|
className: cx(css.title, className)
|
|
18
|
-
}, /*#__PURE__*/React.createElement("span", null, I18N.ASSET_TOTALS), /*#__PURE__*/React.createElement(
|
|
19
|
-
|
|
20
|
-
glyph: "help"
|
|
21
|
-
})
|
|
17
|
+
}, /*#__PURE__*/React.createElement("span", null, I18N.ASSET_TOTALS), /*#__PURE__*/React.createElement(Popover, {
|
|
18
|
+
icon: "help"
|
|
22
19
|
}, /*#__PURE__*/React.createElement(Stack, {
|
|
23
20
|
space: "xxxsmall"
|
|
24
21
|
}, /*#__PURE__*/React.createElement("p", null, I18N.ASSET_TOTALS_INFO), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("a", {
|
|
@@ -1,7 +1,9 @@
|
|
|
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
|
+
|
|
1
3
|
import React from 'react';
|
|
2
4
|
import PropTypes from 'prop-types';
|
|
3
5
|
import cx from 'classnames';
|
|
4
|
-
import
|
|
6
|
+
import { Menu, MenuItem, MenuButton, useMenuState } from 'reakit/Menu';
|
|
5
7
|
import { FlexStack } from '../../layout/flex-stack';
|
|
6
8
|
import { Icon } from '../icon';
|
|
7
9
|
import css from './dropdown.module.css';
|
|
@@ -15,20 +17,25 @@ export const Dropdown = props => {
|
|
|
15
17
|
children
|
|
16
18
|
} = props;
|
|
17
19
|
const rootClassName = cx(css.root, activeLabel && css.activeLabel, className);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
const menu = useMenuState({
|
|
21
|
+
baseId: process.env.NODE_ENV === 'test' && 'id-test',
|
|
22
|
+
modal: true
|
|
23
|
+
});
|
|
24
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MenuButton, _extends({}, menu, {
|
|
25
|
+
className: rootClassName,
|
|
26
|
+
tabIndex: null
|
|
27
|
+
}), /*#__PURE__*/React.createElement(FlexStack, {
|
|
21
28
|
space: "xxxsmall",
|
|
22
29
|
className: css.label
|
|
23
30
|
}, glyph && /*#__PURE__*/React.createElement(Icon, {
|
|
24
31
|
className: css.labelIcon,
|
|
25
32
|
glyph: glyph
|
|
26
|
-
}), label)), /*#__PURE__*/React.createElement(
|
|
27
|
-
className: css.dropdown,
|
|
33
|
+
}), label)), /*#__PURE__*/React.createElement(Menu, _extends({}, menu, {
|
|
28
34
|
"aria-label": ariaLabel || label,
|
|
29
|
-
|
|
30
|
-
}, typeof children === 'function' ? children({
|
|
31
|
-
MenuItem
|
|
35
|
+
className: css.dropdown
|
|
36
|
+
}), typeof children === 'function' ? children({
|
|
37
|
+
MenuItem,
|
|
38
|
+
menu,
|
|
32
39
|
menuItemClassName: css.menuItem,
|
|
33
40
|
menuItemActiveClassName: css.menuItemActive
|
|
34
41
|
}) : children));
|
|
@@ -53,6 +60,9 @@ Dropdown.propTypes = {
|
|
|
53
60
|
/** Icon glyph */
|
|
54
61
|
glyph: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
55
62
|
|
|
63
|
+
/** Dropdown open state */
|
|
64
|
+
open: PropTypes.bool.isRequired,
|
|
65
|
+
|
|
56
66
|
/** Active label flag */
|
|
57
67
|
activeLabel: PropTypes.bool,
|
|
58
68
|
|
|
@@ -103,6 +103,7 @@ const FilterGroup = props => {
|
|
|
103
103
|
}, _ref4 => {
|
|
104
104
|
let {
|
|
105
105
|
MenuItem,
|
|
106
|
+
menu,
|
|
106
107
|
menuItemClassName
|
|
107
108
|
} = _ref4;
|
|
108
109
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
@@ -115,10 +116,11 @@ const FilterGroup = props => {
|
|
|
115
116
|
[id]: true
|
|
116
117
|
});
|
|
117
118
|
|
|
118
|
-
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
119
|
-
key: id
|
|
119
|
+
return /*#__PURE__*/React.createElement(MenuItem, _extends({
|
|
120
|
+
key: id
|
|
121
|
+
}, menu, {
|
|
120
122
|
className: cx(menuItemClassName, css.filterGroupItem)
|
|
121
|
-
}, /*#__PURE__*/React.createElement(Filter, {
|
|
123
|
+
}), /*#__PURE__*/React.createElement(Filter, {
|
|
122
124
|
name: id,
|
|
123
125
|
label: itemData.label,
|
|
124
126
|
onChange: onCheckboxChange,
|
package/lib-esm/ui/index.js
CHANGED
|
@@ -7,10 +7,10 @@ export { Filters } from './filters';
|
|
|
7
7
|
export { HorizontalBarChart } from './horizontal-bar-chart';
|
|
8
8
|
export { Icon } from './icon';
|
|
9
9
|
export { Input } from './input';
|
|
10
|
-
export { HoverCard } from './hover-card';
|
|
11
10
|
export { Loader } from './loader';
|
|
12
11
|
export { Logo } from './logo';
|
|
13
12
|
export { Panels } from './panels';
|
|
13
|
+
export { Popover } from './popover';
|
|
14
14
|
export { Skeleton } from './skeleton';
|
|
15
15
|
export { SortDropdown } from './sort-dropdown';
|
|
16
16
|
export { Table } from './table';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './popover';
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
|
|
3
|
+
import React, { useCallback } from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import cx from 'classnames';
|
|
6
|
+
import { usePopoverState, Popover as UIPopover, PopoverDisclosure as UIPopoverDisclosure, PopoverArrow as UIPopoverArrow } from 'reakit/Popover';
|
|
7
|
+
import { Icon } from '../icon';
|
|
8
|
+
import css from './popover.module.css';
|
|
9
|
+
export const Popover = _ref => {
|
|
10
|
+
let {
|
|
11
|
+
className,
|
|
12
|
+
icon,
|
|
13
|
+
label,
|
|
14
|
+
ariaLabel,
|
|
15
|
+
children
|
|
16
|
+
} = _ref;
|
|
17
|
+
const popover = usePopoverState({
|
|
18
|
+
baseId: process.env.NODE_ENV === 'test' && 'id-test',
|
|
19
|
+
gutter: 12,
|
|
20
|
+
modal: true,
|
|
21
|
+
placement: 'top'
|
|
22
|
+
});
|
|
23
|
+
const onCloseButtonClick = useCallback(event => {
|
|
24
|
+
event.preventDefault();
|
|
25
|
+
popover.toggle();
|
|
26
|
+
}, [popover]);
|
|
27
|
+
const onButtonClick = useCallback(event => {
|
|
28
|
+
event.preventDefault();
|
|
29
|
+
popover.toggle();
|
|
30
|
+
}, [popover]);
|
|
31
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(UIPopoverDisclosure, _extends({
|
|
32
|
+
className: cx(css.button, className)
|
|
33
|
+
}, popover, {
|
|
34
|
+
onClick: onButtonClick,
|
|
35
|
+
"aria-label": ariaLabel
|
|
36
|
+
}), icon && (typeof icon === 'string' ? /*#__PURE__*/React.createElement(Icon, {
|
|
37
|
+
className: css.icon,
|
|
38
|
+
glyph: icon
|
|
39
|
+
}) : icon), label && /*#__PURE__*/React.createElement("span", {
|
|
40
|
+
className: css.label
|
|
41
|
+
}, label)), /*#__PURE__*/React.createElement(UIPopover, _extends({
|
|
42
|
+
className: css.popover
|
|
43
|
+
}, popover, {
|
|
44
|
+
tabIndex: 0
|
|
45
|
+
}), /*#__PURE__*/React.createElement(UIPopoverArrow, _extends({
|
|
46
|
+
className: css.arrow
|
|
47
|
+
}, popover, {
|
|
48
|
+
size: 16
|
|
49
|
+
})), typeof children === 'function' ? children({
|
|
50
|
+
popoverToggle: popover.toggle
|
|
51
|
+
}) : children, /*#__PURE__*/React.createElement(Icon, {
|
|
52
|
+
glyph: "close",
|
|
53
|
+
as: "button",
|
|
54
|
+
type: "button",
|
|
55
|
+
className: css.closeBtn,
|
|
56
|
+
onClick: onCloseButtonClick
|
|
57
|
+
})));
|
|
58
|
+
};
|
|
59
|
+
Popover.propTypes = {
|
|
60
|
+
className: PropTypes.string,
|
|
61
|
+
label: PropTypes.element,
|
|
62
|
+
icon: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
63
|
+
children: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.func]).isRequired,
|
|
64
|
+
ariaLabel: PropTypes.string
|
|
65
|
+
};
|
|
66
|
+
Popover.defaultProps = {
|
|
67
|
+
className: '',
|
|
68
|
+
icon: '',
|
|
69
|
+
label: '',
|
|
70
|
+
ariaLabel: 'View more info'
|
|
71
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
.button {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: flex-start;
|
|
5
|
+
border: none;
|
|
6
|
+
outline: none;
|
|
7
|
+
padding: 0;
|
|
8
|
+
background: none;
|
|
9
|
+
color: inherit;
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
line-height: inherit;
|
|
12
|
+
text-align: inherit;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.button:hover,
|
|
16
|
+
.button:active,
|
|
17
|
+
.button:focus {
|
|
18
|
+
color: var(--color-primary);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.button:hover .label {
|
|
22
|
+
text-decoration: underline;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.popover {
|
|
26
|
+
padding: var(--space-small) var(--space-large) var(--space-small) var(--space-small);
|
|
27
|
+
border-radius: var(--radius-small);
|
|
28
|
+
max-width: 360px;
|
|
29
|
+
outline: none;
|
|
30
|
+
filter: drop-shadow(0 0 var(--space-xxxsmall) var(--color-shadow));
|
|
31
|
+
background: var(--color-light);
|
|
32
|
+
font-size: var(--size-small);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.arrow svg {
|
|
36
|
+
display: block;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.arrow :global .fill {
|
|
40
|
+
fill: var(--color-light);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.arrow :global .stroke {
|
|
44
|
+
fill: var(--color-light);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.closeBtn {
|
|
48
|
+
position: absolute;
|
|
49
|
+
right: 0;
|
|
50
|
+
top: 0;
|
|
51
|
+
width: var(--space-large);
|
|
52
|
+
height: var(--space-large);
|
|
53
|
+
padding: var(--space-xxsmall);
|
|
54
|
+
background: none;
|
|
55
|
+
border: none;
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
color: var(--color-text-ultra-light);
|
|
58
|
+
transition: var(--transition-out);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.closeBtn:hover,
|
|
62
|
+
.closeBtn:active,
|
|
63
|
+
.closeBtn:focus {
|
|
64
|
+
color: var(--color-text-light);
|
|
65
|
+
transition: var(--transition-in);
|
|
66
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { storiesOf } from '@storybook/react';
|
|
3
|
+
import { getWrapperDecorator } from '../../stories';
|
|
4
|
+
import { Popover } from '.';
|
|
5
|
+
const stories = storiesOf('UI/Popover', module);
|
|
6
|
+
stories.addDecorator(getWrapperDecorator({
|
|
7
|
+
padding: '64px'
|
|
8
|
+
}));
|
|
9
|
+
stories.add('default', () => /*#__PURE__*/React.createElement(Popover, {
|
|
10
|
+
label: "Job #100"
|
|
11
|
+
}, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."));
|
|
12
|
+
stories.add('with icon', () => /*#__PURE__*/React.createElement(Popover, {
|
|
13
|
+
icon: "help"
|
|
14
|
+
}, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."));
|
|
@@ -20,10 +20,12 @@ export const SortDropdown = props => {
|
|
|
20
20
|
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
21
21
|
className: rootClassName,
|
|
22
22
|
label: customLabel,
|
|
23
|
-
glyph: "sort"
|
|
23
|
+
glyph: "sort",
|
|
24
|
+
align: "right"
|
|
24
25
|
}, _ref => {
|
|
25
26
|
let {
|
|
26
27
|
MenuItem,
|
|
28
|
+
menu,
|
|
27
29
|
menuItemClassName,
|
|
28
30
|
menuItemActiveClassName
|
|
29
31
|
} = _ref;
|
|
@@ -33,6 +35,7 @@ export const SortDropdown = props => {
|
|
|
33
35
|
field: newField,
|
|
34
36
|
direction: newDirection
|
|
35
37
|
});
|
|
38
|
+
menu.toggle();
|
|
36
39
|
};
|
|
37
40
|
|
|
38
41
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -50,7 +53,7 @@ export const SortDropdown = props => {
|
|
|
50
53
|
const isActive = field === key;
|
|
51
54
|
return /*#__PURE__*/React.createElement(MenuItem, _extends({
|
|
52
55
|
key: key
|
|
53
|
-
}, buttonProps, {
|
|
56
|
+
}, menu, buttonProps, {
|
|
54
57
|
className: cx(buttonProps.className, menuItemClassName, css.item, isActive && menuItemActiveClassName, isActive && css.active)
|
|
55
58
|
}), /*#__PURE__*/React.createElement("span", {
|
|
56
59
|
className: css.itemLabel
|
|
@@ -3,10 +3,8 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import cx from 'classnames';
|
|
6
|
-
import
|
|
6
|
+
import { Tooltip as UITooltip, TooltipArrow as UITooltipArrow, TooltipReference as UITooltipReference, useTooltipState } from 'reakit/Tooltip';
|
|
7
7
|
import css from './tooltip.module.css';
|
|
8
|
-
const OFFSET = 9;
|
|
9
|
-
const DELAY = 200;
|
|
10
8
|
export const Tooltip = props => {
|
|
11
9
|
const {
|
|
12
10
|
className,
|
|
@@ -18,20 +16,21 @@ export const Tooltip = props => {
|
|
|
18
16
|
...restProps
|
|
19
17
|
} = props;
|
|
20
18
|
const rootClassName = cx(css.root, className);
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
const tooltipProps = useTooltipState({
|
|
20
|
+
baseId: process.env.NODE_ENV === 'test' && 'id-test',
|
|
21
|
+
placement: 'top'
|
|
22
|
+
});
|
|
23
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(UITooltipReference, _extends({
|
|
24
|
+
as: Component,
|
|
27
25
|
className: rootClassName
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
}, /*#__PURE__*/React.createElement(
|
|
26
|
+
}, ref ? {
|
|
27
|
+
ref
|
|
28
|
+
} : {}, restProps, tooltipProps), children), title && /*#__PURE__*/React.createElement(UITooltip, _extends({}, tooltipProps, {
|
|
29
|
+
className: cx(css.tooltip, darkMode && css.tooltipDarkMode)
|
|
30
|
+
}), /*#__PURE__*/React.createElement(UITooltipArrow, _extends({}, tooltipProps, {
|
|
31
31
|
className: css.arrow,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}), title)));
|
|
32
|
+
size: 12
|
|
33
|
+
})), title));
|
|
35
34
|
};
|
|
36
35
|
Tooltip.defaultProps = {
|
|
37
36
|
className: '',
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
.root {
|
|
2
|
-
appearance: none;
|
|
3
|
-
border: none;
|
|
4
|
-
background: none;
|
|
5
2
|
position: relative;
|
|
6
3
|
color: inherit;
|
|
7
4
|
line-height: inherit;
|
|
@@ -23,7 +20,8 @@
|
|
|
23
20
|
line-height: var(--space-small);
|
|
24
21
|
}
|
|
25
22
|
|
|
26
|
-
.arrow {
|
|
23
|
+
.arrow svg {
|
|
24
|
+
display: block;
|
|
27
25
|
fill: var(--color-light);
|
|
28
26
|
}
|
|
29
27
|
|
|
@@ -32,6 +30,6 @@
|
|
|
32
30
|
color: var(--color-light);
|
|
33
31
|
}
|
|
34
32
|
|
|
35
|
-
.tooltipDarkMode .arrow {
|
|
33
|
+
.tooltipDarkMode .arrow svg {
|
|
36
34
|
fill: var(--color-text);
|
|
37
35
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bundle-stats/ui",
|
|
3
|
-
"version": "3.2.4
|
|
3
|
+
"version": "3.2.4",
|
|
4
4
|
"description": "UI components for BundleStats projects.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-esm/index.js",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"classnames": "2.2.6",
|
|
79
|
-
"core-js": "3.
|
|
79
|
+
"core-js": "3.20.2",
|
|
80
80
|
"lodash": "4.17.21",
|
|
81
81
|
"prop-types": "15.7.2",
|
|
82
82
|
"react": "16.14.0",
|
|
@@ -84,14 +84,11 @@
|
|
|
84
84
|
"react-router-dom": "5.3.0"
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@bundle-stats/utils": "^3.2.4
|
|
88
|
-
"@radix-ui/react-dropdown-menu": "0.1.3",
|
|
89
|
-
"@radix-ui/react-hover-card": "0.1.3",
|
|
90
|
-
"@radix-ui/react-tooltip": "0.1.3",
|
|
87
|
+
"@bundle-stats/utils": "^3.2.4",
|
|
91
88
|
"date-fns": "2.28.0",
|
|
92
89
|
"query-string": "7.1.0",
|
|
93
90
|
"reakit": "1.3.11",
|
|
94
91
|
"use-query-params": "1.2.3"
|
|
95
92
|
},
|
|
96
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "1c72cc1819a7fbee11ff8ad48218f943f69cb704"
|
|
97
94
|
}
|