@semcore/mini-chart 16.1.1 → 17.0.0-prerelease.17

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +4 -4
  3. package/lib/cjs/component/score/Donut.js +84 -96
  4. package/lib/cjs/component/score/Donut.js.map +1 -1
  5. package/lib/cjs/component/score/Line.js +104 -108
  6. package/lib/cjs/component/score/Line.js.map +1 -1
  7. package/lib/cjs/component/score/Line.types.js.map +1 -1
  8. package/lib/cjs/component/score/index.js +3 -3
  9. package/lib/cjs/component/trend/Bar.js +83 -96
  10. package/lib/cjs/component/trend/Bar.js.map +1 -1
  11. package/lib/cjs/component/trend/Line.js +114 -135
  12. package/lib/cjs/component/trend/Line.js.map +1 -1
  13. package/lib/cjs/component/trend/Trend.js +43 -65
  14. package/lib/cjs/component/trend/Trend.js.map +1 -1
  15. package/lib/cjs/component/trend/index.js +4 -4
  16. package/lib/cjs/index.js +3 -3
  17. package/lib/cjs/index.js.map +1 -1
  18. package/lib/cjs/utils/ScoreDonutUtils.js +48 -75
  19. package/lib/cjs/utils/ScoreDonutUtils.js.map +1 -1
  20. package/lib/es6/component/score/Donut.js +80 -93
  21. package/lib/es6/component/score/Donut.js.map +1 -1
  22. package/lib/es6/component/score/Line.js +99 -103
  23. package/lib/es6/component/score/Line.js.map +1 -1
  24. package/lib/es6/component/score/Line.types.js.map +1 -1
  25. package/lib/es6/component/trend/Bar.js +78 -91
  26. package/lib/es6/component/trend/Bar.js.map +1 -1
  27. package/lib/es6/component/trend/Line.js +109 -130
  28. package/lib/es6/component/trend/Line.js.map +1 -1
  29. package/lib/es6/component/trend/Trend.js +41 -64
  30. package/lib/es6/component/trend/Trend.js.map +1 -1
  31. package/lib/es6/index.js +8 -8
  32. package/lib/es6/index.js.map +1 -1
  33. package/lib/es6/utils/ScoreDonutUtils.js +43 -71
  34. package/lib/es6/utils/ScoreDonutUtils.js.map +1 -1
  35. package/lib/esm/component/score/Donut.mjs +80 -79
  36. package/lib/esm/component/score/Line.mjs +100 -91
  37. package/lib/esm/component/trend/Bar.mjs +79 -82
  38. package/lib/esm/component/trend/Line.mjs +110 -116
  39. package/lib/esm/component/trend/Trend.mjs +41 -61
  40. package/lib/esm/index.mjs +1 -1
  41. package/lib/esm/utils/ScoreDonutUtils.mjs +43 -71
  42. package/lib/types/component/score/Donut.d.ts +7 -12
  43. package/lib/types/component/score/Line.types.d.ts +8 -6
  44. package/lib/types/component/trend/Bar.d.ts +2 -8
  45. package/lib/types/component/trend/Line.d.ts +6 -10
  46. package/lib/types/component/trend/Trend.d.ts +3 -3
  47. package/package.json +4 -4
@@ -1,110 +1,107 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
- import _createClass from "@babel/runtime/helpers/esm/createClass";
5
- import _callSuper from "@babel/runtime/helpers/esm/callSuper";
6
- import _inherits from "@babel/runtime/helpers/esm/inherits";
7
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
8
2
  import { createComponent, assignProps, sstyled } from "@semcore/core";
3
+ import { Box } from "@semcore/base-components";
9
4
  import { extractAriaProps } from "@semcore/core/lib/utils/ariaProps";
10
5
  import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
11
- import { Box } from "@semcore/flex-box";
12
6
  import React from "react";
13
7
  import { Trend } from "./Trend.mjs";
14
8
  /*!__reshadow-styles__:"../skeleton/skeleton.shadow.css"*/
15
- var style = (
9
+ const style = (
16
10
  /*__reshadow_css_start__*/
17
11
  (sstyled.insert(
18
12
  /*__inner_css_start__*/
19
- "@keyframes pulse_1wd8q{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_1wd8q_gg_.__loading_1wd8q_gg_,.___SLineGauge_1wd8q_gg_.__loading_1wd8q_gg_,.___STrendBar_1wd8q_gg_.__loading_1wd8q_gg_,.___STrendLine_1wd8q_gg_.__loading_1wd8q_gg_{animation-name:pulse_1wd8q;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}",
13
+ "@keyframes pulse_1ydx6{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_1ydx6_gg_.__loading_1ydx6_gg_,.___SLineGauge_1ydx6_gg_.__loading_1ydx6_gg_,.___STrendBar_1ydx6_gg_.__loading_1ydx6_gg_,.___STrendLine_1ydx6_gg_.__loading_1ydx6_gg_{animation-name:pulse_1ydx6;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}",
20
14
  /*__inner_css_end__*/
21
- "1wd8q_gg_"
15
+ "1ydx6_gg_"
22
16
  ), /*__reshadow_css_end__*/
23
17
  {
24
- "__SLineGauge": "___SLineGauge_1wd8q_gg_",
25
- "_loading": "__loading_1wd8q_gg_",
26
- "__SDonutContainer": "___SDonutContainer_1wd8q_gg_",
27
- "__STrendLine": "___STrendLine_1wd8q_gg_",
28
- "__STrendBar": "___STrendBar_1wd8q_gg_",
29
- "@pulse": "pulse_1wd8q"
18
+ "__SLineGauge": "___SLineGauge_1ydx6_gg_",
19
+ "_loading": "__loading_1ydx6_gg_",
20
+ "__SDonutContainer": "___SDonutContainer_1ydx6_gg_",
21
+ "__STrendLine": "___STrendLine_1ydx6_gg_",
22
+ "__STrendBar": "___STrendBar_1ydx6_gg_",
23
+ "@pulse": "pulse_1ydx6"
30
24
  })
31
25
  );
32
- var TrendBarRoot = /* @__PURE__ */ (function(_Trend) {
33
- function TrendBarRoot2() {
34
- _classCallCheck(this, TrendBarRoot2);
35
- return _callSuper(this, TrendBarRoot2, arguments);
26
+ class TrendBarRoot extends Trend {
27
+ get defaultData() {
28
+ return [{
29
+ value: 20
30
+ }, {
31
+ value: 80
32
+ }, {
33
+ value: 45
34
+ }, {
35
+ value: 10
36
+ }];
36
37
  }
37
- _inherits(TrendBarRoot2, _Trend);
38
- return _createClass(TrendBarRoot2, [{
39
- key: "defaultData",
40
- get: function get() {
41
- return [{
42
- value: 20
43
- }, {
44
- value: 80
45
- }, {
46
- value: 45
47
- }, {
48
- value: 10
49
- }];
38
+ get data() {
39
+ const {
40
+ data,
41
+ loading
42
+ } = this.asProps;
43
+ if (loading) {
44
+ return this.defaultData;
50
45
  }
51
- }, {
52
- key: "data",
53
- get: function get() {
54
- var _this$asProps = this.asProps, data = _this$asProps.data, loading = _this$asProps.loading;
55
- if (loading) {
56
- return this.defaultData;
57
- }
58
- return data;
59
- }
60
- }, {
61
- key: "render",
62
- value: function render() {
63
- var _ref = this.asProps, _ref2, _this = this;
64
- var STrendBar = Box;
65
- var _this$asProps2 = this.asProps, styles = _this$asProps2.styles, resolveColor = _this$asProps2.resolveColor, isHistogram = _this$asProps2.isHistogram, animate = _this$asProps2.animate, loading = _this$asProps2.loading;
66
- var step = this.defaultWidth / this.data.length;
67
- var _extractAriaProps = extractAriaProps(this.asProps), __excludeProps = _extractAriaProps.__excludeProps, extractedAriaProps = _extractAriaProps.extractedAriaProps;
68
- return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(STrendBar, _ref2.cn("STrendBar", _objectSpread({}, assignProps({
46
+ return data;
47
+ }
48
+ render() {
49
+ var _ref = this.asProps, _ref2;
50
+ const STrendBar = Box;
51
+ const {
52
+ styles,
53
+ resolveColor,
54
+ isHistogram,
55
+ animate,
56
+ loading
57
+ } = this.asProps;
58
+ const step = this.defaultWidth / this.data.length;
59
+ const {
60
+ __excludeProps,
61
+ extractedAriaProps
62
+ } = extractAriaProps(this.asProps);
63
+ return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(STrendBar, _ref2.cn("STrendBar", {
64
+ ...assignProps({
69
65
  "ref": this.containerRef,
70
- "__excludeProps": ["data"].concat(_toConsumableArray(__excludeProps))
71
- }, _ref))), /* @__PURE__ */ React.createElement("svg", _ref2.cn("svg", _objectSpread({
72
- "width": "100%",
73
- "height": "100%",
74
- "viewBox": "0 0 ".concat(this.svgWidth, " ").concat(this.svgHeight),
75
- "role": "img"
76
- }, extractedAriaProps)), this.data.map(function(barItem, index) {
77
- var color = resolveColor("chart-palette-order-other-data");
78
- if (barItem.color) {
79
- color = resolveColor(barItem.color);
80
- }
81
- return /* @__PURE__ */ React.createElement("rect", {
82
- key: index,
83
- x: step * index,
84
- y: _this.defaultHeight - barItem.value,
85
- width: isHistogram ? step : step * 0.8,
86
- height: barItem.value,
87
- fill: color
88
- }, animate && !loading && /* @__PURE__ */ React.createElement("animate", {
89
- attributeName: "y",
90
- values: "".concat(_this.defaultHeight, ";").concat(_this.defaultHeight - barItem.value),
91
- dur: "500ms"
92
- }));
93
- })));
94
- }
95
- }]);
96
- })(Trend);
66
+ "__excludeProps": ["data", ...__excludeProps]
67
+ }, _ref)
68
+ }), /* @__PURE__ */ React.createElement("svg", _ref2.cn("svg", {
69
+ "width": "100%",
70
+ "height": "100%",
71
+ "viewBox": `0 0 ${this.svgWidth} ${this.svgHeight}`,
72
+ "role": "img",
73
+ ...extractedAriaProps
74
+ }), this.data.map((barItem, index) => {
75
+ let color = resolveColor("chart-palette-order-other-data");
76
+ if (barItem.color) {
77
+ color = resolveColor(barItem.color);
78
+ }
79
+ return /* @__PURE__ */ React.createElement("rect", {
80
+ key: index,
81
+ x: step * index,
82
+ y: this.defaultHeight - barItem.value,
83
+ width: isHistogram ? step : step * 0.8,
84
+ height: barItem.value,
85
+ fill: color
86
+ }, animate && !loading && /* @__PURE__ */ React.createElement("animate", {
87
+ attributeName: "y",
88
+ values: `${this.defaultHeight};${this.defaultHeight - barItem.value}`,
89
+ dur: "500ms"
90
+ }));
91
+ })));
92
+ }
93
+ }
97
94
  _defineProperty(TrendBarRoot, "enhance", [resolveColorEnhance()]);
98
95
  _defineProperty(TrendBarRoot, "style", style);
99
96
  _defineProperty(TrendBarRoot, "defaultProps", {
100
97
  animate: true
101
98
  });
102
- var TrendBar = createComponent(TrendBarRoot);
99
+ const TrendBar = createComponent(TrendBarRoot);
103
100
  TrendBar.displayName = "MiniChart.TrendBar";
104
- var TrendHistogram = createComponent(TrendBarRoot, {}, {
105
- enhancements: [function() {
101
+ const TrendHistogram = createComponent(TrendBarRoot, {}, {
102
+ enhancements: [() => {
106
103
  return {
107
- wrapperProps: function wrapperProps(props) {
104
+ wrapperProps: (props) => {
108
105
  return assignProps(props, {
109
106
  isHistogram: true
110
107
  });
@@ -1,147 +1,141 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
- import _createClass from "@babel/runtime/helpers/esm/createClass";
5
- import _callSuper from "@babel/runtime/helpers/esm/callSuper";
6
- import _inherits from "@babel/runtime/helpers/esm/inherits";
7
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
8
2
  import { createComponent, assignProps, sstyled } from "@semcore/core";
3
+ import { Box } from "@semcore/base-components";
9
4
  import { extractAriaProps } from "@semcore/core/lib/utils/ariaProps";
10
5
  import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
11
6
  import uniqueIDEnhancement from "@semcore/core/lib/utils/uniqueID";
12
- import { Box } from "@semcore/flex-box";
13
7
  import React from "react";
14
8
  import { Trend } from "./Trend.mjs";
15
9
  /*!__reshadow-styles__:"../skeleton/skeleton.shadow.css"*/
16
- var style = (
10
+ const style = (
17
11
  /*__reshadow_css_start__*/
18
12
  (sstyled.insert(
19
13
  /*__inner_css_start__*/
20
- "@keyframes pulse_1wd8q{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_1wd8q_gg_.__loading_1wd8q_gg_,.___SLineGauge_1wd8q_gg_.__loading_1wd8q_gg_,.___STrendBar_1wd8q_gg_.__loading_1wd8q_gg_,.___STrendLine_1wd8q_gg_.__loading_1wd8q_gg_{animation-name:pulse_1wd8q;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}",
14
+ "@keyframes pulse_1ydx6{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_1ydx6_gg_.__loading_1ydx6_gg_,.___SLineGauge_1ydx6_gg_.__loading_1ydx6_gg_,.___STrendBar_1ydx6_gg_.__loading_1ydx6_gg_,.___STrendLine_1ydx6_gg_.__loading_1ydx6_gg_{animation-name:pulse_1ydx6;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}",
21
15
  /*__inner_css_end__*/
22
- "1wd8q_gg_"
16
+ "1ydx6_gg_"
23
17
  ), /*__reshadow_css_end__*/
24
18
  {
25
- "__SLineGauge": "___SLineGauge_1wd8q_gg_",
26
- "_loading": "__loading_1wd8q_gg_",
27
- "__SDonutContainer": "___SDonutContainer_1wd8q_gg_",
28
- "__STrendLine": "___STrendLine_1wd8q_gg_",
29
- "__STrendBar": "___STrendBar_1wd8q_gg_",
30
- "@pulse": "pulse_1wd8q"
19
+ "__SLineGauge": "___SLineGauge_1ydx6_gg_",
20
+ "_loading": "__loading_1ydx6_gg_",
21
+ "__SDonutContainer": "___SDonutContainer_1ydx6_gg_",
22
+ "__STrendLine": "___STrendLine_1ydx6_gg_",
23
+ "__STrendBar": "___STrendBar_1ydx6_gg_",
24
+ "@pulse": "pulse_1ydx6"
31
25
  })
32
26
  );
33
- var TrendLineRoot = /* @__PURE__ */ (function(_Trend) {
34
- function TrendLineRoot2() {
35
- _classCallCheck(this, TrendLineRoot2);
36
- return _callSuper(this, TrendLineRoot2, arguments);
27
+ class TrendLineRoot extends Trend {
28
+ get defaultData() {
29
+ return [15, 70, 20, 85, 20];
37
30
  }
38
- _inherits(TrendLineRoot2, _Trend);
39
- return _createClass(TrendLineRoot2, [{
40
- key: "defaultData",
41
- get: function get() {
42
- return [15, 70, 20, 85, 20];
43
- }
44
- }, {
45
- key: "lastPointRadius",
46
- get: function get() {
47
- var _this$asProps$lastPoi;
48
- return (_this$asProps$lastPoi = this.asProps.lastPointRadius) !== null && _this$asProps$lastPoi !== void 0 ? _this$asProps$lastPoi : 6;
49
- }
50
- }, {
51
- key: "data",
52
- get: function get() {
53
- var _this$asProps = this.asProps, data = _this$asProps.data, loading = _this$asProps.loading;
54
- if (loading) {
55
- return this.defaultData;
56
- }
57
- return data;
58
- }
59
- }, {
60
- key: "svgWidth",
61
- get: function get() {
62
- return this.asProps.lastPointColor ? this.defaultWidth + this.lastPointRadius : this.defaultWidth;
31
+ get lastPointRadius() {
32
+ return this.asProps.lastPointRadius ?? 6;
33
+ }
34
+ get data() {
35
+ const {
36
+ data,
37
+ loading
38
+ } = this.asProps;
39
+ if (loading) {
40
+ return this.defaultData;
63
41
  }
64
- }, {
65
- key: "svgHeight",
66
- get: function get() {
67
- return this.asProps.lastPointColor ? this.defaultHeight + this.lastPointRadius : this.defaultHeight;
42
+ return data;
43
+ }
44
+ get svgWidth() {
45
+ return this.asProps.lastPointColor ? this.defaultWidth + this.lastPointRadius : this.defaultWidth;
46
+ }
47
+ get svgHeight() {
48
+ return this.asProps.lastPointColor ? this.defaultHeight + this.lastPointRadius : this.defaultHeight;
49
+ }
50
+ get color() {
51
+ const {
52
+ resolveColor,
53
+ color = "chart-palette-order-1",
54
+ loading
55
+ } = this.asProps;
56
+ if (loading) {
57
+ return resolveColor("skeleton-bg");
68
58
  }
69
- }, {
70
- key: "color",
71
- get: function get() {
72
- var _this$asProps2 = this.asProps, resolveColor = _this$asProps2.resolveColor, _this$asProps2$color = _this$asProps2.color, color = _this$asProps2$color === void 0 ? "chart-palette-order-1" : _this$asProps2$color, loading = _this$asProps2.loading;
73
- if (loading) {
74
- return resolveColor("skeleton-bg");
75
- }
76
- return resolveColor(color);
59
+ return resolveColor(color);
60
+ }
61
+ render() {
62
+ var _ref = this.asProps, _ref2;
63
+ const STrendLine = Box;
64
+ const {
65
+ uid,
66
+ withArea,
67
+ animate,
68
+ lastPointColor,
69
+ resolveColor,
70
+ loading,
71
+ styles
72
+ } = this.asProps;
73
+ const points = [];
74
+ const length = this.data.length;
75
+ const step = this.defaultWidth / (length - 1);
76
+ for (let i = 0; i < length; i++) {
77
+ points.push(`${step * i},${this.defaultHeight - this.data[i]}`);
77
78
  }
78
- }, {
79
- key: "render",
80
- value: function render() {
81
- var _ref = this.asProps, _ref2;
82
- var STrendLine = Box;
83
- var _this$asProps3 = this.asProps, uid = _this$asProps3.uid, withArea = _this$asProps3.withArea, animate = _this$asProps3.animate, lastPointColor = _this$asProps3.lastPointColor, resolveColor = _this$asProps3.resolveColor, loading = _this$asProps3.loading, styles = _this$asProps3.styles;
84
- var points = [];
85
- var length = this.data.length;
86
- var step = this.defaultWidth / (length - 1);
87
- for (var i = 0; i < length; i++) {
88
- points.push("".concat(step * i, ",").concat(this.defaultHeight - this.data[i]));
89
- }
90
- var _extractAriaProps = extractAriaProps(this.asProps), __excludeProps = _extractAriaProps.__excludeProps, extractedAriaProps = _extractAriaProps.extractedAriaProps;
91
- return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(STrendLine, _ref2.cn("STrendLine", _objectSpread({}, assignProps({
79
+ const {
80
+ __excludeProps,
81
+ extractedAriaProps
82
+ } = extractAriaProps(this.asProps);
83
+ return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(STrendLine, _ref2.cn("STrendLine", {
84
+ ...assignProps({
92
85
  "ref": this.containerRef,
93
- "__excludeProps": ["data"].concat(_toConsumableArray(__excludeProps))
94
- }, _ref))), /* @__PURE__ */ React.createElement("svg", _ref2.cn("svg", _objectSpread({
95
- "width": "100%",
96
- "height": "100%",
97
- "viewBox": "0 0 ".concat(this.svgWidth, " ").concat(this.svgHeight),
98
- "role": "img"
99
- }, extractedAriaProps)), /* @__PURE__ */ React.createElement("polyline", _ref2.cn("polyline", {
100
- "points": points.join(" "),
101
- "stroke": this.color,
102
- "strokeWidth": "4",
103
- "fill": "none",
104
- "clipPath": "url(#".concat(uid, ")")
105
- })), withArea && /* @__PURE__ */ React.createElement("polyline", _ref2.cn("polyline", {
106
- "points": "0,".concat(this.defaultHeight, " ").concat(points.join(" "), " ").concat(this.defaultWidth, ",").concat(this.defaultHeight),
107
- "fill": this.color,
108
- "fillOpacity": 0.2,
109
- "clipPath": "url(#".concat(uid, ")")
110
- })), lastPointColor && !loading && /* @__PURE__ */ React.createElement("circle", _ref2.cn("circle", {
111
- "cx": step * (length - 1),
112
- "cy": this.defaultHeight - this.data[length - 1],
113
- "r": this.lastPointRadius,
114
- "fill": resolveColor(lastPointColor),
115
- "stroke": resolveColor("chart-grid-border"),
116
- "strokeWidth": 4,
117
- "clipPath": "url(#".concat(uid, ")")
118
- })), animate && !loading && /* @__PURE__ */ React.createElement("clipPath", _ref2.cn("clipPath", {
119
- "id": uid
120
- }), /* @__PURE__ */ React.createElement("rect", _ref2.cn("rect", {
121
- "x": "0",
122
- "y": "0",
123
- "width": "100%",
124
- "height": "100%",
125
- "fill": "black"
126
- }), /* @__PURE__ */ React.createElement("animate", _ref2.cn("animate", {
127
- "dur": "500ms",
128
- "attributeName": "width",
129
- "values": "0;100%"
130
- }))))));
131
- }
132
- }]);
133
- })(Trend);
86
+ "__excludeProps": ["data", ...__excludeProps]
87
+ }, _ref)
88
+ }), /* @__PURE__ */ React.createElement("svg", _ref2.cn("svg", {
89
+ "width": "100%",
90
+ "height": "100%",
91
+ "viewBox": `0 0 ${this.svgWidth} ${this.svgHeight}`,
92
+ "role": "img",
93
+ ...extractedAriaProps
94
+ }), /* @__PURE__ */ React.createElement("polyline", _ref2.cn("polyline", {
95
+ "points": points.join(" "),
96
+ "stroke": this.color,
97
+ "strokeWidth": "4",
98
+ "fill": "none",
99
+ "clipPath": `url(#${uid})`
100
+ })), withArea && /* @__PURE__ */ React.createElement("polyline", _ref2.cn("polyline", {
101
+ "points": `0,${this.defaultHeight} ${points.join(" ")} ${this.defaultWidth},${this.defaultHeight}`,
102
+ "fill": this.color,
103
+ "fillOpacity": 0.2,
104
+ "clipPath": `url(#${uid})`
105
+ })), lastPointColor && !loading && /* @__PURE__ */ React.createElement("circle", _ref2.cn("circle", {
106
+ "cx": step * (length - 1),
107
+ "cy": this.defaultHeight - this.data[length - 1],
108
+ "r": this.lastPointRadius,
109
+ "fill": resolveColor(lastPointColor),
110
+ "stroke": resolveColor("chart-grid-border"),
111
+ "strokeWidth": 4,
112
+ "clipPath": `url(#${uid})`
113
+ })), animate && !loading && /* @__PURE__ */ React.createElement("clipPath", _ref2.cn("clipPath", {
114
+ "id": uid
115
+ }), /* @__PURE__ */ React.createElement("rect", _ref2.cn("rect", {
116
+ "x": "0",
117
+ "y": "0",
118
+ "width": "100%",
119
+ "height": "100%",
120
+ "fill": "black"
121
+ }), /* @__PURE__ */ React.createElement("animate", _ref2.cn("animate", {
122
+ "dur": "500ms",
123
+ "attributeName": "width",
124
+ "values": "0;100%"
125
+ }))))));
126
+ }
127
+ }
134
128
  _defineProperty(TrendLineRoot, "enhance", [resolveColorEnhance(), uniqueIDEnhancement()]);
135
129
  _defineProperty(TrendLineRoot, "style", style);
136
130
  _defineProperty(TrendLineRoot, "defaultProps", {
137
131
  animate: true
138
132
  });
139
- var TrendLine = createComponent(TrendLineRoot);
133
+ const TrendLine = createComponent(TrendLineRoot);
140
134
  TrendLine.displayName = "MiniChart.TrendLine";
141
- var TrendArea = createComponent(TrendLineRoot, {}, {
142
- enhancements: [function() {
135
+ const TrendArea = createComponent(TrendLineRoot, {}, {
136
+ enhancements: [() => {
143
137
  return {
144
- wrapperProps: function wrapperProps(props) {
138
+ wrapperProps: (props) => {
145
139
  return assignProps(props, {
146
140
  withArea: true
147
141
  });
@@ -1,75 +1,55 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _callSuper from "@babel/runtime/helpers/esm/callSuper";
4
- import _inherits from "@babel/runtime/helpers/esm/inherits";
5
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
6
2
  import { Component } from "@semcore/core";
7
3
  import React from "react";
8
- var Trend = /* @__PURE__ */ (function(_Component) {
9
- function Trend2() {
10
- var _this;
11
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
12
- args[_key] = arguments[_key];
13
- }
14
- _classCallCheck(this, Trend2);
15
- _this = _callSuper(this, Trend2, [].concat(args));
16
- _defineProperty(_this, "state", {
4
+ class Trend extends Component {
5
+ constructor(...args) {
6
+ super(...args);
7
+ _defineProperty(this, "state", {
17
8
  width: 200,
18
9
  height: 100
19
10
  });
20
- _defineProperty(_this, "containerRef", /* @__PURE__ */ React.createRef());
21
- return _this;
11
+ _defineProperty(this, "containerRef", /* @__PURE__ */ React.createRef());
12
+ }
13
+ componentDidMount() {
14
+ this.setSizes();
22
15
  }
23
- _inherits(Trend2, _Component);
24
- return _createClass(Trend2, [{
25
- key: "componentDidMount",
26
- value: function componentDidMount() {
16
+ componentDidUpdate(prevProps) {
17
+ if (prevProps.w !== this.props.w || prevProps.h !== this.props.h || prevProps.data !== this.props.data) {
27
18
  this.setSizes();
28
19
  }
29
- }, {
30
- key: "componentDidUpdate",
31
- value: function componentDidUpdate(prevProps) {
32
- if (prevProps.w !== this.props.w || prevProps.h !== this.props.h || prevProps.data !== this.props.data) {
33
- this.setSizes();
34
- }
35
- }
36
- }, {
37
- key: "defaultWidth",
38
- get: function get() {
39
- var _this$state = this.state, width = _this$state.width, height = _this$state.height;
40
- return width / height * this.defaultHeight;
41
- }
42
- }, {
43
- key: "defaultHeight",
44
- get: function get() {
45
- return 100;
46
- }
47
- }, {
48
- key: "svgWidth",
49
- get: function get() {
50
- return this.defaultWidth;
51
- }
52
- }, {
53
- key: "svgHeight",
54
- get: function get() {
55
- return this.defaultHeight;
56
- }
57
- }, {
58
- key: "setSizes",
59
- value: function setSizes() {
60
- if (this.containerRef.current) {
61
- var boundingClientRect = this.containerRef.current.getBoundingClientRect();
62
- var width = boundingClientRect.width, height = boundingClientRect.height;
63
- if (width > 0 && height > 0) {
64
- this.setState({
65
- width,
66
- height
67
- });
68
- }
20
+ }
21
+ get defaultWidth() {
22
+ const {
23
+ width,
24
+ height
25
+ } = this.state;
26
+ return width / height * this.defaultHeight;
27
+ }
28
+ get defaultHeight() {
29
+ return 100;
30
+ }
31
+ get svgWidth() {
32
+ return this.defaultWidth;
33
+ }
34
+ get svgHeight() {
35
+ return this.defaultHeight;
36
+ }
37
+ setSizes() {
38
+ if (this.containerRef.current) {
39
+ const boundingClientRect = this.containerRef.current.getBoundingClientRect();
40
+ const {
41
+ width,
42
+ height
43
+ } = boundingClientRect;
44
+ if (width > 0 && height > 0) {
45
+ this.setState({
46
+ width,
47
+ height
48
+ });
69
49
  }
70
50
  }
71
- }]);
72
- })(Component);
51
+ }
52
+ }
73
53
  export {
74
54
  Trend
75
55
  };
package/lib/esm/index.mjs CHANGED
@@ -2,7 +2,7 @@ import { ScoreDonut, ScoreSemiDonut } from "./component/score/Donut.mjs";
2
2
  import { ScoreLine } from "./component/score/Line.mjs";
3
3
  import { TrendHistogram, TrendBar } from "./component/trend/Bar.mjs";
4
4
  import { TrendArea, TrendLine } from "./component/trend/Line.mjs";
5
- var miniCharts = {
5
+ const miniCharts = {
6
6
  TrendLine,
7
7
  TrendArea,
8
8
  TrendBar,