@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.
@@ -1,66 +1,78 @@
1
- import f from "@babel/runtime/helpers/esm/classCallCheck";
2
- import u from "@babel/runtime/helpers/esm/createClass";
3
- import a from "@babel/runtime/helpers/esm/assertThisInitialized";
4
- import c from "@babel/runtime/helpers/esm/inherits";
5
- import d from "@babel/runtime/helpers/esm/createSuper";
6
- import s from "@babel/runtime/helpers/esm/defineProperty";
7
- import m from "react";
8
- import { Component as p } from "@semcore/core";
9
- var R = /* @__PURE__ */ function(h) {
10
- c(n, h);
11
- var o = d(n);
12
- function n() {
13
- for (var e, t = arguments.length, r = new Array(t), i = 0; i < t; i++)
14
- r[i] = arguments[i];
15
- return f(this, n), e = o.call.apply(o, [this].concat(r)), s(a(e), "state", {
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
- }), s(a(e), "containerRef", /* @__PURE__ */ m.createRef()), e;
22
+ });
23
+ _defineProperty(_assertThisInitialized(_this), "containerRef", /* @__PURE__ */ React.createRef());
24
+ return _this;
19
25
  }
20
- return u(n, [{
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(t) {
28
- (t.w !== this.props.w || t.h !== this.props.h || t.data !== this.props.data) && this.setSizes();
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 t = this.state, r = t.width, i = t.height;
34
- return r / i * this.defaultHeight;
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 t = this.containerRef.current.getBoundingClientRect(), r = t.width, i = t.height;
56
- r > 0 && i > 0 && this.setState({
57
- width: r,
58
- height: i
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
- }]), n;
63
- }(p);
73
+ }]);
74
+ return Trend2;
75
+ }(Component);
64
76
  export {
65
- R as Trend
77
+ Trend
66
78
  };
package/lib/esm/index.mjs CHANGED
@@ -1,16 +1,16 @@
1
- import { ScoreSemiDonut as r, ScoreDonut as o } from "./component/score/Donut.mjs";
2
- import { ScoreLine as e } from "./component/score/Line.mjs";
3
- import { TrendLine as m, TrendArea as i } from "./component/trend/Line.mjs";
4
- import { TrendBar as t, TrendHistogram as n } from "./component/trend/Bar.mjs";
5
- var S = {
6
- TrendLine: m,
7
- TrendArea: i,
8
- TrendBar: t,
9
- TrendHistogram: n,
10
- ScoreSemiDonut: r,
11
- ScoreDonut: o,
12
- ScoreLine: e
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
- S as default
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.2",
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.2",
18
- "@semcore/utils": "4.48.2"
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.17.5",
21
+ "@semcore/core": "^2.39.3-prerelease.0",
22
22
  "react": "16.8 - 18",
23
23
  "react-dom": "16.8 - 18"
24
24
  },