@bundle-stats/ui 3.3.0-alpha.1 → 3.3.0-beta.1
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 +124 -104
- package/lib/app/app.module.css +11 -4
- package/lib/app/app.stories.js +1 -22
- package/lib/app/header/header.js +1 -10
- package/lib/assets/icons.svg +0 -8
- 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 +16 -42
- package/lib/components/bundle-assets-totals-table/bundle-assets-totals-table.module.css +2 -2
- package/lib/components/bundle-assets-totals-table/bundle-assets-totals-table.stories.js +1 -20
- 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/index.js +0 -8
- 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 +7 -12
- package/lib/components/summary/summary.module.css +1 -1
- package/lib/components/summary/summary.stories.js +0 -29
- package/lib/components/summary-item/summary-item.js +18 -38
- package/lib/components/summary-item/summary-item.module.css +1 -34
- package/lib/components/summary-item/summary-item.stories.js +53 -51
- package/lib/components/total-size-type-title/total-size-type-title.js +7 -3
- package/lib/constants.js +4 -4
- 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/alert/alert.js +3 -13
- 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/{components/budget-info → ui/hover-card}/index.js +4 -4
- package/lib/ui/icon/icon.js +6 -8
- 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 +119 -103
- package/lib-esm/app/app.module.css +11 -4
- package/lib-esm/app/app.stories.js +1 -22
- package/lib-esm/app/header/header.js +1 -9
- package/lib-esm/assets/icons.svg +0 -8
- 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 +13 -26
- package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.module.css +2 -2
- package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.stories.js +0 -18
- 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/index.js +0 -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/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 +7 -11
- package/lib-esm/components/summary/summary.module.css +1 -1
- package/lib-esm/components/summary/summary.stories.js +0 -27
- package/lib-esm/components/summary-item/summary-item.js +16 -36
- package/lib-esm/components/summary-item/summary-item.module.css +1 -34
- package/lib-esm/components/summary-item/summary-item.stories.js +38 -50
- package/lib-esm/components/total-size-type-title/total-size-type-title.js +6 -3
- package/lib-esm/constants.js +4 -4
- 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/alert/alert.js +3 -6
- 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 -5
- 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 +135 -145
- package/src/app/app.module.css +11 -4
- package/src/app/header/header.jsx +0 -10
- package/src/assets/icons.svg +0 -8
- 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 +13 -25
- package/src/components/bundle-assets-totals-table/bundle-assets-totals-table.module.css +2 -2
- 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/index.js +0 -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/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 +7 -8
- package/src/components/summary/summary.module.css +1 -1
- package/src/components/summary-item/summary-item.jsx +23 -40
- package/src/components/summary-item/summary-item.module.css +1 -34
- package/src/components/total-size-type-title/total-size-type-title.jsx +6 -9
- package/src/constants.js +11 -7
- 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/alert/alert.jsx +2 -7
- 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 -9
- 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/assets/icons/alert-circle.svg +0 -1
- package/lib/assets/icons/check-circle.svg +0 -1
- package/lib/components/budget-info/budget-info.js +0 -80
- package/lib/components/budget-info/budget-info.module.css +0 -40
- package/lib/components/budget-info/budget-info.stories.js +0 -44
- package/lib/components/budget-insights/budget-insights.js +0 -200
- package/lib/components/budget-insights/budget-insights.module.css +0 -53
- package/lib/components/budget-insights/budget-insights.stories.js +0 -104
- package/lib/components/budget-insights/index.js +0 -18
- 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/assets/icons/alert-circle.svg +0 -1
- package/lib-esm/assets/icons/check-circle.svg +0 -1
- package/lib-esm/components/budget-info/budget-info.js +0 -58
- package/lib-esm/components/budget-info/budget-info.module.css +0 -40
- package/lib-esm/components/budget-info/budget-info.stories.js +0 -30
- package/lib-esm/components/budget-info/index.js +0 -1
- package/lib-esm/components/budget-insights/budget-insights.js +0 -148
- package/lib-esm/components/budget-insights/budget-insights.module.css +0 -53
- package/lib-esm/components/budget-insights/budget-insights.stories.js +0 -84
- package/lib-esm/components/budget-insights/index.js +0 -1
- 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/assets/icons/alert-circle.svg +0 -1
- package/src/assets/icons/check-circle.svg +0 -1
- package/src/components/budget-info/budget-info.jsx +0 -65
- package/src/components/budget-info/budget-info.module.css +0 -40
- package/src/components/budget-info/index.js +0 -1
- package/src/components/budget-insights/budget-insights.jsx +0 -157
- package/src/components/budget-insights/budget-insights.module.css +0 -53
- package/src/components/budget-insights/index.js +0 -1
- 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
|
@@ -1,5 +1,3 @@
|
|
|
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
1
|
import React from 'react';
|
|
4
2
|
import cx from 'classnames';
|
|
5
3
|
import PropTypes from 'prop-types';
|
|
@@ -9,14 +7,13 @@ export const Alert = props => {
|
|
|
9
7
|
const {
|
|
10
8
|
className,
|
|
11
9
|
kind,
|
|
12
|
-
children
|
|
13
|
-
...restProps
|
|
10
|
+
children
|
|
14
11
|
} = props;
|
|
15
|
-
return /*#__PURE__*/React.createElement(Box,
|
|
12
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
16
13
|
padding: ['xsmall', 'small'],
|
|
17
14
|
outline: true,
|
|
18
15
|
className: cx(css.root, className, css[kind])
|
|
19
|
-
},
|
|
16
|
+
}, children);
|
|
20
17
|
};
|
|
21
18
|
Alert.propTypes = {
|
|
22
19
|
className: PropTypes.string,
|
|
@@ -1,56 +1,57 @@
|
|
|
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
1
|
import React from 'react';
|
|
4
2
|
import PropTypes from 'prop-types';
|
|
5
3
|
import cx from 'classnames';
|
|
6
|
-
import { Menu,
|
|
4
|
+
import { Menu, MenuButton, MenuItem, useMenuState } from 'ariakit/menu';
|
|
7
5
|
import { FlexStack } from '../../layout/flex-stack';
|
|
8
6
|
import { Icon } from '../icon';
|
|
9
7
|
import css from './dropdown.module.css';
|
|
10
8
|
export const Dropdown = props => {
|
|
11
9
|
const {
|
|
12
10
|
className,
|
|
11
|
+
buttonClassName,
|
|
13
12
|
label,
|
|
14
13
|
ariaLabel,
|
|
15
14
|
glyph,
|
|
16
|
-
activeLabel,
|
|
17
15
|
children
|
|
18
16
|
} = props;
|
|
19
|
-
const rootClassName = cx(css.root,
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
className:
|
|
17
|
+
const rootClassName = cx(css.root, className);
|
|
18
|
+
const menuState = useMenuState();
|
|
19
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
20
|
+
className: rootClassName
|
|
21
|
+
}, /*#__PURE__*/React.createElement(MenuButton, {
|
|
22
|
+
state: menuState,
|
|
23
|
+
className: cx(css.button, buttonClassName),
|
|
26
24
|
tabIndex: null
|
|
27
|
-
}
|
|
28
|
-
space: "xxxsmall"
|
|
29
|
-
className: css.label
|
|
25
|
+
}, /*#__PURE__*/React.createElement(FlexStack, {
|
|
26
|
+
space: "xxxsmall"
|
|
30
27
|
}, glyph && /*#__PURE__*/React.createElement(Icon, {
|
|
31
28
|
className: css.labelIcon,
|
|
32
29
|
glyph: glyph
|
|
33
|
-
}), label)), /*#__PURE__*/React.createElement(Menu,
|
|
30
|
+
}), label)), /*#__PURE__*/React.createElement(Menu, {
|
|
31
|
+
state: menuState,
|
|
34
32
|
"aria-label": ariaLabel || label,
|
|
35
33
|
className: css.dropdown
|
|
36
|
-
}
|
|
34
|
+
}, typeof children === 'function' ? children({
|
|
37
35
|
MenuItem,
|
|
38
|
-
menu,
|
|
36
|
+
menu: menuState,
|
|
39
37
|
menuItemClassName: css.menuItem,
|
|
40
38
|
menuItemActiveClassName: css.menuItemActive
|
|
41
39
|
}) : children));
|
|
42
40
|
};
|
|
43
41
|
Dropdown.defaultProps = {
|
|
44
42
|
className: '',
|
|
43
|
+
buttonClassName: '',
|
|
45
44
|
label: null,
|
|
46
45
|
ariaLabel: '',
|
|
47
|
-
glyph: null
|
|
48
|
-
activeLabel: false
|
|
46
|
+
glyph: null
|
|
49
47
|
};
|
|
50
48
|
Dropdown.propTypes = {
|
|
51
49
|
/** Adopted child class name */
|
|
52
50
|
className: PropTypes.string,
|
|
53
51
|
|
|
52
|
+
/** Button adopted child class name */
|
|
53
|
+
buttonClassName: PropTypes.string,
|
|
54
|
+
|
|
54
55
|
/** Button label */
|
|
55
56
|
label: PropTypes.node,
|
|
56
57
|
|
|
@@ -60,12 +61,6 @@ Dropdown.propTypes = {
|
|
|
60
61
|
/** Icon glyph */
|
|
61
62
|
glyph: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
62
63
|
|
|
63
|
-
/** Dropdown open state */
|
|
64
|
-
open: PropTypes.bool.isRequired,
|
|
65
|
-
|
|
66
|
-
/** Active label flag */
|
|
67
|
-
activeLabel: PropTypes.bool,
|
|
68
|
-
|
|
69
64
|
/** Content */
|
|
70
65
|
children: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.func]).isRequired
|
|
71
66
|
};
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
.root {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.button {
|
|
2
6
|
background: none;
|
|
3
7
|
border: none;
|
|
4
8
|
padding: 0;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.root:focus {
|
|
8
|
-
outline: none;
|
|
9
|
-
box-shadow: 0 0 var(--space-xxxsmall) var(--color-shadow);
|
|
10
|
-
}
|
|
11
9
|
|
|
12
|
-
.label {
|
|
13
10
|
border: 1px solid var(--color-outline);
|
|
11
|
+
border-radius: var(--radius-small);
|
|
14
12
|
padding: calc(var(--space-xxsmall) - 1px);
|
|
15
13
|
display: flex;
|
|
16
14
|
align-items: center;
|
|
@@ -24,7 +22,11 @@
|
|
|
24
22
|
color: var(--color-text-light);
|
|
25
23
|
}
|
|
26
24
|
|
|
27
|
-
.
|
|
25
|
+
.button:hover,
|
|
26
|
+
.button:focus,
|
|
27
|
+
.button:active {
|
|
28
|
+
outline: none;
|
|
29
|
+
box-shadow: 0 0 var(--space-xxxsmall) var(--color-shadow);
|
|
28
30
|
border-color: var(--color-outline-dark);
|
|
29
31
|
color: var(--color-text);
|
|
30
32
|
}
|
|
@@ -33,6 +35,7 @@
|
|
|
33
35
|
position: absolute;
|
|
34
36
|
left: 0;
|
|
35
37
|
top: 100%;
|
|
38
|
+
border-radius: var(--radius-medium);
|
|
36
39
|
box-shadow: 0 2px var(--space-xxsmall) var(--color-shadow);
|
|
37
40
|
background: var(--color-background);
|
|
38
41
|
min-width: 180px;
|
|
@@ -45,10 +48,6 @@
|
|
|
45
48
|
box-shadow: 0 2px var(--space-xsmall) var(--color-shadow);
|
|
46
49
|
}
|
|
47
50
|
|
|
48
|
-
.activeLabel .label {
|
|
49
|
-
color: var(--color-text);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
51
|
.menuItem {
|
|
53
52
|
display: block;
|
|
54
53
|
appearance: none;
|
|
@@ -8,20 +8,15 @@ stories.add('default', () => /*#__PURE__*/React.createElement(Dropdown, {
|
|
|
8
8
|
glyph: "filter",
|
|
9
9
|
label: "Toggle"
|
|
10
10
|
}, /*#__PURE__*/React.createElement("ul", null, /*#__PURE__*/React.createElement("li", null, "Option 1"), /*#__PURE__*/React.createElement("li", null, "Option 2"))));
|
|
11
|
-
stories.add('with right alignement', () => /*#__PURE__*/React.createElement(Dropdown, {
|
|
12
|
-
glyph: "filter",
|
|
13
|
-
label: "Toggle",
|
|
14
|
-
align: "right"
|
|
15
|
-
}, /*#__PURE__*/React.createElement("ul", null, /*#__PURE__*/React.createElement("li", null, "Option 1"), /*#__PURE__*/React.createElement("li", null, "Option 2"))));
|
|
16
11
|
stories.add('with render function', () => /*#__PURE__*/React.createElement(Dropdown, {
|
|
17
12
|
glyph: "filter",
|
|
18
13
|
label: "Toggle"
|
|
19
14
|
}, _ref => {
|
|
20
15
|
let {
|
|
21
|
-
|
|
16
|
+
menu
|
|
22
17
|
} = _ref;
|
|
23
18
|
return /*#__PURE__*/React.createElement("button", {
|
|
24
19
|
type: "button",
|
|
25
|
-
onClick:
|
|
20
|
+
onClick: menu.toggle
|
|
26
21
|
}, "Toggle dropdown");
|
|
27
22
|
}));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import { Stack } from '../../layout/stack';
|
|
3
4
|
import I18N from '../../i18n';
|
|
4
5
|
import css from './empty-set.module.css';
|
|
5
6
|
export const EmptySet = props => {
|
|
@@ -19,11 +20,10 @@ export const EmptySet = props => {
|
|
|
19
20
|
type: "button",
|
|
20
21
|
onClick: handleViewAll
|
|
21
22
|
}, I18N.VIEW_ALL)] : [])];
|
|
22
|
-
return /*#__PURE__*/React.createElement(
|
|
23
|
+
return /*#__PURE__*/React.createElement(Stack, {
|
|
24
|
+
space: "xxsmall",
|
|
23
25
|
className: css.root
|
|
24
|
-
}, /*#__PURE__*/React.createElement("p",
|
|
25
|
-
className: css.text
|
|
26
|
-
}, message), filtered && actions.map((action, index) => /*#__PURE__*/React.createElement(React.Fragment, null, index > 0 && ' or ', action)));
|
|
26
|
+
}, /*#__PURE__*/React.createElement("p", null, message), filtered && actions.map((action, index) => /*#__PURE__*/React.createElement(React.Fragment, null, index > 0 && ' or ', action)));
|
|
27
27
|
};
|
|
28
28
|
EmptySet.propTypes = {
|
|
29
29
|
resources: PropTypes.string.isRequired,
|
|
@@ -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,17 +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 {
|
|
60
|
+
className,
|
|
61
|
+
buttonClassName,
|
|
57
62
|
groupKey,
|
|
58
63
|
data,
|
|
59
64
|
values,
|
|
@@ -98,6 +103,8 @@ const FilterGroup = props => {
|
|
|
98
103
|
};
|
|
99
104
|
|
|
100
105
|
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
106
|
+
className: className,
|
|
107
|
+
buttonClassName: buttonClassName,
|
|
101
108
|
label: dropdownLabel,
|
|
102
109
|
ariaLabel: `${groupLabel}: ${filterSuffix}`
|
|
103
110
|
}, _ref4 => {
|
|
@@ -147,6 +154,8 @@ const FilterGroup = props => {
|
|
|
147
154
|
};
|
|
148
155
|
|
|
149
156
|
FilterGroup.propTypes = {
|
|
157
|
+
className: PropTypes.string,
|
|
158
|
+
buttonClassName: PropTypes.string,
|
|
150
159
|
groupKey: PropTypes.string.isRequired,
|
|
151
160
|
data: PropTypes.object.isRequired,
|
|
152
161
|
// eslint-disable-line react/forbid-prop-types
|
|
@@ -155,6 +164,10 @@ FilterGroup.propTypes = {
|
|
|
155
164
|
onCheckboxChange: PropTypes.func.isRequired,
|
|
156
165
|
toggleFilters: PropTypes.func.isRequired
|
|
157
166
|
};
|
|
167
|
+
FilterGroup.defaultProps = {
|
|
168
|
+
className: '',
|
|
169
|
+
buttonClassName: ''
|
|
170
|
+
};
|
|
158
171
|
export const Filters = props => {
|
|
159
172
|
const {
|
|
160
173
|
className,
|
|
@@ -175,6 +188,7 @@ export const Filters = props => {
|
|
|
175
188
|
return /*#__PURE__*/React.createElement("form", {
|
|
176
189
|
className: rootClassName
|
|
177
190
|
}, /*#__PURE__*/React.createElement(FlexStack, {
|
|
191
|
+
space: "xxsmall",
|
|
178
192
|
className: css.items
|
|
179
193
|
}, Object.entries(filters).map(_ref7 => {
|
|
180
194
|
let [name, data] = _ref7;
|
|
@@ -183,6 +197,7 @@ export const Filters = props => {
|
|
|
183
197
|
return /*#__PURE__*/React.createElement(Filter, {
|
|
184
198
|
key: name,
|
|
185
199
|
className: cx(css.item, css.filterStandalone),
|
|
200
|
+
buttonClassName: css.itemButton,
|
|
186
201
|
name: name,
|
|
187
202
|
label: data.label,
|
|
188
203
|
onChange: onCheckboxChange,
|
|
@@ -191,16 +206,16 @@ export const Filters = props => {
|
|
|
191
206
|
});
|
|
192
207
|
}
|
|
193
208
|
|
|
194
|
-
return /*#__PURE__*/React.createElement(
|
|
195
|
-
className: css.item
|
|
196
|
-
|
|
209
|
+
return /*#__PURE__*/React.createElement(FilterGroup, {
|
|
210
|
+
className: css.item,
|
|
211
|
+
buttonClassName: css.itemButton,
|
|
197
212
|
key: name,
|
|
198
213
|
groupKey: name,
|
|
199
214
|
data: data,
|
|
200
215
|
values: values,
|
|
201
216
|
onCheckboxChange: onCheckboxChange,
|
|
202
217
|
toggleFilters: toggleFilters
|
|
203
|
-
})
|
|
218
|
+
});
|
|
204
219
|
})));
|
|
205
220
|
};
|
|
206
221
|
Filters.defaultProps = {
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
.filterInput {
|
|
14
|
+
border-radius: var(--radius-small) 0 0 var(--radius-small);
|
|
14
15
|
flex: 0 0 auto;
|
|
15
16
|
height: 1em;
|
|
16
17
|
cursor: pointer;
|
|
@@ -131,9 +132,8 @@
|
|
|
131
132
|
.item {
|
|
132
133
|
position: relative;
|
|
133
134
|
flex: 0 0 auto;
|
|
134
|
-
margin-right: -1px;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
.
|
|
138
|
-
|
|
137
|
+
.itemButton {
|
|
138
|
+
border-radius: var(--radius-small);
|
|
139
139
|
}
|
|
@@ -0,0 +1,83 @@
|
|
|
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 { Hovercard, HovercardAnchor, HovercardArrow, useHovercard, useHovercardState } from 'ariakit/hovercard';
|
|
7
|
+
import css from './hover-card.module.css';
|
|
8
|
+
|
|
9
|
+
const resolveComponent = (as, href) => {
|
|
10
|
+
if (as) {
|
|
11
|
+
return as;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (href) {
|
|
15
|
+
return 'a';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return 'span';
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const HoverCard = props => {
|
|
22
|
+
const {
|
|
23
|
+
className,
|
|
24
|
+
hoverCardClassName,
|
|
25
|
+
href,
|
|
26
|
+
as,
|
|
27
|
+
label,
|
|
28
|
+
children
|
|
29
|
+
} = props;
|
|
30
|
+
const state = useHovercardState({
|
|
31
|
+
gutter: 8
|
|
32
|
+
});
|
|
33
|
+
const hoverCardProps = useHovercard({
|
|
34
|
+
state,
|
|
35
|
+
portal: true
|
|
36
|
+
}); // Fallback to span if no href
|
|
37
|
+
|
|
38
|
+
const Component = resolveComponent(as, href);
|
|
39
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
className: cx(css.root, className)
|
|
41
|
+
}, /*#__PURE__*/React.createElement(HovercardAnchor, {
|
|
42
|
+
state: state,
|
|
43
|
+
href: href,
|
|
44
|
+
className: css.anchor,
|
|
45
|
+
as: Component
|
|
46
|
+
}, label), /*#__PURE__*/React.createElement(Hovercard, _extends({}, hoverCardProps, {
|
|
47
|
+
state: state,
|
|
48
|
+
className: cx(css.hoverCard, hoverCardClassName),
|
|
49
|
+
style: {
|
|
50
|
+
zIndex: 10000
|
|
51
|
+
}
|
|
52
|
+
}), /*#__PURE__*/React.createElement(HovercardArrow, {
|
|
53
|
+
size: 24
|
|
54
|
+
}), typeof children === 'function' ? children({
|
|
55
|
+
close: state.hide
|
|
56
|
+
}) : children));
|
|
57
|
+
};
|
|
58
|
+
HoverCard.propTypes = {
|
|
59
|
+
/** Adopted child class name */
|
|
60
|
+
className: PropTypes.string,
|
|
61
|
+
|
|
62
|
+
/** Adopted child class name for hover card */
|
|
63
|
+
hoverCardClassName: PropTypes.string,
|
|
64
|
+
|
|
65
|
+
/** Anchor label */
|
|
66
|
+
label: PropTypes.node,
|
|
67
|
+
|
|
68
|
+
/** Anchor href */
|
|
69
|
+
href: PropTypes.string,
|
|
70
|
+
|
|
71
|
+
/** Anchor component */
|
|
72
|
+
as: PropTypes.elementType,
|
|
73
|
+
|
|
74
|
+
/** Hover card component */
|
|
75
|
+
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired
|
|
76
|
+
};
|
|
77
|
+
HoverCard.defaultProps = {
|
|
78
|
+
className: '',
|
|
79
|
+
hoverCardClassName: '',
|
|
80
|
+
label: '',
|
|
81
|
+
as: '',
|
|
82
|
+
href: ''
|
|
83
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.anchor {
|
|
6
|
+
display: inline-block;
|
|
7
|
+
color: inherit;
|
|
8
|
+
text-decoration: none;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.anchor:hover {
|
|
12
|
+
color: var(--color-primary);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.anchor:focus {
|
|
16
|
+
outline: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.hoverCard {
|
|
20
|
+
padding: var(--space-xsmall) var(--space-small);
|
|
21
|
+
border-radius: var(--radius-medium);
|
|
22
|
+
width: calc(100vw - 2 * var(--space-small));
|
|
23
|
+
max-width: 360px;
|
|
24
|
+
outline: none;
|
|
25
|
+
filter: drop-shadow(0 0 var(--space-xxsmall) var(--color-shadow));
|
|
26
|
+
will-change: filter;
|
|
27
|
+
background: var(--color-light);
|
|
28
|
+
font-size: var(--size-small);
|
|
29
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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 from 'react';
|
|
4
|
+
import { HoverCard } from '.';
|
|
5
|
+
export default {
|
|
6
|
+
title: 'UI/HoverCard',
|
|
7
|
+
component: HoverCard
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const Template = props => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(HoverCard, _extends({}, props, {
|
|
11
|
+
style: {
|
|
12
|
+
zIndex: 2
|
|
13
|
+
}
|
|
14
|
+
})), /*#__PURE__*/React.createElement("p", {
|
|
15
|
+
style: {
|
|
16
|
+
position: 'relative',
|
|
17
|
+
zIndex: 1,
|
|
18
|
+
maxWidth: 360
|
|
19
|
+
}
|
|
20
|
+
}, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras in neque ante. Curabitur vehicula, lorem sit amet fringilla dapibus, justo mauris varius elit, ut fermentum leo velit eget risus"));
|
|
21
|
+
|
|
22
|
+
export const Default = () => /*#__PURE__*/React.createElement(Template, {
|
|
23
|
+
label: "main.js"
|
|
24
|
+
}, /*#__PURE__*/React.createElement("h1", null, "main.js"), /*#__PURE__*/React.createElement("p", null, "info"));
|
|
25
|
+
export const WithRenderFn = () => /*#__PURE__*/React.createElement(Template, {
|
|
26
|
+
label: "main.js"
|
|
27
|
+
}, _ref => {
|
|
28
|
+
let {
|
|
29
|
+
close
|
|
30
|
+
} = _ref;
|
|
31
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h1", null, "main.js"), /*#__PURE__*/React.createElement("p", null, "info"), /*#__PURE__*/React.createElement("button", {
|
|
32
|
+
type: "button",
|
|
33
|
+
onClick: close
|
|
34
|
+
}, "close"));
|
|
35
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './hover-card';
|
package/lib-esm/ui/icon/icon.js
CHANGED
|
@@ -5,13 +5,11 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import cx from 'classnames';
|
|
6
6
|
import css from './icon.module.css';
|
|
7
7
|
const ICONS = {
|
|
8
|
-
ALERT_CIRCLE: 'alert-circle',
|
|
9
8
|
ARROW: 'arrow',
|
|
10
9
|
ARROW_RIGHT_CIRLCE: 'arrow-right-circle',
|
|
11
10
|
CANCEL: 'cancel',
|
|
12
11
|
CLOSE: 'close',
|
|
13
12
|
CLOCK: 'clock',
|
|
14
|
-
CHECK_CIRCLE: 'check-circle',
|
|
15
13
|
COMMIT: 'commit',
|
|
16
14
|
FILTER: 'filter',
|
|
17
15
|
HELP: 'help',
|
|
@@ -19,14 +17,14 @@ const ICONS = {
|
|
|
19
17
|
SORT: 'sort',
|
|
20
18
|
WARNING: 'warning'
|
|
21
19
|
};
|
|
22
|
-
export const Icon =
|
|
23
|
-
|
|
20
|
+
export const Icon = props => {
|
|
21
|
+
const {
|
|
24
22
|
className,
|
|
25
23
|
glyph,
|
|
26
24
|
as: Component,
|
|
27
25
|
size,
|
|
28
26
|
...restProps
|
|
29
|
-
} =
|
|
27
|
+
} = props;
|
|
30
28
|
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
31
29
|
className: cx(css.root, className, css[size])
|
|
32
30
|
}, restProps), /*#__PURE__*/React.createElement("svg", {
|
package/lib-esm/ui/index.js
CHANGED
|
@@ -10,9 +10,9 @@ export { Input } from './input';
|
|
|
10
10
|
export { Loader } from './loader';
|
|
11
11
|
export { Logo } from './logo';
|
|
12
12
|
export { Panels } from './panels';
|
|
13
|
-
export { Popover } from './popover';
|
|
14
13
|
export { Skeleton } from './skeleton';
|
|
15
14
|
export { SortDropdown } from './sort-dropdown';
|
|
16
15
|
export { Table } from './table';
|
|
17
16
|
export { Tabs } from './tabs';
|
|
17
|
+
export { Tag } from './tag';
|
|
18
18
|
export { Tooltip } from './tooltip';
|
|
@@ -1,67 +1,7 @@
|
|
|
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
1
|
import React from 'react';
|
|
4
2
|
import PropTypes from 'prop-types';
|
|
5
3
|
import cx from 'classnames';
|
|
6
4
|
import css from './table.module.css';
|
|
7
|
-
|
|
8
|
-
const THead = props => /*#__PURE__*/React.createElement("thead", props);
|
|
9
|
-
|
|
10
|
-
const TBody = props => /*#__PURE__*/React.createElement("tbody", props);
|
|
11
|
-
|
|
12
|
-
const Tr = props => {
|
|
13
|
-
const {
|
|
14
|
-
className,
|
|
15
|
-
...restProps
|
|
16
|
-
} = props;
|
|
17
|
-
return /*#__PURE__*/React.createElement("tr", _extends({
|
|
18
|
-
className: cx(css.row, className)
|
|
19
|
-
}, restProps));
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
Tr.defaultProps = {
|
|
23
|
-
className: ''
|
|
24
|
-
};
|
|
25
|
-
Tr.propTypes = {
|
|
26
|
-
/** Adopted child class name */
|
|
27
|
-
className: PropTypes.string
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const Th = props => {
|
|
31
|
-
const {
|
|
32
|
-
className,
|
|
33
|
-
...restProps
|
|
34
|
-
} = props;
|
|
35
|
-
return /*#__PURE__*/React.createElement("th", _extends({
|
|
36
|
-
className: cx(css.cell, className)
|
|
37
|
-
}, restProps));
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
Th.defaultProps = {
|
|
41
|
-
className: ''
|
|
42
|
-
};
|
|
43
|
-
Th.propTypes = {
|
|
44
|
-
/** Adopted child class name */
|
|
45
|
-
className: PropTypes.string
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const Td = props => {
|
|
49
|
-
const {
|
|
50
|
-
className,
|
|
51
|
-
...restProps
|
|
52
|
-
} = props;
|
|
53
|
-
return /*#__PURE__*/React.createElement("td", _extends({
|
|
54
|
-
className: cx(css.cell, className)
|
|
55
|
-
}, restProps));
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
Td.defaultProps = {
|
|
59
|
-
className: ''
|
|
60
|
-
};
|
|
61
|
-
Td.propTypes = {
|
|
62
|
-
/** Adopted child class name */
|
|
63
|
-
className: PropTypes.string
|
|
64
|
-
};
|
|
65
5
|
export const Table = _ref => {
|
|
66
6
|
let {
|
|
67
7
|
className,
|
|
@@ -82,11 +22,11 @@ export const Table = _ref => {
|
|
|
82
22
|
className: rootClassName
|
|
83
23
|
}, children);
|
|
84
24
|
};
|
|
85
|
-
Table.THead =
|
|
86
|
-
Table.TBody =
|
|
87
|
-
Table.
|
|
88
|
-
Table.
|
|
89
|
-
Table.Td =
|
|
25
|
+
Table.THead = 'thead';
|
|
26
|
+
Table.TBody = 'tbody';
|
|
27
|
+
Table.Tr = 'tr';
|
|
28
|
+
Table.Th = 'th';
|
|
29
|
+
Table.Td = 'td';
|
|
90
30
|
Table.defaultProps = {
|
|
91
31
|
className: '',
|
|
92
32
|
emptyMessage: 'No entries found.',
|