@bundle-stats/ui 3.3.0-alpha.1 → 3.4.0-alpha.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 +65 -13
- package/lib/app/app.js +137 -102
- package/lib/app/app.module.css +11 -4
- package/lib/app/header/header.js +1 -10
- package/lib/components/asset-info/asset-info.module.css +1 -0
- package/lib/components/bundle-assets/bundle-assets.js +104 -52
- package/lib/components/bundle-assets/bundle-assets.module.css +24 -26
- package/lib/components/bundle-assets-totals-table/bundle-assets-totals-table.js +13 -3
- package/lib/components/bundle-modules/bundle-modules.js +68 -68
- package/lib/components/bundle-modules/bundle-modules.module.css +11 -2
- package/lib/components/bundle-modules/bundle-modules.utils.js +14 -10
- package/lib/components/bundle-modules/index.js +4 -4
- package/lib/components/bundle-packages/bundle-packages.js +100 -44
- package/lib/components/bundle-packages/bundle-packages.module.css +17 -21
- package/lib/components/delta/delta.module.css +1 -0
- 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/metrics-table.js +72 -59
- package/lib/components/metrics-table/metrics-table.module.css +18 -7
- package/lib/components/metrics-table-search/metrics-table-search.module.css +5 -4
- package/lib/components/metrics-table-title/metrics-table-title.js +9 -7
- package/lib/components/metrics-table-title/metrics-table-title.module.css +2 -0
- package/lib/components/module-info/module-info.js +2 -2
- package/lib/components/module-info/module-info.module.css +1 -0
- package/lib/components/summary/summary.js +1 -1
- package/lib/components/summary-item/summary-item.js +15 -18
- package/lib/components/summary-item/summary-item.module.css +1 -23
- package/lib/components/total-size-type-title/total-size-type-title.js +7 -3
- package/lib/constants.js +1 -1
- package/lib/css/default.css +14 -3
- package/lib/css/variables.css +17 -17
- package/lib/hooks/search-params.js +31 -31
- package/lib/layout/box/box.module.css +9 -0
- package/lib/layout/footer/footer.module.css +1 -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 +21 -26
- package/lib/ui/dropdown/dropdown.module.css +11 -12
- package/lib/ui/dropdown/dropdown.stories.js +2 -9
- package/lib/ui/empty-set/empty-set.js +5 -4
- package/lib/ui/empty-set/empty-set.module.css +2 -2
- package/lib/ui/filters/filters.container.js +1 -1
- package/lib/ui/filters/filters.js +22 -7
- package/lib/ui/filters/filters.module.css +3 -3
- package/lib/ui/horizontal-bar-chart/horizontal-bar-chart.js +1 -1
- package/lib/ui/hover-card/hover-card.js +102 -0
- package/lib/ui/hover-card/hover-card.module.css +29 -0
- package/lib/ui/hover-card/hover-card.stories.js +56 -0
- package/lib/ui/hover-card/index.js +18 -0
- package/lib/ui/icon/icon.js +6 -6
- package/lib/ui/icon/icon.module.css +1 -0
- package/lib/ui/index.js +8 -8
- package/lib/ui/table/table.js +5 -74
- package/lib/ui/table/table.module.css +41 -25
- package/lib/ui/table/table.stories.js +1 -1
- package/lib/ui/{popover → tag}/index.js +4 -4
- package/lib/ui/tag/tag.js +72 -0
- package/lib/ui/tag/tag.module.css +55 -0
- package/lib/ui/tag/tag.stories.js +38 -0
- package/lib/ui/tooltip/tooltip.js +10 -9
- package/lib/ui/tooltip/tooltip.module.css +2 -1
- package/lib-esm/app/app.js +132 -102
- package/lib-esm/app/app.module.css +11 -4
- package/lib-esm/app/header/header.js +1 -9
- package/lib-esm/components/asset-info/asset-info.module.css +1 -0
- package/lib-esm/components/bundle-assets/bundle-assets.js +97 -56
- package/lib-esm/components/bundle-assets/bundle-assets.module.css +24 -26
- package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.js +7 -3
- package/lib-esm/components/bundle-modules/bundle-modules.js +50 -51
- package/lib-esm/components/bundle-modules/bundle-modules.module.css +11 -2
- package/lib-esm/components/bundle-modules/bundle-modules.utils.js +14 -6
- package/lib-esm/components/bundle-modules/index.js +5 -3
- package/lib-esm/components/bundle-packages/bundle-packages.js +88 -41
- package/lib-esm/components/bundle-packages/bundle-packages.module.css +17 -21
- package/lib-esm/components/delta/delta.module.css +1 -0
- 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/metrics-table.js +61 -53
- package/lib-esm/components/metrics-table/metrics-table.module.css +18 -7
- package/lib-esm/components/metrics-table-search/metrics-table-search.module.css +5 -4
- package/lib-esm/components/metrics-table-title/metrics-table-title.js +8 -7
- package/lib-esm/components/metrics-table-title/metrics-table-title.module.css +2 -0
- package/lib-esm/components/module-info/module-info.js +2 -2
- package/lib-esm/components/module-info/module-info.module.css +1 -0
- package/lib-esm/components/summary/summary.js +1 -1
- package/lib-esm/components/summary-item/summary-item.js +14 -18
- package/lib-esm/components/summary-item/summary-item.module.css +1 -23
- package/lib-esm/components/total-size-type-title/total-size-type-title.js +6 -3
- package/lib-esm/constants.js +1 -1
- package/lib-esm/css/default.css +14 -3
- package/lib-esm/css/variables.css +17 -17
- package/lib-esm/hooks/search-params.js +27 -28
- package/lib-esm/layout/box/box.module.css +9 -0
- package/lib-esm/layout/footer/footer.module.css +1 -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 +20 -25
- package/lib-esm/ui/dropdown/dropdown.module.css +11 -12
- package/lib-esm/ui/dropdown/dropdown.stories.js +2 -7
- package/lib-esm/ui/empty-set/empty-set.js +4 -4
- package/lib-esm/ui/empty-set/empty-set.module.css +2 -2
- package/lib-esm/ui/filters/filters.js +20 -5
- package/lib-esm/ui/filters/filters.module.css +3 -3
- package/lib-esm/ui/hover-card/hover-card.js +83 -0
- package/lib-esm/ui/hover-card/hover-card.module.css +29 -0
- package/lib-esm/ui/hover-card/hover-card.stories.js +35 -0
- package/lib-esm/ui/hover-card/index.js +1 -0
- package/lib-esm/ui/icon/icon.js +3 -3
- package/lib-esm/ui/icon/icon.module.css +1 -0
- package/lib-esm/ui/index.js +1 -1
- package/lib-esm/ui/table/table.js +5 -65
- package/lib-esm/ui/table/table.module.css +41 -25
- package/lib-esm/ui/table/table.stories.js +1 -1
- package/lib-esm/ui/tag/index.js +1 -0
- package/lib-esm/ui/tag/tag.js +45 -0
- package/lib-esm/ui/tag/tag.module.css +55 -0
- package/lib-esm/ui/tag/tag.stories.js +23 -0
- package/lib-esm/ui/tooltip/tooltip.js +10 -9
- package/lib-esm/ui/tooltip/tooltip.module.css +2 -1
- package/package.json +33 -31
- package/src/app/app.jsx +142 -145
- package/src/app/app.module.css +11 -4
- package/src/app/header/header.jsx +0 -10
- package/src/components/asset-info/asset-info.module.css +1 -0
- package/src/components/bundle-assets/bundle-assets.jsx +85 -31
- package/src/components/bundle-assets/bundle-assets.module.css +24 -26
- package/src/components/bundle-assets-totals-table/bundle-assets-totals-table.jsx +2 -0
- package/src/components/bundle-modules/bundle-modules.jsx +53 -36
- package/src/components/bundle-modules/bundle-modules.module.css +11 -2
- package/src/components/bundle-modules/bundle-modules.utils.js +16 -4
- package/src/components/bundle-modules/index.jsx +3 -0
- package/src/components/bundle-packages/bundle-packages.jsx +89 -39
- package/src/components/bundle-packages/bundle-packages.module.css +17 -21
- package/src/components/delta/delta.module.css +1 -0
- 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/metrics-table.jsx +53 -44
- package/src/components/metrics-table/metrics-table.module.css +18 -7
- package/src/components/metrics-table-search/metrics-table-search.module.css +5 -4
- package/src/components/metrics-table-title/metrics-table-title.jsx +20 -21
- package/src/components/metrics-table-title/metrics-table-title.module.css +2 -0
- package/src/components/module-info/module-info.jsx +3 -7
- package/src/components/module-info/module-info.module.css +1 -0
- package/src/components/summary/summary.jsx +1 -1
- package/src/components/summary-item/summary-item.jsx +21 -27
- package/src/components/summary-item/summary-item.module.css +1 -23
- package/src/components/total-size-type-title/total-size-type-title.jsx +6 -9
- package/src/constants.js +1 -1
- package/src/css/default.css +14 -3
- package/src/css/variables.css +17 -17
- package/src/hooks/search-params.js +42 -33
- package/src/layout/box/box.module.css +9 -0
- package/src/layout/footer/footer.module.css +1 -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 +16 -22
- package/src/ui/dropdown/dropdown.module.css +11 -12
- package/src/ui/empty-set/empty-set.jsx +25 -21
- package/src/ui/empty-set/empty-set.module.css +2 -2
- package/src/ui/filters/filters.jsx +64 -53
- package/src/ui/filters/filters.module.css +3 -3
- package/src/ui/hover-card/hover-card.jsx +73 -0
- package/src/ui/hover-card/hover-card.module.css +29 -0
- package/src/ui/hover-card/index.js +1 -0
- package/src/ui/icon/icon.jsx +11 -7
- package/src/ui/icon/icon.module.css +1 -0
- package/src/ui/index.js +1 -1
- package/src/ui/table/table.jsx +5 -52
- package/src/ui/table/table.module.css +41 -25
- package/src/ui/tag/index.js +1 -0
- package/src/ui/tag/tag.jsx +49 -0
- package/src/ui/tag/tag.module.css +55 -0
- package/src/ui/tooltip/tooltip.jsx +10 -14
- package/src/ui/tooltip/tooltip.module.css +2 -1
- package/lib/ui/popover/popover.js +0 -92
- package/lib/ui/popover/popover.module.css +0 -66
- package/lib/ui/popover/popover.stories.js +0 -26
- package/lib-esm/ui/popover/index.js +0 -1
- package/lib-esm/ui/popover/popover.js +0 -71
- package/lib-esm/ui/popover/popover.module.css +0 -66
- package/lib-esm/ui/popover/popover.stories.js +0 -14
- package/src/ui/popover/index.js +0 -1
- package/src/ui/popover/popover.jsx +0 -79
- package/src/ui/popover/popover.module.css +0 -66
|
@@ -3,10 +3,10 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
import {
|
|
5
5
|
Tooltip as UITooltip,
|
|
6
|
+
TooltipAnchor as UITooltipAnchor,
|
|
6
7
|
TooltipArrow as UITooltipArrow,
|
|
7
|
-
TooltipReference as UITooltipReference,
|
|
8
8
|
useTooltipState,
|
|
9
|
-
} from '
|
|
9
|
+
} from 'ariakit/tooltip';
|
|
10
10
|
|
|
11
11
|
import css from './tooltip.module.css';
|
|
12
12
|
|
|
@@ -21,26 +21,22 @@ export const Tooltip = (props) => {
|
|
|
21
21
|
...restProps
|
|
22
22
|
} = props;
|
|
23
23
|
|
|
24
|
-
const
|
|
25
|
-
const tooltipProps = useTooltipState({
|
|
26
|
-
baseId: process.env.NODE_ENV === 'test' && 'id-test',
|
|
27
|
-
placement: 'top',
|
|
28
|
-
});
|
|
24
|
+
const tooltip = useTooltipState({ placement: 'top' });
|
|
29
25
|
|
|
30
26
|
return (
|
|
31
27
|
<>
|
|
32
|
-
<
|
|
28
|
+
<UITooltipAnchor
|
|
33
29
|
as={Component}
|
|
34
|
-
className={
|
|
35
|
-
{
|
|
30
|
+
className={cx(css.root, className)}
|
|
31
|
+
state={tooltip}
|
|
32
|
+
{...(ref ? { ref } : {})}
|
|
36
33
|
{...restProps}
|
|
37
|
-
{...tooltipProps}
|
|
38
34
|
>
|
|
39
35
|
{children}
|
|
40
|
-
</
|
|
36
|
+
</UITooltipAnchor>
|
|
41
37
|
{title && (
|
|
42
|
-
<UITooltip {
|
|
43
|
-
<UITooltipArrow {
|
|
38
|
+
<UITooltip state={tooltip} className={cx(css.tooltip, darkMode && css.tooltipDarkMode)}>
|
|
39
|
+
<UITooltipArrow state={tooltip} className={css.arrow} size={12} />
|
|
44
40
|
{title}
|
|
45
41
|
</UITooltip>
|
|
46
42
|
)}
|
|
@@ -12,10 +12,11 @@
|
|
|
12
12
|
|
|
13
13
|
.tooltip {
|
|
14
14
|
padding: var(--space-xxxsmall) var(--space-xxsmall);
|
|
15
|
-
border-radius: var(--radius-
|
|
15
|
+
border-radius: var(--radius-medium);
|
|
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));
|
|
19
|
+
will-change: filter;
|
|
19
20
|
font-size: var(--size-xsmall);
|
|
20
21
|
line-height: var(--space-small);
|
|
21
22
|
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.Popover = void 0;
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
-
|
|
16
|
-
var _Popover = require("reakit/Popover");
|
|
17
|
-
|
|
18
|
-
var _icon = require("../icon");
|
|
19
|
-
|
|
20
|
-
var _popoverModule = _interopRequireDefault(require("./popover.module.css"));
|
|
21
|
-
|
|
22
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
|
-
|
|
24
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
-
|
|
26
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
-
|
|
28
|
-
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); }
|
|
29
|
-
|
|
30
|
-
var Popover = function Popover(_ref) {
|
|
31
|
-
var className = _ref.className,
|
|
32
|
-
icon = _ref.icon,
|
|
33
|
-
label = _ref.label,
|
|
34
|
-
ariaLabel = _ref.ariaLabel,
|
|
35
|
-
children = _ref.children;
|
|
36
|
-
var popover = (0, _Popover.usePopoverState)({
|
|
37
|
-
baseId: process.env.NODE_ENV === 'test' && 'id-test',
|
|
38
|
-
gutter: 12,
|
|
39
|
-
modal: true,
|
|
40
|
-
placement: 'top'
|
|
41
|
-
});
|
|
42
|
-
var onCloseButtonClick = (0, _react.useCallback)(function (event) {
|
|
43
|
-
event.preventDefault();
|
|
44
|
-
popover.toggle();
|
|
45
|
-
}, [popover]);
|
|
46
|
-
var onButtonClick = (0, _react.useCallback)(function (event) {
|
|
47
|
-
event.preventDefault();
|
|
48
|
-
popover.toggle();
|
|
49
|
-
}, [popover]);
|
|
50
|
-
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_Popover.PopoverDisclosure, _extends({
|
|
51
|
-
className: (0, _classnames["default"])(_popoverModule["default"].button, className)
|
|
52
|
-
}, popover, {
|
|
53
|
-
onClick: onButtonClick,
|
|
54
|
-
"aria-label": ariaLabel
|
|
55
|
-
}), icon && (typeof icon === 'string' ? /*#__PURE__*/_react["default"].createElement(_icon.Icon, {
|
|
56
|
-
className: _popoverModule["default"].icon,
|
|
57
|
-
glyph: icon
|
|
58
|
-
}) : icon), label && /*#__PURE__*/_react["default"].createElement("span", {
|
|
59
|
-
className: _popoverModule["default"].label
|
|
60
|
-
}, label)), /*#__PURE__*/_react["default"].createElement(_Popover.Popover, _extends({
|
|
61
|
-
className: _popoverModule["default"].popover
|
|
62
|
-
}, popover, {
|
|
63
|
-
tabIndex: 0
|
|
64
|
-
}), /*#__PURE__*/_react["default"].createElement(_Popover.PopoverArrow, _extends({
|
|
65
|
-
className: _popoverModule["default"].arrow
|
|
66
|
-
}, popover, {
|
|
67
|
-
size: 16
|
|
68
|
-
})), typeof children === 'function' ? children({
|
|
69
|
-
popoverToggle: popover.toggle
|
|
70
|
-
}) : children, /*#__PURE__*/_react["default"].createElement(_icon.Icon, {
|
|
71
|
-
glyph: "close",
|
|
72
|
-
as: "button",
|
|
73
|
-
type: "button",
|
|
74
|
-
className: _popoverModule["default"].closeBtn,
|
|
75
|
-
onClick: onCloseButtonClick
|
|
76
|
-
})));
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
exports.Popover = Popover;
|
|
80
|
-
Popover.propTypes = {
|
|
81
|
-
className: _propTypes["default"].string,
|
|
82
|
-
label: _propTypes["default"].element,
|
|
83
|
-
icon: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].element]),
|
|
84
|
-
children: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].element, _propTypes["default"].func]).isRequired,
|
|
85
|
-
ariaLabel: _propTypes["default"].string
|
|
86
|
-
};
|
|
87
|
-
Popover.defaultProps = {
|
|
88
|
-
className: '',
|
|
89
|
-
icon: '',
|
|
90
|
-
label: '',
|
|
91
|
-
ariaLabel: 'View more info'
|
|
92
|
-
};
|
|
@@ -1,66 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _react = _interopRequireDefault(require("react"));
|
|
4
|
-
|
|
5
|
-
var _react2 = require("@storybook/react");
|
|
6
|
-
|
|
7
|
-
var _stories = require("../../stories");
|
|
8
|
-
|
|
9
|
-
var _ = require(".");
|
|
10
|
-
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
-
|
|
13
|
-
var stories = (0, _react2.storiesOf)('UI/Popover', module);
|
|
14
|
-
stories.addDecorator((0, _stories.getWrapperDecorator)({
|
|
15
|
-
padding: '64px'
|
|
16
|
-
}));
|
|
17
|
-
stories.add('default', function () {
|
|
18
|
-
return /*#__PURE__*/_react["default"].createElement(_.Popover, {
|
|
19
|
-
label: "Job #100"
|
|
20
|
-
}, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
|
|
21
|
-
});
|
|
22
|
-
stories.add('with icon', function () {
|
|
23
|
-
return /*#__PURE__*/_react["default"].createElement(_.Popover, {
|
|
24
|
-
icon: "help"
|
|
25
|
-
}, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
|
|
26
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './popover';
|
|
@@ -1,71 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,66 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
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."));
|
package/src/ui/popover/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './popover';
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import cx from 'classnames';
|
|
4
|
-
import {
|
|
5
|
-
usePopoverState,
|
|
6
|
-
Popover as UIPopover,
|
|
7
|
-
PopoverDisclosure as UIPopoverDisclosure,
|
|
8
|
-
PopoverArrow as UIPopoverArrow,
|
|
9
|
-
} from 'reakit/Popover';
|
|
10
|
-
|
|
11
|
-
import { Icon } from '../icon';
|
|
12
|
-
import css from './popover.module.css';
|
|
13
|
-
|
|
14
|
-
export const Popover = ({ className, icon, label, ariaLabel, children }) => {
|
|
15
|
-
const popover = usePopoverState({
|
|
16
|
-
baseId: process.env.NODE_ENV === 'test' && 'id-test',
|
|
17
|
-
gutter: 12,
|
|
18
|
-
modal: true,
|
|
19
|
-
placement: 'top',
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const onCloseButtonClick = useCallback(
|
|
23
|
-
(event) => {
|
|
24
|
-
event.preventDefault();
|
|
25
|
-
popover.toggle();
|
|
26
|
-
},
|
|
27
|
-
[popover],
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
const onButtonClick = useCallback(
|
|
31
|
-
(event) => {
|
|
32
|
-
event.preventDefault();
|
|
33
|
-
popover.toggle();
|
|
34
|
-
},
|
|
35
|
-
[popover],
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<>
|
|
40
|
-
<UIPopoverDisclosure
|
|
41
|
-
className={cx(css.button, className)}
|
|
42
|
-
{...popover}
|
|
43
|
-
onClick={onButtonClick}
|
|
44
|
-
aria-label={ariaLabel}
|
|
45
|
-
>
|
|
46
|
-
{icon && (typeof icon === 'string' ? <Icon className={css.icon} glyph={icon} /> : icon)}
|
|
47
|
-
{label && <span className={css.label}>{label}</span>}
|
|
48
|
-
</UIPopoverDisclosure>
|
|
49
|
-
<UIPopover className={css.popover} {...popover} tabIndex={0}>
|
|
50
|
-
<UIPopoverArrow className={css.arrow} {...popover} size={16} />
|
|
51
|
-
|
|
52
|
-
{typeof children === 'function' ? children({ popoverToggle: popover.toggle }) : children}
|
|
53
|
-
|
|
54
|
-
<Icon
|
|
55
|
-
glyph="close"
|
|
56
|
-
as="button"
|
|
57
|
-
type="button"
|
|
58
|
-
className={css.closeBtn}
|
|
59
|
-
onClick={onCloseButtonClick}
|
|
60
|
-
/>
|
|
61
|
-
</UIPopover>
|
|
62
|
-
</>
|
|
63
|
-
);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
Popover.propTypes = {
|
|
67
|
-
className: PropTypes.string,
|
|
68
|
-
label: PropTypes.element,
|
|
69
|
-
icon: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
70
|
-
children: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.func]).isRequired,
|
|
71
|
-
ariaLabel: PropTypes.string,
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
Popover.defaultProps = {
|
|
75
|
-
className: '',
|
|
76
|
-
icon: '',
|
|
77
|
-
label: '',
|
|
78
|
-
ariaLabel: 'View more info',
|
|
79
|
-
};
|
|
@@ -1,66 +0,0 @@
|
|
|
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
|
-
}
|