@bundle-stats/ui 4.0.4 → 4.0.5-beta.0
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/lib/components/summary-item/summary-item.js +2 -0
- package/lib/ui/skeleton/skeleton.js +11 -5
- package/lib/ui/skeleton/skeleton.module.css +6 -2
- package/lib/ui/skeleton/skeleton.stories.js +44 -9
- package/lib-esm/components/summary-item/summary-item.js +2 -0
- package/lib-esm/ui/skeleton/skeleton.js +10 -4
- package/lib-esm/ui/skeleton/skeleton.module.css +6 -2
- package/lib-esm/ui/skeleton/skeleton.stories.js +28 -5
- package/package.json +3 -3
- package/src/components/summary-item/summary-item.jsx +2 -2
- package/src/ui/skeleton/skeleton.jsx +7 -3
- package/src/ui/skeleton/skeleton.module.css +6 -2
|
@@ -102,8 +102,10 @@ var SummaryItem = function SummaryItem(_ref2) {
|
|
|
102
102
|
value: baseline,
|
|
103
103
|
formatter: metric.formatter
|
|
104
104
|
})) : /*#__PURE__*/_react["default"].createElement(_stack.Stack, null, /*#__PURE__*/_react["default"].createElement(_skeleton.Skeleton, {
|
|
105
|
+
as: "p",
|
|
105
106
|
className: (0, _classnames["default"])(_summaryItemModule["default"].currentMetric, _summaryItemModule["default"].loading)
|
|
106
107
|
}), /*#__PURE__*/_react["default"].createElement(_skeleton.Skeleton, {
|
|
108
|
+
as: "p",
|
|
107
109
|
className: (0, _classnames["default"])(_summaryItemModule["default"].baselineMetric, _summaryItemModule["default"].loading)
|
|
108
110
|
})));
|
|
109
111
|
};
|
|
@@ -13,7 +13,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
13
13
|
|
|
14
14
|
var _skeletonModule = _interopRequireDefault(require("./skeleton.module.css"));
|
|
15
15
|
|
|
16
|
-
var _excluded = ["className"];
|
|
16
|
+
var _excluded = ["className", "as", "block"];
|
|
17
17
|
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
19
|
|
|
@@ -25,18 +25,24 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
25
25
|
|
|
26
26
|
var Skeleton = function Skeleton(props) {
|
|
27
27
|
var className = props.className,
|
|
28
|
+
Component = props.as,
|
|
29
|
+
block = props.block,
|
|
28
30
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
29
31
|
|
|
30
|
-
var rootClassName = (0, _classnames["default"])(_skeletonModule["default"].root, className);
|
|
31
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
32
|
+
var rootClassName = (0, _classnames["default"])(_skeletonModule["default"].root, className, block && _skeletonModule["default"].block);
|
|
33
|
+
return /*#__PURE__*/_react["default"].createElement(Component, _extends({
|
|
32
34
|
className: rootClassName
|
|
33
35
|
}, restProps));
|
|
34
36
|
};
|
|
35
37
|
|
|
36
38
|
exports.Skeleton = Skeleton;
|
|
37
39
|
Skeleton.propTypes = {
|
|
38
|
-
className: _propTypes["default"].string
|
|
40
|
+
className: _propTypes["default"].string,
|
|
41
|
+
as: _propTypes["default"].elementType,
|
|
42
|
+
block: _propTypes["default"].bool
|
|
39
43
|
};
|
|
40
44
|
Skeleton.defaultProps = {
|
|
41
|
-
className: ''
|
|
45
|
+
className: '',
|
|
46
|
+
as: 'span',
|
|
47
|
+
block: false
|
|
42
48
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
.root {
|
|
2
|
-
|
|
3
|
-
background: linear-gradient(transparent 10%, currentColor 10.1%, currentColor 90%, transparent 90.1%);
|
|
2
|
+
background: linear-gradient(transparent 12.5%, currentColor 12.6%, currentColor 86.4%, transparent 86.5%);
|
|
4
3
|
opacity: 0.06;
|
|
5
4
|
pointer-events: none;
|
|
5
|
+
min-width: 6em;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
/** empty char to keep the text height */
|
|
@@ -11,3 +11,7 @@
|
|
|
11
11
|
content: '\A0';
|
|
12
12
|
color: transparent;
|
|
13
13
|
}
|
|
14
|
+
|
|
15
|
+
.block {
|
|
16
|
+
background: currentColor;
|
|
17
|
+
}
|
|
@@ -1,17 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = exports.MultipleTextLines = exports.Block = void 0;
|
|
6
7
|
|
|
7
|
-
var
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
9
|
|
|
9
10
|
var _ = require(".");
|
|
10
11
|
|
|
11
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
13
|
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
var _default = {
|
|
15
|
+
title: 'UI/Skeleton',
|
|
16
|
+
component: _.Skeleton
|
|
17
|
+
};
|
|
18
|
+
exports["default"] = _default;
|
|
19
|
+
|
|
20
|
+
var MultipleTextLines = function MultipleTextLines() {
|
|
21
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_.Skeleton, {
|
|
22
|
+
as: "h1",
|
|
23
|
+
style: {
|
|
24
|
+
outline: '1px solid magenta'
|
|
25
|
+
}
|
|
26
|
+
}), /*#__PURE__*/_react["default"].createElement(_.Skeleton, {
|
|
27
|
+
as: "h2",
|
|
28
|
+
style: {
|
|
29
|
+
outline: '1px solid magenta'
|
|
30
|
+
}
|
|
31
|
+
}), /*#__PURE__*/_react["default"].createElement(_.Skeleton, {
|
|
32
|
+
as: "p",
|
|
33
|
+
style: {
|
|
34
|
+
outline: '1px solid magenta'
|
|
35
|
+
}
|
|
36
|
+
}));
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
exports.MultipleTextLines = MultipleTextLines;
|
|
40
|
+
|
|
41
|
+
var Block = function Block() {
|
|
42
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
43
|
+
style: {
|
|
44
|
+
outline: '1px solid magenta'
|
|
45
|
+
}
|
|
46
|
+
}, /*#__PURE__*/_react["default"].createElement(_.Skeleton, {
|
|
47
|
+
as: "div",
|
|
48
|
+
block: true
|
|
49
|
+
}));
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
exports.Block = Block;
|
|
@@ -78,8 +78,10 @@ export const SummaryItem = _ref2 => {
|
|
|
78
78
|
value: baseline,
|
|
79
79
|
formatter: metric.formatter
|
|
80
80
|
})) : /*#__PURE__*/React.createElement(Stack, null, /*#__PURE__*/React.createElement(Skeleton, {
|
|
81
|
+
as: "p",
|
|
81
82
|
className: cx(css.currentMetric, css.loading)
|
|
82
83
|
}), /*#__PURE__*/React.createElement(Skeleton, {
|
|
84
|
+
as: "p",
|
|
83
85
|
className: cx(css.baselineMetric, css.loading)
|
|
84
86
|
})));
|
|
85
87
|
};
|
|
@@ -7,16 +7,22 @@ import css from './skeleton.module.css';
|
|
|
7
7
|
export const Skeleton = props => {
|
|
8
8
|
const {
|
|
9
9
|
className,
|
|
10
|
+
as: Component,
|
|
11
|
+
block,
|
|
10
12
|
...restProps
|
|
11
13
|
} = props;
|
|
12
|
-
const rootClassName = cx(css.root, className);
|
|
13
|
-
return /*#__PURE__*/React.createElement(
|
|
14
|
+
const rootClassName = cx(css.root, className, block && css.block);
|
|
15
|
+
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
14
16
|
className: rootClassName
|
|
15
17
|
}, restProps));
|
|
16
18
|
};
|
|
17
19
|
Skeleton.propTypes = {
|
|
18
|
-
className: PropTypes.string
|
|
20
|
+
className: PropTypes.string,
|
|
21
|
+
as: PropTypes.elementType,
|
|
22
|
+
block: PropTypes.bool
|
|
19
23
|
};
|
|
20
24
|
Skeleton.defaultProps = {
|
|
21
|
-
className: ''
|
|
25
|
+
className: '',
|
|
26
|
+
as: 'span',
|
|
27
|
+
block: false
|
|
22
28
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
.root {
|
|
2
|
-
|
|
3
|
-
background: linear-gradient(transparent 10%, currentColor 10.1%, currentColor 90%, transparent 90.1%);
|
|
2
|
+
background: linear-gradient(transparent 12.5%, currentColor 12.6%, currentColor 86.4%, transparent 86.5%);
|
|
4
3
|
opacity: 0.06;
|
|
5
4
|
pointer-events: none;
|
|
5
|
+
min-width: 6em;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
/** empty char to keep the text height */
|
|
@@ -11,3 +11,7 @@
|
|
|
11
11
|
content: '\A0';
|
|
12
12
|
color: transparent;
|
|
13
13
|
}
|
|
14
|
+
|
|
15
|
+
.block {
|
|
16
|
+
background: currentColor;
|
|
17
|
+
}
|
|
@@ -1,7 +1,30 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { storiesOf } from '@storybook/react';
|
|
3
|
-
import { getWrapperDecorator } from '../../stories';
|
|
4
2
|
import { Skeleton } from '.';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
export default {
|
|
4
|
+
title: 'UI/Skeleton',
|
|
5
|
+
component: Skeleton
|
|
6
|
+
};
|
|
7
|
+
export const MultipleTextLines = () => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Skeleton, {
|
|
8
|
+
as: "h1",
|
|
9
|
+
style: {
|
|
10
|
+
outline: '1px solid magenta'
|
|
11
|
+
}
|
|
12
|
+
}), /*#__PURE__*/React.createElement(Skeleton, {
|
|
13
|
+
as: "h2",
|
|
14
|
+
style: {
|
|
15
|
+
outline: '1px solid magenta'
|
|
16
|
+
}
|
|
17
|
+
}), /*#__PURE__*/React.createElement(Skeleton, {
|
|
18
|
+
as: "p",
|
|
19
|
+
style: {
|
|
20
|
+
outline: '1px solid magenta'
|
|
21
|
+
}
|
|
22
|
+
}));
|
|
23
|
+
export const Block = () => /*#__PURE__*/React.createElement("div", {
|
|
24
|
+
style: {
|
|
25
|
+
outline: '1px solid magenta'
|
|
26
|
+
}
|
|
27
|
+
}, /*#__PURE__*/React.createElement(Skeleton, {
|
|
28
|
+
as: "div",
|
|
29
|
+
block: true
|
|
30
|
+
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bundle-stats/ui",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.5-beta.0",
|
|
4
4
|
"description": "UI components for BundleStats projects.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-esm/index.js",
|
|
@@ -85,12 +85,12 @@
|
|
|
85
85
|
"react-router-dom": "^5.0.0"
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
|
-
"@bundle-stats/utils": "^4.0.
|
|
88
|
+
"@bundle-stats/utils": "^4.0.5-beta.0",
|
|
89
89
|
"ariakit": "^2.0.0-next.33",
|
|
90
90
|
"date-fns": "^2.28.0",
|
|
91
91
|
"modern-css-reset": "^1.4.0",
|
|
92
92
|
"query-string": "^7.1.0",
|
|
93
93
|
"use-query-params": "^1.2.3"
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "21c3e6e8dcf686e4aaa8205a4a0d3d9d2154cf30"
|
|
96
96
|
}
|
|
@@ -84,8 +84,8 @@ export const SummaryItem = ({
|
|
|
84
84
|
</Stack>
|
|
85
85
|
) : (
|
|
86
86
|
<Stack>
|
|
87
|
-
<Skeleton className={cx(css.currentMetric, css.loading)} />
|
|
88
|
-
<Skeleton className={cx(css.baselineMetric, css.loading)} />
|
|
87
|
+
<Skeleton as="p" className={cx(css.currentMetric, css.loading)} />
|
|
88
|
+
<Skeleton as="p" className={cx(css.baselineMetric, css.loading)} />
|
|
89
89
|
</Stack>
|
|
90
90
|
)}
|
|
91
91
|
</Stack>
|
|
@@ -5,16 +5,20 @@ import cx from 'classnames';
|
|
|
5
5
|
import css from './skeleton.module.css';
|
|
6
6
|
|
|
7
7
|
export const Skeleton = (props) => {
|
|
8
|
-
const { className, ...restProps } = props;
|
|
9
|
-
const rootClassName = cx(css.root, className);
|
|
8
|
+
const { className, as: Component, block, ...restProps } = props;
|
|
9
|
+
const rootClassName = cx(css.root, className, block && css.block);
|
|
10
10
|
|
|
11
|
-
return <
|
|
11
|
+
return <Component className={rootClassName} {...restProps} />;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
Skeleton.propTypes = {
|
|
15
15
|
className: PropTypes.string,
|
|
16
|
+
as: PropTypes.elementType,
|
|
17
|
+
block: PropTypes.bool,
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
Skeleton.defaultProps = {
|
|
19
21
|
className: '',
|
|
22
|
+
as: 'span',
|
|
23
|
+
block: false,
|
|
20
24
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
.root {
|
|
2
|
-
|
|
3
|
-
background: linear-gradient(transparent 10%, currentColor 10.1%, currentColor 90%, transparent 90.1%);
|
|
2
|
+
background: linear-gradient(transparent 12.5%, currentColor 12.6%, currentColor 86.4%, transparent 86.5%);
|
|
4
3
|
opacity: 0.06;
|
|
5
4
|
pointer-events: none;
|
|
5
|
+
min-width: 6em;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
/** empty char to keep the text height */
|
|
@@ -11,3 +11,7 @@
|
|
|
11
11
|
content: '\A0';
|
|
12
12
|
color: transparent;
|
|
13
13
|
}
|
|
14
|
+
|
|
15
|
+
.block {
|
|
16
|
+
background: currentColor;
|
|
17
|
+
}
|