@semcore/mini-chart 0.29.2 → 0.29.3-prerelease.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/CHANGELOG.md +6 -0
- package/lib/cjs/component/score/Donut.js +12 -10
- package/lib/cjs/component/score/Donut.js.map +1 -1
- package/lib/cjs/component/score/Line.js +21 -19
- package/lib/cjs/component/score/Line.js.map +1 -1
- package/lib/cjs/component/trend/Bar.js +10 -8
- package/lib/cjs/component/trend/Bar.js.map +1 -1
- package/lib/cjs/component/trend/Line.js +10 -8
- package/lib/cjs/component/trend/Line.js.map +1 -1
- package/lib/es6/component/score/Donut.js +12 -10
- package/lib/es6/component/score/Donut.js.map +1 -1
- package/lib/es6/component/score/Line.js +21 -19
- package/lib/es6/component/score/Line.js.map +1 -1
- package/lib/es6/component/trend/Bar.js +10 -8
- package/lib/es6/component/trend/Bar.js.map +1 -1
- package/lib/es6/component/trend/Line.js +10 -8
- package/lib/es6/component/trend/Line.js.map +1 -1
- package/lib/esm/component/score/Donut.mjs +106 -86
- package/lib/esm/component/score/Line.mjs +107 -84
- package/lib/esm/component/score/donut.shadow.css +17 -0
- package/lib/esm/component/score/line.shadow.css +62 -0
- package/lib/esm/component/skeleton/skeleton.shadow.css +24 -0
- package/lib/esm/component/trend/Bar.mjs +87 -71
- package/lib/esm/component/trend/Line.mjs +121 -102
- package/lib/esm/component/trend/Trend.mjs +47 -35
- package/lib/esm/index.mjs +13 -13
- package/package.json +4 -4
|
@@ -1,66 +1,78 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { Component
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
7
|
+
import React from "react";
|
|
8
|
+
import { Component } from "@semcore/core";
|
|
9
|
+
var Trend = /* @__PURE__ */ function(_Component) {
|
|
10
|
+
_inherits(Trend2, _Component);
|
|
11
|
+
var _super = _createSuper(Trend2);
|
|
12
|
+
function Trend2() {
|
|
13
|
+
var _this;
|
|
14
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
15
|
+
args[_key] = arguments[_key];
|
|
16
|
+
}
|
|
17
|
+
_classCallCheck(this, Trend2);
|
|
18
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
19
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
16
20
|
width: 200,
|
|
17
21
|
height: 100
|
|
18
|
-
})
|
|
22
|
+
});
|
|
23
|
+
_defineProperty(_assertThisInitialized(_this), "containerRef", /* @__PURE__ */ React.createRef());
|
|
24
|
+
return _this;
|
|
19
25
|
}
|
|
20
|
-
|
|
26
|
+
_createClass(Trend2, [{
|
|
21
27
|
key: "componentDidMount",
|
|
22
|
-
value: function() {
|
|
28
|
+
value: function componentDidMount() {
|
|
23
29
|
this.setSizes();
|
|
24
30
|
}
|
|
25
31
|
}, {
|
|
26
32
|
key: "componentDidUpdate",
|
|
27
|
-
value: function(
|
|
28
|
-
(
|
|
33
|
+
value: function componentDidUpdate(prevProps) {
|
|
34
|
+
if (prevProps.w !== this.props.w || prevProps.h !== this.props.h || prevProps.data !== this.props.data) {
|
|
35
|
+
this.setSizes();
|
|
36
|
+
}
|
|
29
37
|
}
|
|
30
38
|
}, {
|
|
31
39
|
key: "defaultWidth",
|
|
32
|
-
get: function() {
|
|
33
|
-
var
|
|
34
|
-
return
|
|
40
|
+
get: function get() {
|
|
41
|
+
var _this$state = this.state, width = _this$state.width, height = _this$state.height;
|
|
42
|
+
return width / height * this.defaultHeight;
|
|
35
43
|
}
|
|
36
44
|
}, {
|
|
37
45
|
key: "defaultHeight",
|
|
38
|
-
get: function() {
|
|
46
|
+
get: function get() {
|
|
39
47
|
return 100;
|
|
40
48
|
}
|
|
41
49
|
}, {
|
|
42
50
|
key: "svgWidth",
|
|
43
|
-
get: function() {
|
|
51
|
+
get: function get() {
|
|
44
52
|
return this.defaultWidth;
|
|
45
53
|
}
|
|
46
54
|
}, {
|
|
47
55
|
key: "svgHeight",
|
|
48
|
-
get: function() {
|
|
56
|
+
get: function get() {
|
|
49
57
|
return this.defaultHeight;
|
|
50
58
|
}
|
|
51
59
|
}, {
|
|
52
60
|
key: "setSizes",
|
|
53
|
-
value: function() {
|
|
61
|
+
value: function setSizes() {
|
|
54
62
|
if (this.containerRef.current) {
|
|
55
|
-
var
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
var boundingClientRect = this.containerRef.current.getBoundingClientRect();
|
|
64
|
+
var width = boundingClientRect.width, height = boundingClientRect.height;
|
|
65
|
+
if (width > 0 && height > 0) {
|
|
66
|
+
this.setState({
|
|
67
|
+
width,
|
|
68
|
+
height
|
|
69
|
+
});
|
|
70
|
+
}
|
|
60
71
|
}
|
|
61
72
|
}
|
|
62
|
-
}])
|
|
63
|
-
|
|
73
|
+
}]);
|
|
74
|
+
return Trend2;
|
|
75
|
+
}(Component);
|
|
64
76
|
export {
|
|
65
|
-
|
|
77
|
+
Trend
|
|
66
78
|
};
|
package/lib/esm/index.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { ScoreSemiDonut
|
|
2
|
-
import { ScoreLine
|
|
3
|
-
import { TrendLine
|
|
4
|
-
import { TrendBar
|
|
5
|
-
var
|
|
6
|
-
TrendLine
|
|
7
|
-
TrendArea
|
|
8
|
-
TrendBar
|
|
9
|
-
TrendHistogram
|
|
10
|
-
ScoreSemiDonut
|
|
11
|
-
ScoreDonut
|
|
12
|
-
ScoreLine
|
|
1
|
+
import { ScoreSemiDonut, ScoreDonut } from "./component/score/Donut.mjs";
|
|
2
|
+
import { ScoreLine } from "./component/score/Line.mjs";
|
|
3
|
+
import { TrendLine, TrendArea } from "./component/trend/Line.mjs";
|
|
4
|
+
import { TrendBar, TrendHistogram } from "./component/trend/Bar.mjs";
|
|
5
|
+
var miniCharts = {
|
|
6
|
+
TrendLine,
|
|
7
|
+
TrendArea,
|
|
8
|
+
TrendBar,
|
|
9
|
+
TrendHistogram,
|
|
10
|
+
ScoreSemiDonut,
|
|
11
|
+
ScoreDonut,
|
|
12
|
+
ScoreLine
|
|
13
13
|
};
|
|
14
14
|
export {
|
|
15
|
-
|
|
15
|
+
miniCharts as default
|
|
16
16
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/mini-chart",
|
|
3
3
|
"description": "Semrush MiniChart Component",
|
|
4
|
-
"version": "0.29.
|
|
4
|
+
"version": "0.29.3-prerelease.0",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"types": "./lib/types/index.d.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/flex-box": "5.41.
|
|
18
|
-
"@semcore/utils": "4.48.
|
|
17
|
+
"@semcore/flex-box": "5.41.3-prerelease.0",
|
|
18
|
+
"@semcore/utils": "4.48.4-prerelease.0"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@semcore/core": "^2.
|
|
21
|
+
"@semcore/core": "^2.39.3-prerelease.0",
|
|
22
22
|
"react": "16.8 - 18",
|
|
23
23
|
"react-dom": "16.8 - 18"
|
|
24
24
|
},
|