@bundle-stats/ui 3.2.5 → 3.2.6-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/lib/components/bundle-assets/bundle-assets.js +23 -13
- package/lib/components/bundle-assets/bundle-assets.module.css +18 -26
- package/lib/components/bundle-modules/bundle-modules.js +4 -5
- package/lib/components/bundle-packages/bundle-packages.js +14 -8
- package/lib/components/bundle-packages/bundle-packages.module.css +8 -12
- package/lib/components/delta/delta.module.css +1 -0
- 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.module.css +1 -0
- package/lib/components/summary-item/summary-item.js +14 -17
- package/lib/components/summary-item/summary-item.module.css +1 -19
- package/lib/components/total-size-type-title/total-size-type-title.js +7 -3
- package/lib/css/variables.css +3 -3
- package/lib/hooks/search-params.js +6 -6
- package/lib/layout/box/box.module.css +9 -0
- package/lib/ui/dropdown/dropdown.js +16 -26
- package/lib/ui/dropdown/dropdown.module.css +11 -12
- package/lib/ui/dropdown/dropdown.stories.js +2 -9
- package/lib/ui/filters/filters.js +10 -5
- package/lib/ui/filters/filters.module.css +10 -0
- package/lib/ui/hover-card/hover-card.js +100 -0
- package/lib/ui/hover-card/hover-card.module.css +52 -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/index.js +8 -8
- package/lib/ui/table/table.module.css +0 -4
- 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 +1 -1
- package/lib-esm/components/bundle-assets/bundle-assets.js +22 -13
- package/lib-esm/components/bundle-assets/bundle-assets.module.css +18 -26
- package/lib-esm/components/bundle-modules/bundle-modules.js +4 -5
- package/lib-esm/components/bundle-packages/bundle-packages.js +13 -8
- package/lib-esm/components/bundle-packages/bundle-packages.module.css +8 -12
- package/lib-esm/components/delta/delta.module.css +1 -0
- 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.module.css +1 -0
- package/lib-esm/components/summary-item/summary-item.js +13 -17
- package/lib-esm/components/summary-item/summary-item.module.css +1 -19
- package/lib-esm/components/total-size-type-title/total-size-type-title.js +6 -3
- package/lib-esm/css/variables.css +3 -3
- package/lib-esm/hooks/search-params.js +6 -6
- package/lib-esm/layout/box/box.module.css +9 -0
- package/lib-esm/ui/dropdown/dropdown.js +15 -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/filters/filters.js +9 -4
- package/lib-esm/ui/filters/filters.module.css +10 -0
- package/lib-esm/ui/hover-card/hover-card.js +86 -0
- package/lib-esm/ui/hover-card/hover-card.module.css +52 -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/index.js +1 -1
- package/lib-esm/ui/table/table.module.css +0 -4
- 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 +1 -1
- package/package.json +9 -9
- package/src/components/bundle-assets/bundle-assets.jsx +61 -42
- package/src/components/bundle-assets/bundle-assets.module.css +18 -26
- package/src/components/bundle-modules/bundle-modules.jsx +24 -14
- package/src/components/bundle-packages/bundle-packages.jsx +21 -8
- package/src/components/bundle-packages/bundle-packages.module.css +8 -12
- package/src/components/delta/delta.module.css +1 -0
- 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 +1 -5
- package/src/components/module-info/module-info.module.css +1 -0
- package/src/components/summary-item/summary-item.jsx +20 -26
- package/src/components/summary-item/summary-item.module.css +1 -19
- package/src/components/total-size-type-title/total-size-type-title.jsx +6 -9
- package/src/css/variables.css +3 -3
- package/src/hooks/search-params.js +18 -11
- package/src/layout/box/box.module.css +9 -0
- package/src/ui/dropdown/dropdown.jsx +12 -22
- package/src/ui/dropdown/dropdown.module.css +11 -12
- package/src/ui/filters/filters.jsx +53 -50
- package/src/ui/filters/filters.module.css +10 -0
- package/src/ui/hover-card/hover-card.jsx +79 -0
- package/src/ui/hover-card/hover-card.module.css +52 -0
- package/src/ui/hover-card/index.js +1 -0
- package/src/ui/icon/icon.jsx +11 -7
- package/src/ui/index.js +1 -1
- package/src/ui/table/table.module.css +0 -4
- 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 +1 -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
|
@@ -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
|
}));
|
|
@@ -54,6 +54,7 @@ Filter.defaultProps = {
|
|
|
54
54
|
|
|
55
55
|
const FilterGroup = props => {
|
|
56
56
|
const {
|
|
57
|
+
className,
|
|
57
58
|
groupKey,
|
|
58
59
|
data,
|
|
59
60
|
values,
|
|
@@ -98,6 +99,7 @@ const FilterGroup = props => {
|
|
|
98
99
|
};
|
|
99
100
|
|
|
100
101
|
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
102
|
+
className: className,
|
|
101
103
|
label: dropdownLabel,
|
|
102
104
|
ariaLabel: `${groupLabel}: ${filterSuffix}`
|
|
103
105
|
}, _ref4 => {
|
|
@@ -147,6 +149,7 @@ const FilterGroup = props => {
|
|
|
147
149
|
};
|
|
148
150
|
|
|
149
151
|
FilterGroup.propTypes = {
|
|
152
|
+
className: PropTypes.string,
|
|
150
153
|
groupKey: PropTypes.string.isRequired,
|
|
151
154
|
data: PropTypes.object.isRequired,
|
|
152
155
|
// eslint-disable-line react/forbid-prop-types
|
|
@@ -155,6 +158,9 @@ FilterGroup.propTypes = {
|
|
|
155
158
|
onCheckboxChange: PropTypes.func.isRequired,
|
|
156
159
|
toggleFilters: PropTypes.func.isRequired
|
|
157
160
|
};
|
|
161
|
+
FilterGroup.defaultProps = {
|
|
162
|
+
className: ''
|
|
163
|
+
};
|
|
158
164
|
export const Filters = props => {
|
|
159
165
|
const {
|
|
160
166
|
className,
|
|
@@ -191,16 +197,15 @@ export const Filters = props => {
|
|
|
191
197
|
});
|
|
192
198
|
}
|
|
193
199
|
|
|
194
|
-
return /*#__PURE__*/React.createElement(
|
|
195
|
-
className: css.item
|
|
196
|
-
}, /*#__PURE__*/React.createElement(FilterGroup, {
|
|
200
|
+
return /*#__PURE__*/React.createElement(FilterGroup, {
|
|
201
|
+
className: css.item,
|
|
197
202
|
key: name,
|
|
198
203
|
groupKey: name,
|
|
199
204
|
data: data,
|
|
200
205
|
values: values,
|
|
201
206
|
onCheckboxChange: onCheckboxChange,
|
|
202
207
|
toggleFilters: toggleFilters
|
|
203
|
-
})
|
|
208
|
+
});
|
|
204
209
|
})));
|
|
205
210
|
};
|
|
206
211
|
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;
|
|
@@ -129,11 +130,20 @@
|
|
|
129
130
|
}
|
|
130
131
|
|
|
131
132
|
.item {
|
|
133
|
+
border-radius: 0;
|
|
132
134
|
position: relative;
|
|
133
135
|
flex: 0 0 auto;
|
|
134
136
|
margin-right: -1px;
|
|
135
137
|
}
|
|
136
138
|
|
|
139
|
+
.item:first-child {
|
|
140
|
+
border-radius: var(--radius-small) 0 0 var(--radius-small);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.item:last-child {
|
|
144
|
+
border-radius: 0 var(--radius-small) var(--radius-small) 0;
|
|
145
|
+
}
|
|
146
|
+
|
|
137
147
|
.item:hover {
|
|
138
148
|
z-index: var(--layer-low); /* show collapsed border */
|
|
139
149
|
}
|
|
@@ -0,0 +1,86 @@
|
|
|
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 PropTypes from 'prop-types';
|
|
5
|
+
import cx from 'classnames';
|
|
6
|
+
import { Hovercard, HovercardAnchor, HovercardArrow, useHovercard, useHovercardState } from 'ariakit/hovercard';
|
|
7
|
+
import { Icon } from '../icon';
|
|
8
|
+
import css from './hover-card.module.css';
|
|
9
|
+
|
|
10
|
+
const resolveComponent = (as, href) => {
|
|
11
|
+
if (as) {
|
|
12
|
+
return as;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (href) {
|
|
16
|
+
return 'a';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return 'span';
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const HoverCard = props => {
|
|
23
|
+
const {
|
|
24
|
+
className,
|
|
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: css.hoverCard,
|
|
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, /*#__PURE__*/React.createElement(Icon, {
|
|
57
|
+
glyph: "close",
|
|
58
|
+
size: "small",
|
|
59
|
+
as: "button",
|
|
60
|
+
type: "button",
|
|
61
|
+
className: css.closeBtn,
|
|
62
|
+
onClick: state.hide
|
|
63
|
+
})));
|
|
64
|
+
};
|
|
65
|
+
HoverCard.propTypes = {
|
|
66
|
+
/** Adopted child class name */
|
|
67
|
+
className: PropTypes.string,
|
|
68
|
+
|
|
69
|
+
/** Anchor label */
|
|
70
|
+
label: PropTypes.node,
|
|
71
|
+
|
|
72
|
+
/** Anchor href */
|
|
73
|
+
href: PropTypes.string,
|
|
74
|
+
|
|
75
|
+
/** Anchor component */
|
|
76
|
+
as: PropTypes.elementType,
|
|
77
|
+
|
|
78
|
+
/** Hover card component */
|
|
79
|
+
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired
|
|
80
|
+
};
|
|
81
|
+
HoverCard.defaultProps = {
|
|
82
|
+
className: '',
|
|
83
|
+
label: '',
|
|
84
|
+
as: '',
|
|
85
|
+
href: ''
|
|
86
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.anchor {
|
|
6
|
+
display: inline-block;
|
|
7
|
+
color: inherit;
|
|
8
|
+
text-decoration: none;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
a.anchor,
|
|
12
|
+
buton.anchor {
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
a.anchor:hover,
|
|
17
|
+
button.anchor:hover {
|
|
18
|
+
color: var(--color-primary);
|
|
19
|
+
text-decoration: underline;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.hoverCard {
|
|
23
|
+
padding: var(--space-xsmall) var(--space-large) var(--space-xsmall) var(--space-small);
|
|
24
|
+
border-radius: var(--radius-medium);
|
|
25
|
+
max-width: 320px;
|
|
26
|
+
outline: none;
|
|
27
|
+
filter: drop-shadow(0 0 var(--space-xxsmall) var(--color-shadow));
|
|
28
|
+
will-change: filter;
|
|
29
|
+
background: var(--color-light);
|
|
30
|
+
font-size: var(--size-small);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.closeBtn {
|
|
34
|
+
position: absolute;
|
|
35
|
+
right: 0;
|
|
36
|
+
top: var(--space-xxxsmall);
|
|
37
|
+
width: var(--space-large);
|
|
38
|
+
height: var(--space-large);
|
|
39
|
+
padding: var(--space-xxsmall);
|
|
40
|
+
background: none;
|
|
41
|
+
border: none;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
color: var(--color-text-ultra-light);
|
|
44
|
+
transition: var(--transition-out);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.closeBtn:hover,
|
|
48
|
+
.closeBtn:active,
|
|
49
|
+
.closeBtn:focus {
|
|
50
|
+
color: var(--color-text-light);
|
|
51
|
+
transition: var(--transition-in);
|
|
52
|
+
}
|
|
@@ -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
|
@@ -17,14 +17,14 @@ const ICONS = {
|
|
|
17
17
|
SORT: 'sort',
|
|
18
18
|
WARNING: 'warning'
|
|
19
19
|
};
|
|
20
|
-
export const Icon =
|
|
21
|
-
|
|
20
|
+
export const Icon = props => {
|
|
21
|
+
const {
|
|
22
22
|
className,
|
|
23
23
|
glyph,
|
|
24
24
|
as: Component,
|
|
25
25
|
size,
|
|
26
26
|
...restProps
|
|
27
|
-
} =
|
|
27
|
+
} = props;
|
|
28
28
|
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
29
29
|
className: cx(css.root, className, css[size])
|
|
30
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';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './tag';
|
|
@@ -0,0 +1,45 @@
|
|
|
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 PropTypes from 'prop-types';
|
|
5
|
+
import cx from 'classnames';
|
|
6
|
+
import css from './tag.module.css';
|
|
7
|
+
export const KINDS = {
|
|
8
|
+
DEFAULT: 'default',
|
|
9
|
+
SUCCESS: 'success',
|
|
10
|
+
INFO: 'info',
|
|
11
|
+
WARNING: 'warning',
|
|
12
|
+
DANGER: 'danger'
|
|
13
|
+
};
|
|
14
|
+
export const SIZES = {
|
|
15
|
+
SMALL: 'small',
|
|
16
|
+
MEDIUM: 'medium',
|
|
17
|
+
LARGE: 'large'
|
|
18
|
+
};
|
|
19
|
+
export const Tag = props => {
|
|
20
|
+
const {
|
|
21
|
+
className = '',
|
|
22
|
+
as: Component = 'span',
|
|
23
|
+
kind = KINDS.DEFAULT,
|
|
24
|
+
size = SIZES.MEDIUM,
|
|
25
|
+
...restProps
|
|
26
|
+
} = props;
|
|
27
|
+
const rootClassName = cx(css.root, className, css[kind], css[size]);
|
|
28
|
+
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
29
|
+
className: rootClassName
|
|
30
|
+
}, restProps));
|
|
31
|
+
};
|
|
32
|
+
Tag.propTypes = {
|
|
33
|
+
className: PropTypes.string,
|
|
34
|
+
as: PropTypes.elementType,
|
|
35
|
+
kind: PropTypes.oneOf(Object.values(KINDS)),
|
|
36
|
+
size: PropTypes.oneOf(Object.values(SIZES))
|
|
37
|
+
};
|
|
38
|
+
Tag.defaultProps = {
|
|
39
|
+
className: '',
|
|
40
|
+
as: 'span',
|
|
41
|
+
kind: KINDS.DEFAULT,
|
|
42
|
+
size: SIZES.MEDIUM
|
|
43
|
+
};
|
|
44
|
+
Tag.KINDS = KINDS;
|
|
45
|
+
Tag.SIZES = SIZES;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
font-family: var(--font-family);
|
|
4
|
+
font-weight: bold;
|
|
5
|
+
background: var(--color-text-light);
|
|
6
|
+
color: var(--color-light);
|
|
7
|
+
text-align: center;
|
|
8
|
+
text-transform: uppercase;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** Kind variation */
|
|
12
|
+
.success {
|
|
13
|
+
background: var(--color-success);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.info {
|
|
17
|
+
background: var(--color-info);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.warning {
|
|
21
|
+
background: var(--color-warning-dark);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.danger {
|
|
25
|
+
background: var(--color-danger);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Size variation */
|
|
29
|
+
/** default: medium */
|
|
30
|
+
.root {
|
|
31
|
+
border-radius: var(--radius-medium);
|
|
32
|
+
padding: var(--space-xxxsmall);
|
|
33
|
+
min-width: var(--space-small);
|
|
34
|
+
height: var(--space-small);
|
|
35
|
+
font-size: 9px;
|
|
36
|
+
line-height: 1;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.small {
|
|
40
|
+
border-radius: var(--radius-small);
|
|
41
|
+
padding: calc(var(--space-xxxsmall) / 2);
|
|
42
|
+
height: var(--space-xsmall);
|
|
43
|
+
min-width: var(--space-xsmall);
|
|
44
|
+
font-size: 8px;
|
|
45
|
+
line-height: 1;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.large {
|
|
49
|
+
border-radius: var(--radius-large);
|
|
50
|
+
padding: var(--space-xxxsmall) var(--space-xxsmall);
|
|
51
|
+
min-width: var(--space-medium);
|
|
52
|
+
height: var(--space-medium);
|
|
53
|
+
font-size: 12px;
|
|
54
|
+
line-height: var(--space-small);
|
|
55
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Tag } from '.';
|
|
2
|
+
export default {
|
|
3
|
+
title: 'UI/Tag',
|
|
4
|
+
component: Tag,
|
|
5
|
+
argTypes: {
|
|
6
|
+
kind: {
|
|
7
|
+
control: 'select',
|
|
8
|
+
options: Object.values(Tag.KINDS)
|
|
9
|
+
},
|
|
10
|
+
size: {
|
|
11
|
+
control: 'select',
|
|
12
|
+
options: Object.values(Tag.SIZES)
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
args: {
|
|
16
|
+
children: 'tag'
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export const Default = Tag.bind();
|
|
20
|
+
export const OneLetter = Tag.bind();
|
|
21
|
+
OneLetter.args = {
|
|
22
|
+
children: 'd'
|
|
23
|
+
};
|
|
@@ -3,7 +3,7 @@ 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 { Tooltip as UITooltip,
|
|
6
|
+
import { Tooltip as UITooltip, TooltipAnchor as UITooltipAnchor, TooltipArrow as UITooltipArrow, useTooltipState } from 'ariakit/tooltip';
|
|
7
7
|
import css from './tooltip.module.css';
|
|
8
8
|
export const Tooltip = props => {
|
|
9
9
|
const {
|
|
@@ -15,22 +15,23 @@ export const Tooltip = props => {
|
|
|
15
15
|
darkMode,
|
|
16
16
|
...restProps
|
|
17
17
|
} = props;
|
|
18
|
-
const
|
|
19
|
-
const tooltipProps = useTooltipState({
|
|
20
|
-
baseId: process.env.NODE_ENV === 'test' && 'id-test',
|
|
18
|
+
const tooltip = useTooltipState({
|
|
21
19
|
placement: 'top'
|
|
22
20
|
});
|
|
23
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(
|
|
21
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(UITooltipAnchor, _extends({
|
|
24
22
|
as: Component,
|
|
25
|
-
className:
|
|
23
|
+
className: cx(css.root, className),
|
|
24
|
+
state: tooltip
|
|
26
25
|
}, ref ? {
|
|
27
26
|
ref
|
|
28
|
-
} : {}, restProps
|
|
27
|
+
} : {}, restProps), children), title && /*#__PURE__*/React.createElement(UITooltip, {
|
|
28
|
+
state: tooltip,
|
|
29
29
|
className: cx(css.tooltip, darkMode && css.tooltipDarkMode)
|
|
30
|
-
}
|
|
30
|
+
}, /*#__PURE__*/React.createElement(UITooltipArrow, {
|
|
31
|
+
state: tooltip,
|
|
31
32
|
className: css.arrow,
|
|
32
33
|
size: 12
|
|
33
|
-
})
|
|
34
|
+
}), title));
|
|
34
35
|
};
|
|
35
36
|
Tooltip.defaultProps = {
|
|
36
37
|
className: '',
|
|
@@ -12,7 +12,7 @@
|
|
|
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));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bundle-stats/ui",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.6-beta.3",
|
|
4
4
|
"description": "UI components for BundleStats projects.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-esm/index.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"generate-svg-sprite": "npx svg-sprite -s --si --no-svg-namespace-classnames src/assets/icons/*.svg && mv symbol/svg/sprite.symbol.svg src/assets/icons.svg",
|
|
16
16
|
"lint": "../../node_modules/.bin/eslint . --ext .jsx,.js",
|
|
17
17
|
"start": "cross-env NODE_ENV=development start-storybook -c ./build/storybook -p 8080",
|
|
18
|
-
"test": "npm run test:unit
|
|
18
|
+
"test": "npm run test:unit",
|
|
19
19
|
"test:unit": "jest src --passWithNoTests",
|
|
20
20
|
"test:storyshots": "jest build/storybook ",
|
|
21
21
|
"chromatic": "chromatic --exit-zero-on-changes"
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
},
|
|
37
37
|
"homepage": "https://github.com/relative-ci/bundle-stats/blob/master/packages/ui#readme",
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@babel/cli": "7.17.
|
|
40
|
-
"@babel/core": "7.17.
|
|
39
|
+
"@babel/cli": "7.17.6",
|
|
40
|
+
"@babel/core": "7.17.5",
|
|
41
41
|
"@babel/plugin-proposal-class-properties": "7.16.7",
|
|
42
42
|
"@babel/preset-env": "7.16.11",
|
|
43
43
|
"@babel/preset-react": "7.16.7",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"babel-jest": "27.5.1",
|
|
55
55
|
"babel-plugin-lodash": "3.3.4",
|
|
56
56
|
"babel-plugin-require-context-hook": "1.0.0",
|
|
57
|
-
"chromatic": "6.
|
|
57
|
+
"chromatic": "6.5.1",
|
|
58
58
|
"classnames": "2.3.1",
|
|
59
59
|
"colormap": "2.3.2",
|
|
60
60
|
"core-js": "3.20.2",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"jest": "27.5.1",
|
|
68
68
|
"jest-date-mock": "1.0.8",
|
|
69
69
|
"lodash": "4.17.21",
|
|
70
|
-
"postcss": "8.4.
|
|
70
|
+
"postcss": "8.4.7",
|
|
71
71
|
"prop-types": "15.8.1",
|
|
72
72
|
"react": "16.14.0",
|
|
73
73
|
"react-dom": "16.14.0",
|
|
@@ -85,12 +85,12 @@
|
|
|
85
85
|
"react-router-dom": "5.3.0"
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
|
-
"@bundle-stats/utils": "^3.2.
|
|
88
|
+
"@bundle-stats/utils": "^3.2.6-beta.3",
|
|
89
|
+
"ariakit": "2.0.0-alpha.18",
|
|
89
90
|
"date-fns": "2.28.0",
|
|
90
91
|
"modern-css-reset": "1.4.0",
|
|
91
92
|
"query-string": "7.1.1",
|
|
92
|
-
"reakit": "1.3.11",
|
|
93
93
|
"use-query-params": "1.2.3"
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "5506d2cdd38520c254fb10b9f92f6f27b8b1f251"
|
|
96
96
|
}
|