@semcore/mini-chart 0.29.4 → 0.30.0-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.
Files changed (59) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/lib/cjs/component/score/Donut.js +60 -64
  3. package/lib/cjs/component/score/Donut.js.map +1 -1
  4. package/lib/cjs/component/score/Line.js +38 -41
  5. package/lib/cjs/component/score/Line.js.map +1 -1
  6. package/lib/cjs/component/score/Line.types.js.map +1 -1
  7. package/lib/cjs/component/score/Score.js.map +1 -1
  8. package/lib/cjs/component/score/index.js.map +1 -1
  9. package/lib/cjs/component/score/line.shadow.css +4 -4
  10. package/lib/cjs/component/trend/Bar.js +22 -28
  11. package/lib/cjs/component/trend/Bar.js.map +1 -1
  12. package/lib/cjs/component/trend/Line.js +20 -26
  13. package/lib/cjs/component/trend/Line.js.map +1 -1
  14. package/lib/cjs/component/trend/Trend.js +9 -13
  15. package/lib/cjs/component/trend/Trend.js.map +1 -1
  16. package/lib/cjs/component/trend/index.js +1 -1
  17. package/lib/cjs/component/trend/index.js.map +1 -1
  18. package/lib/cjs/index.js +1 -2
  19. package/lib/cjs/index.js.map +1 -1
  20. package/lib/cjs/utils/ScoreDonutUtils.js +87 -0
  21. package/lib/cjs/utils/ScoreDonutUtils.js.map +1 -0
  22. package/lib/es6/component/score/Donut.js +57 -58
  23. package/lib/es6/component/score/Donut.js.map +1 -1
  24. package/lib/es6/component/score/Line.js +31 -31
  25. package/lib/es6/component/score/Line.js.map +1 -1
  26. package/lib/es6/component/score/Line.types.js.map +1 -1
  27. package/lib/es6/component/score/Score.js.map +1 -1
  28. package/lib/es6/component/score/index.js.map +1 -1
  29. package/lib/es6/component/score/line.shadow.css +4 -4
  30. package/lib/es6/component/trend/Bar.js +19 -21
  31. package/lib/es6/component/trend/Bar.js.map +1 -1
  32. package/lib/es6/component/trend/Line.js +17 -19
  33. package/lib/es6/component/trend/Line.js.map +1 -1
  34. package/lib/es6/component/trend/Trend.js +7 -10
  35. package/lib/es6/component/trend/Trend.js.map +1 -1
  36. package/lib/es6/component/trend/index.js +1 -1
  37. package/lib/es6/component/trend/index.js.map +1 -1
  38. package/lib/es6/index.js.map +1 -1
  39. package/lib/es6/utils/ScoreDonutUtils.js +80 -0
  40. package/lib/es6/utils/ScoreDonutUtils.js.map +1 -0
  41. package/lib/esm/component/score/Donut.mjs +58 -61
  42. package/lib/esm/component/score/Line.mjs +35 -37
  43. package/lib/esm/component/score/index.mjs +7 -0
  44. package/lib/esm/component/score/line.shadow.css +4 -4
  45. package/lib/esm/component/trend/Bar.mjs +20 -23
  46. package/lib/esm/component/trend/Line.mjs +20 -23
  47. package/lib/esm/component/trend/Trend.mjs +9 -12
  48. package/lib/esm/component/trend/index.mjs +8 -0
  49. package/lib/esm/index.mjs +5 -3
  50. package/lib/esm/utils/ScoreDonutUtils.mjs +82 -0
  51. package/lib/types/component/score/Donut.d.ts +8 -11
  52. package/lib/types/component/score/Line.d.ts +1 -1
  53. package/lib/types/component/score/Line.types.d.ts +11 -9
  54. package/lib/types/component/trend/Bar.d.ts +3 -9
  55. package/lib/types/component/trend/Line.d.ts +7 -11
  56. package/lib/types/component/trend/Trend.d.ts +4 -4
  57. package/lib/types/component/trend/index.d.ts +1 -1
  58. package/lib/types/utils/ScoreDonutUtils.d.ts +18 -0
  59. package/package.json +4 -4
@@ -1,51 +1,49 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/esm/createClass";
4
+ import _callSuper from "@babel/runtime/helpers/esm/callSuper";
4
5
  import _inherits from "@babel/runtime/helpers/esm/inherits";
5
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
6
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
7
- import { sstyled } from "@semcore/utils/lib/core/index";
8
- import createComponent, { sstyled as sstyled$1, assignProps, Component } from "@semcore/core";
7
+ import { sstyled, assignProps, Component, createComponent } from "@semcore/core";
8
+ import { Box, Flex } from "@semcore/base-components";
9
+ import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
9
10
  import React from "react";
10
- import { Box, Flex } from "@semcore/flex-box";
11
- import resolveColorEnhance from "@semcore/utils/lib/enhances/resolveColorEnhance";
12
11
  /*!__reshadow-styles__:"./line.shadow.css"*/
13
12
  var style = (
14
13
  /*__reshadow_css_start__*/
15
14
  (sstyled.insert(
16
15
  /*__inner_css_start__*/
17
- "@keyframes pulse_13rvt{0%,to{opacity:1}50%{opacity:.4}}@keyframes move-line_13rvt{0%{transform:translateX(0)}to{transform:translateX(100%)}}.___SDonutContainer_13rvt_gg_.__loading_13rvt_gg_,.___SLineGauge_13rvt_gg_.__loading_13rvt_gg_,.___STrendBar_13rvt_gg_.__loading_13rvt_gg_,.___STrendLine_13rvt_gg_.__loading_13rvt_gg_{animation-name:pulse_13rvt;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SLineGauge_13rvt_gg_{height:8px;background-color:var(--base-bg-color_13rvt, var(--intergalactic-chart-grid-bar-chart-base-bg, #e0e1e9));border-radius:var(--intergalactic-chart-rounded, 2px);overflow:hidden;position:relative}.___SLineValue_13rvt_gg_{height:8px;border-radius:var(--intergalactic-chart-rounded, 2px)0 0 var(--intergalactic-chart-rounded, 2px)}.___SLineValue_13rvt_gg_.__percent_13rvt_gg_{width:var(--percent_13rvt)}.___SLineSegmentItem_13rvt_gg_.__color_13rvt_gg_,.___SLineValue_13rvt_gg_.__color_13rvt_gg_{background-color:var(--color_13rvt, var(--intergalactic-chart-palette-order-1, #2bb3ff))}.___SLineGauge_13rvt_gg_.__segments_13rvt_gg_{border-radius:var(--intergalactic-progress-bar-rounded, 6px)}.___SAnimationLine_13rvt_gg_,.___SLineGaugeSegment_13rvt_gg_{position:absolute;top:0;left:0;right:0;bottom:0}.___SLineSegmentItem_13rvt_gg_:last-child{margin-right:0;border-right:none}.___SLineSegmentItem_13rvt_gg_{height:8px;background:0 0;border-right-color:var(--intergalactic-chart-grid-border, #ffffff);border-right-style:solid;border-right-width:1px;box-sizing:content-box}.___SAnimationLine_13rvt_gg_{background-color:var(--intergalactic-chart-grid-bar-chart-base-bg, #e0e1e9);transition:all var(--intergalactic-duration-extra-slow, 500) ease-in-out;animation-name:move-line_13rvt;animation-duration:.5s;animation-timing-function:ease-in-out;animation-fill-mode:forwards}",
16
+ "@keyframes pulse_776hj{0%,to{opacity:1}50%{opacity:.4}}@keyframes move-line_776hj{0%{transform:translateX(0)}to{transform:translateX(100%)}}.___SDonutContainer_776hj_gg_.__loading_776hj_gg_,.___SLineGauge_776hj_gg_.__loading_776hj_gg_,.___STrendBar_776hj_gg_.__loading_776hj_gg_,.___STrendLine_776hj_gg_.__loading_776hj_gg_{animation-name:pulse_776hj;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SLineGauge_776hj_gg_{height:8px;background-color:var(--base-bg-color_776hj, var(--intergalactic-chart-grid-bar-chart-base-bg, rgb(241, 242, 242)));border-radius:var(--intergalactic-chart-rounded, 2px);overflow:hidden;position:relative}.___SLineValue_776hj_gg_{height:8px;border-radius:var(--intergalactic-chart-rounded, 2px)0 0 var(--intergalactic-chart-rounded, 2px)}.___SLineValue_776hj_gg_.__percent_776hj_gg_{width:var(--percent_776hj)}.___SLineSegmentItem_776hj_gg_.__color_776hj_gg_,.___SLineValue_776hj_gg_.__color_776hj_gg_{background-color:var(--color_776hj, var(--intergalactic-chart-palette-order-1, rgb(104, 109, 210)))}.___SLineGauge_776hj_gg_.__segments_776hj_gg_{border-radius:var(--intergalactic-progress-bar-rounded, 6px)}.___SAnimationLine_776hj_gg_,.___SLineGaugeSegment_776hj_gg_{position:absolute;top:0;left:0;right:0;bottom:0}.___SLineSegmentItem_776hj_gg_:last-child{margin-right:0;border-right:none}.___SLineSegmentItem_776hj_gg_{height:8px;background:0 0;border-right-color:var(--intergalactic-chart-grid-border, #fff);border-right-style:solid;border-right-width:1px;box-sizing:content-box}.___SAnimationLine_776hj_gg_{background-color:var(--intergalactic-chart-grid-bar-chart-base-bg, rgb(241, 242, 242));transition:all var(--intergalactic-duration-extra-slow, 500) ease-in-out;animation-name:move-line_776hj;animation-duration:.5s;animation-timing-function:ease-in-out;animation-fill-mode:forwards}",
18
17
  /*__inner_css_end__*/
19
- "13rvt_gg_"
18
+ "776hj_gg_"
20
19
  ), /*__reshadow_css_end__*/
21
20
  {
22
- "__SLineGauge": "___SLineGauge_13rvt_gg_",
23
- "_loading": "__loading_13rvt_gg_",
24
- "__SDonutContainer": "___SDonutContainer_13rvt_gg_",
25
- "__STrendLine": "___STrendLine_13rvt_gg_",
26
- "__STrendBar": "___STrendBar_13rvt_gg_",
27
- "@pulse": "pulse_13rvt",
28
- "--base-bg-color": "--base-bg-color_13rvt",
29
- "__SLineValue": "___SLineValue_13rvt_gg_",
30
- "_percent": "__percent_13rvt_gg_",
31
- "--percent": "--percent_13rvt",
32
- "_color": "__color_13rvt_gg_",
33
- "__SLineSegmentItem": "___SLineSegmentItem_13rvt_gg_",
34
- "--color": "--color_13rvt",
35
- "_segments": "__segments_13rvt_gg_",
36
- "__SLineGaugeSegment": "___SLineGaugeSegment_13rvt_gg_",
37
- "__SAnimationLine": "___SAnimationLine_13rvt_gg_",
38
- "@move-line": "move-line_13rvt"
21
+ "__SLineGauge": "___SLineGauge_776hj_gg_",
22
+ "_loading": "__loading_776hj_gg_",
23
+ "__SDonutContainer": "___SDonutContainer_776hj_gg_",
24
+ "__STrendLine": "___STrendLine_776hj_gg_",
25
+ "__STrendBar": "___STrendBar_776hj_gg_",
26
+ "@pulse": "pulse_776hj",
27
+ "__SLineValue": "___SLineValue_776hj_gg_",
28
+ "_percent": "__percent_776hj_gg_",
29
+ "--percent": "--percent_776hj",
30
+ "_color": "__color_776hj_gg_",
31
+ "__SLineSegmentItem": "___SLineSegmentItem_776hj_gg_",
32
+ "_segments": "__segments_776hj_gg_",
33
+ "__SLineGaugeSegment": "___SLineGaugeSegment_776hj_gg_",
34
+ "__SAnimationLine": "___SAnimationLine_776hj_gg_",
35
+ "@move-line": "move-line_776hj",
36
+ "--base-bg-color": "--base-bg-color_776hj",
37
+ "--color": "--color_776hj"
39
38
  })
40
39
  );
41
- var LineRoot = /* @__PURE__ */ function(_Component) {
42
- _inherits(LineRoot2, _Component);
43
- var _super = _createSuper(LineRoot2);
40
+ var LineRoot = /* @__PURE__ */ (function(_Component) {
44
41
  function LineRoot2() {
45
42
  _classCallCheck(this, LineRoot2);
46
- return _super.apply(this, arguments);
43
+ return _callSuper(this, LineRoot2, arguments);
47
44
  }
48
- _createClass(LineRoot2, [{
45
+ _inherits(LineRoot2, _Component);
46
+ return _createClass(LineRoot2, [{
49
47
  key: "getSegmentProps",
50
48
  value: function getSegmentProps(segmentProps) {
51
49
  var _this$asProps = this.asProps, children = _this$asProps.children, resolveColor = _this$asProps.resolveColor;
@@ -57,7 +55,7 @@ var LineRoot = /* @__PURE__ */ function(_Component) {
57
55
  });
58
56
  var width = sum > 0 ? 100 * segmentProps.value / sum : 0;
59
57
  return {
60
- w: "".concat(width, "%"),
58
+ "w": "".concat(width, "%"),
61
59
  "use:color": resolveColor(segmentProps.color)
62
60
  };
63
61
  }
@@ -73,7 +71,7 @@ var LineRoot = /* @__PURE__ */ function(_Component) {
73
71
  var _this$asProps2 = this.asProps, value = _this$asProps2.value, styles = _this$asProps2.styles, _this$asProps2$color = _this$asProps2.color, color = _this$asProps2$color === void 0 ? "chart-palette-order-1" : _this$asProps2$color, baseBgColor = _this$asProps2.baseBgColor, resolveColor = _this$asProps2.resolveColor, loading = _this$asProps2.loading, children = _this$asProps2.children, Children = _this$asProps2.Children, animate = _this$asProps2.animate;
74
72
  if (children !== void 0) {
75
73
  var _ref3;
76
- return _ref3 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SLineGauge, _ref3.cn("SLineGauge", _objectSpread({}, assignProps({
74
+ return _ref3 = sstyled(styles), /* @__PURE__ */ React.createElement(SLineGauge, _ref3.cn("SLineGauge", _objectSpread({}, assignProps({
77
75
  "segments": true,
78
76
  "base-bg-color": resolveColor(baseBgColor)
79
77
  }, _ref))), /* @__PURE__ */ React.createElement(SLineGaugeSegment, _ref3.cn("SLineGaugeSegment", {}), /* @__PURE__ */ React.createElement(Children, _ref3.cn("Children", {}))), animate && /* @__PURE__ */ React.createElement(SAnimationLine, _ref3.cn("SAnimationLine", {})));
@@ -84,7 +82,7 @@ var LineRoot = /* @__PURE__ */ function(_Component) {
84
82
  for (var i = 0; i < segments; i++) {
85
83
  var _ref4;
86
84
  var width = "calc((100% - ".concat(segments - 1, "px) / ").concat(segments, ")");
87
- SegmentItems.push((_ref4 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SLineSegmentItem, _ref4.cn("SLineSegmentItem", {
85
+ SegmentItems.push((_ref4 = sstyled(styles), /* @__PURE__ */ React.createElement(SLineSegmentItem, _ref4.cn("SLineSegmentItem", {
88
86
  "key": i,
89
87
  "color": i < value ? resolveColor(color) : void 0,
90
88
  "w": width
@@ -95,7 +93,7 @@ var LineRoot = /* @__PURE__ */ function(_Component) {
95
93
  if (segments) {
96
94
  percent = "".concat(value / segments * 100, "%");
97
95
  }
98
- return _ref5 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SLineGauge, _ref5.cn("SLineGauge", _objectSpread({}, assignProps({
96
+ return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(SLineGauge, _ref5.cn("SLineGauge", _objectSpread({}, assignProps({
99
97
  "base-bg-color": resolveColor(baseBgColor)
100
98
  }, _ref))), !loading && /* @__PURE__ */ React.createElement(SLineValue, _ref5.cn("SLineValue", {
101
99
  "w": percent,
@@ -103,8 +101,7 @@ var LineRoot = /* @__PURE__ */ function(_Component) {
103
101
  })), Boolean(SegmentItems.length) && /* @__PURE__ */ React.createElement(SLineGaugeSegment, _ref5.cn("SLineGaugeSegment", {}), SegmentItems), animate && /* @__PURE__ */ React.createElement(SAnimationLine, _ref5.cn("SAnimationLine", {})));
104
102
  }
105
103
  }]);
106
- return LineRoot2;
107
- }(Component);
104
+ })(Component);
108
105
  _defineProperty(LineRoot, "enhance", [resolveColorEnhance()]);
109
106
  _defineProperty(LineRoot, "displayName", "ScoreLine");
110
107
  _defineProperty(LineRoot, "style", style);
@@ -113,9 +110,10 @@ _defineProperty(LineRoot, "defaultProps", {
113
110
  });
114
111
  function Segment(props) {
115
112
  var _ref2 = arguments[0], _ref6;
116
- var styles = props.styles;
113
+ var styles = props.styles, value = props.value;
117
114
  var SLineSegmentItem = Box;
118
- return _ref6 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SLineSegmentItem, _ref6.cn("SLineSegmentItem", _objectSpread({}, assignProps({}, _ref2))));
115
+ if (!value) return null;
116
+ return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SLineSegmentItem, _ref6.cn("SLineSegmentItem", _objectSpread({}, assignProps({}, _ref2))));
119
117
  }
120
118
  Segment.displayName = "Segment";
121
119
  var ScoreLine = createComponent(LineRoot, {
@@ -0,0 +1,7 @@
1
+ import { ScoreDonut, ScoreSemiDonut } from "./Donut.mjs";
2
+ import { ScoreLine } from "./Line.mjs";
3
+ export {
4
+ ScoreDonut,
5
+ ScoreLine,
6
+ ScoreSemiDonut
7
+ };
@@ -2,7 +2,7 @@
2
2
 
3
3
  SLineGauge {
4
4
  height: 8px;
5
- background-color: var(--base-bg-color, var(--intergalactic-chart-grid-bar-chart-base-bg, #e0e1e9));
5
+ background-color: var(--base-bg-color, var(--intergalactic-chart-grid-bar-chart-base-bg, oklch(0.96 0.001 180)));
6
6
  border-radius: var(--intergalactic-chart-rounded, 2px);
7
7
  overflow: hidden;
8
8
  position: relative;
@@ -18,7 +18,7 @@ SLineValue[percent] {
18
18
  }
19
19
 
20
20
  SLineValue[color], SLineSegmentItem[color] {
21
- background-color: var(--color, var(--intergalactic-chart-palette-order-1, #2bb3ff));
21
+ background-color: var(--color, var(--intergalactic-chart-palette-order-1, oklch(0.58 0.153 278.4)));
22
22
  }
23
23
 
24
24
  SLineGauge[segments] {
@@ -41,14 +41,14 @@ SLineSegmentItem:last-child {
41
41
  SLineSegmentItem {
42
42
  height: 8px;
43
43
  background: transparent;
44
- border-right-color: var(--intergalactic-chart-grid-border, #ffffff);
44
+ border-right-color: var(--intergalactic-chart-grid-border, #fff);
45
45
  border-right-style: solid;
46
46
  border-right-width: 1px;
47
47
  box-sizing: content-box;
48
48
  }
49
49
 
50
50
  SAnimationLine {
51
- background-color: var(--intergalactic-chart-grid-bar-chart-base-bg, #e0e1e9);
51
+ background-color: var(--intergalactic-chart-grid-bar-chart-base-bg, oklch(0.96 0.001 180));
52
52
  transition: all var(--intergalactic-duration-extra-slow, 500) ease-in-out;
53
53
  animation-name: move-line;
54
54
  animation-duration: 0.5s;
@@ -2,42 +2,40 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
2
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
3
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
4
  import _createClass from "@babel/runtime/helpers/esm/createClass";
5
+ import _callSuper from "@babel/runtime/helpers/esm/callSuper";
5
6
  import _inherits from "@babel/runtime/helpers/esm/inherits";
6
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
7
7
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
8
- import { sstyled } from "@semcore/utils/lib/core/index";
9
- import createComponent, { assignProps, sstyled as sstyled$1 } from "@semcore/core";
8
+ import { sstyled, assignProps, createComponent } from "@semcore/core";
9
+ import { Box } from "@semcore/base-components";
10
+ import { extractAriaProps } from "@semcore/core/lib/utils/ariaProps";
11
+ import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
10
12
  import React from "react";
11
- import resolveColorEnhance from "@semcore/utils/lib/enhances/resolveColorEnhance";
12
13
  import { Trend } from "./Trend.mjs";
13
- import { Box } from "@semcore/flex-box";
14
- import { extractAriaProps } from "@semcore/utils/lib/ariaProps";
15
14
  /*!__reshadow-styles__:"../skeleton/skeleton.shadow.css"*/
16
15
  var style = (
17
16
  /*__reshadow_css_start__*/
18
17
  (sstyled.insert(
19
18
  /*__inner_css_start__*/
20
- "@keyframes pulse_1k9zd{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_1k9zd_gg_.__loading_1k9zd_gg_,.___SLineGauge_1k9zd_gg_.__loading_1k9zd_gg_,.___STrendBar_1k9zd_gg_.__loading_1k9zd_gg_,.___STrendLine_1k9zd_gg_.__loading_1k9zd_gg_{animation-name:pulse_1k9zd;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}",
19
+ "@keyframes pulse_1yrsa{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_1yrsa_gg_.__loading_1yrsa_gg_,.___SLineGauge_1yrsa_gg_.__loading_1yrsa_gg_,.___STrendBar_1yrsa_gg_.__loading_1yrsa_gg_,.___STrendLine_1yrsa_gg_.__loading_1yrsa_gg_{animation-name:pulse_1yrsa;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}",
21
20
  /*__inner_css_end__*/
22
- "1k9zd_gg_"
21
+ "1yrsa_gg_"
23
22
  ), /*__reshadow_css_end__*/
24
23
  {
25
- "__SLineGauge": "___SLineGauge_1k9zd_gg_",
26
- "_loading": "__loading_1k9zd_gg_",
27
- "__SDonutContainer": "___SDonutContainer_1k9zd_gg_",
28
- "__STrendLine": "___STrendLine_1k9zd_gg_",
29
- "__STrendBar": "___STrendBar_1k9zd_gg_",
30
- "@pulse": "pulse_1k9zd"
24
+ "__SLineGauge": "___SLineGauge_1yrsa_gg_",
25
+ "_loading": "__loading_1yrsa_gg_",
26
+ "__SDonutContainer": "___SDonutContainer_1yrsa_gg_",
27
+ "__STrendLine": "___STrendLine_1yrsa_gg_",
28
+ "__STrendBar": "___STrendBar_1yrsa_gg_",
29
+ "@pulse": "pulse_1yrsa"
31
30
  })
32
31
  );
33
- var TrendBarRoot = /* @__PURE__ */ function(_Trend) {
34
- _inherits(TrendBarRoot2, _Trend);
35
- var _super = _createSuper(TrendBarRoot2);
32
+ var TrendBarRoot = /* @__PURE__ */ (function(_Trend) {
36
33
  function TrendBarRoot2() {
37
34
  _classCallCheck(this, TrendBarRoot2);
38
- return _super.apply(this, arguments);
35
+ return _callSuper(this, TrendBarRoot2, arguments);
39
36
  }
40
- _createClass(TrendBarRoot2, [{
37
+ _inherits(TrendBarRoot2, _Trend);
38
+ return _createClass(TrendBarRoot2, [{
41
39
  key: "defaultData",
42
40
  get: function get() {
43
41
  return [{
@@ -67,7 +65,7 @@ var TrendBarRoot = /* @__PURE__ */ function(_Trend) {
67
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;
68
66
  var step = this.defaultWidth / this.data.length;
69
67
  var _extractAriaProps = extractAriaProps(this.asProps), __excludeProps = _extractAriaProps.__excludeProps, extractedAriaProps = _extractAriaProps.extractedAriaProps;
70
- return _ref2 = sstyled$1(styles), /* @__PURE__ */ React.createElement(STrendBar, _ref2.cn("STrendBar", _objectSpread({}, assignProps({
68
+ return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(STrendBar, _ref2.cn("STrendBar", _objectSpread({}, assignProps({
71
69
  "ref": this.containerRef,
72
70
  "__excludeProps": ["data"].concat(_toConsumableArray(__excludeProps))
73
71
  }, _ref))), /* @__PURE__ */ React.createElement("svg", _ref2.cn("svg", _objectSpread({
@@ -95,8 +93,7 @@ var TrendBarRoot = /* @__PURE__ */ function(_Trend) {
95
93
  })));
96
94
  }
97
95
  }]);
98
- return TrendBarRoot2;
99
- }(Trend);
96
+ })(Trend);
100
97
  _defineProperty(TrendBarRoot, "enhance", [resolveColorEnhance()]);
101
98
  _defineProperty(TrendBarRoot, "style", style);
102
99
  _defineProperty(TrendBarRoot, "defaultProps", {
@@ -115,7 +112,7 @@ var TrendHistogram = createComponent(TrendBarRoot, {}, {
115
112
  };
116
113
  }]
117
114
  });
118
- TrendBar.displayName = "MiniChart.TrendHistogram";
115
+ TrendHistogram.displayName = "MiniChart.TrendHistogram";
119
116
  export {
120
117
  TrendBar,
121
118
  TrendHistogram
@@ -2,43 +2,41 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
2
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
3
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
4
  import _createClass from "@babel/runtime/helpers/esm/createClass";
5
+ import _callSuper from "@babel/runtime/helpers/esm/callSuper";
5
6
  import _inherits from "@babel/runtime/helpers/esm/inherits";
6
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
7
7
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
8
- import { sstyled } from "@semcore/utils/lib/core/index";
9
- import createComponent, { assignProps, sstyled as sstyled$1 } from "@semcore/core";
8
+ import { sstyled, assignProps, createComponent } from "@semcore/core";
9
+ import { Box } from "@semcore/base-components";
10
+ import { extractAriaProps } from "@semcore/core/lib/utils/ariaProps";
11
+ import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
12
+ import uniqueIDEnhancement from "@semcore/core/lib/utils/uniqueID";
10
13
  import React from "react";
11
- import resolveColorEnhance from "@semcore/utils/lib/enhances/resolveColorEnhance";
12
- import uniqueIDEnhancement from "@semcore/utils/lib/uniqueID";
13
14
  import { Trend } from "./Trend.mjs";
14
- import { Box } from "@semcore/flex-box";
15
- import { extractAriaProps } from "@semcore/utils/lib/ariaProps";
16
15
  /*!__reshadow-styles__:"../skeleton/skeleton.shadow.css"*/
17
16
  var style = (
18
17
  /*__reshadow_css_start__*/
19
18
  (sstyled.insert(
20
19
  /*__inner_css_start__*/
21
- "@keyframes pulse_1k9zd{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_1k9zd_gg_.__loading_1k9zd_gg_,.___SLineGauge_1k9zd_gg_.__loading_1k9zd_gg_,.___STrendBar_1k9zd_gg_.__loading_1k9zd_gg_,.___STrendLine_1k9zd_gg_.__loading_1k9zd_gg_{animation-name:pulse_1k9zd;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}",
20
+ "@keyframes pulse_1yrsa{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_1yrsa_gg_.__loading_1yrsa_gg_,.___SLineGauge_1yrsa_gg_.__loading_1yrsa_gg_,.___STrendBar_1yrsa_gg_.__loading_1yrsa_gg_,.___STrendLine_1yrsa_gg_.__loading_1yrsa_gg_{animation-name:pulse_1yrsa;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}",
22
21
  /*__inner_css_end__*/
23
- "1k9zd_gg_"
22
+ "1yrsa_gg_"
24
23
  ), /*__reshadow_css_end__*/
25
24
  {
26
- "__SLineGauge": "___SLineGauge_1k9zd_gg_",
27
- "_loading": "__loading_1k9zd_gg_",
28
- "__SDonutContainer": "___SDonutContainer_1k9zd_gg_",
29
- "__STrendLine": "___STrendLine_1k9zd_gg_",
30
- "__STrendBar": "___STrendBar_1k9zd_gg_",
31
- "@pulse": "pulse_1k9zd"
25
+ "__SLineGauge": "___SLineGauge_1yrsa_gg_",
26
+ "_loading": "__loading_1yrsa_gg_",
27
+ "__SDonutContainer": "___SDonutContainer_1yrsa_gg_",
28
+ "__STrendLine": "___STrendLine_1yrsa_gg_",
29
+ "__STrendBar": "___STrendBar_1yrsa_gg_",
30
+ "@pulse": "pulse_1yrsa"
32
31
  })
33
32
  );
34
- var TrendLineRoot = /* @__PURE__ */ function(_Trend) {
35
- _inherits(TrendLineRoot2, _Trend);
36
- var _super = _createSuper(TrendLineRoot2);
33
+ var TrendLineRoot = /* @__PURE__ */ (function(_Trend) {
37
34
  function TrendLineRoot2() {
38
35
  _classCallCheck(this, TrendLineRoot2);
39
- return _super.apply(this, arguments);
36
+ return _callSuper(this, TrendLineRoot2, arguments);
40
37
  }
41
- _createClass(TrendLineRoot2, [{
38
+ _inherits(TrendLineRoot2, _Trend);
39
+ return _createClass(TrendLineRoot2, [{
42
40
  key: "defaultData",
43
41
  get: function get() {
44
42
  return [15, 70, 20, 85, 20];
@@ -90,7 +88,7 @@ var TrendLineRoot = /* @__PURE__ */ function(_Trend) {
90
88
  points.push("".concat(step * i, ",").concat(this.defaultHeight - this.data[i]));
91
89
  }
92
90
  var _extractAriaProps = extractAriaProps(this.asProps), __excludeProps = _extractAriaProps.__excludeProps, extractedAriaProps = _extractAriaProps.extractedAriaProps;
93
- return _ref2 = sstyled$1(styles), /* @__PURE__ */ React.createElement(STrendLine, _ref2.cn("STrendLine", _objectSpread({}, assignProps({
91
+ return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(STrendLine, _ref2.cn("STrendLine", _objectSpread({}, assignProps({
94
92
  "ref": this.containerRef,
95
93
  "__excludeProps": ["data"].concat(_toConsumableArray(__excludeProps))
96
94
  }, _ref))), /* @__PURE__ */ React.createElement("svg", _ref2.cn("svg", _objectSpread({
@@ -132,8 +130,7 @@ var TrendLineRoot = /* @__PURE__ */ function(_Trend) {
132
130
  }))))));
133
131
  }
134
132
  }]);
135
- return TrendLineRoot2;
136
- }(Trend);
133
+ })(Trend);
137
134
  _defineProperty(TrendLineRoot, "enhance", [resolveColorEnhance(), uniqueIDEnhancement()]);
138
135
  _defineProperty(TrendLineRoot, "style", style);
139
136
  _defineProperty(TrendLineRoot, "defaultProps", {
@@ -1,29 +1,27 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
3
+ import _callSuper from "@babel/runtime/helpers/esm/callSuper";
4
4
  import _inherits from "@babel/runtime/helpers/esm/inherits";
5
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
5
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
7
- import React from "react";
8
6
  import { Component } from "@semcore/core";
9
- var Trend = /* @__PURE__ */ function(_Component) {
10
- _inherits(Trend2, _Component);
11
- var _super = _createSuper(Trend2);
7
+ import React from "react";
8
+ var Trend = /* @__PURE__ */ (function(_Component) {
12
9
  function Trend2() {
13
10
  var _this;
14
11
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
15
12
  args[_key] = arguments[_key];
16
13
  }
17
14
  _classCallCheck(this, Trend2);
18
- _this = _super.call.apply(_super, [this].concat(args));
19
- _defineProperty(_assertThisInitialized(_this), "state", {
15
+ _this = _callSuper(this, Trend2, [].concat(args));
16
+ _defineProperty(_this, "state", {
20
17
  width: 200,
21
18
  height: 100
22
19
  });
23
- _defineProperty(_assertThisInitialized(_this), "containerRef", /* @__PURE__ */ React.createRef());
20
+ _defineProperty(_this, "containerRef", /* @__PURE__ */ React.createRef());
24
21
  return _this;
25
22
  }
26
- _createClass(Trend2, [{
23
+ _inherits(Trend2, _Component);
24
+ return _createClass(Trend2, [{
27
25
  key: "componentDidMount",
28
26
  value: function componentDidMount() {
29
27
  this.setSizes();
@@ -71,8 +69,7 @@ var Trend = /* @__PURE__ */ function(_Component) {
71
69
  }
72
70
  }
73
71
  }]);
74
- return Trend2;
75
- }(Component);
72
+ })(Component);
76
73
  export {
77
74
  Trend
78
75
  };
@@ -0,0 +1,8 @@
1
+ import { TrendBar, TrendHistogram } from "./Bar.mjs";
2
+ import { TrendArea, TrendLine } from "./Line.mjs";
3
+ export {
4
+ TrendArea,
5
+ TrendBar,
6
+ TrendHistogram,
7
+ TrendLine
8
+ };
package/lib/esm/index.mjs CHANGED
@@ -1,7 +1,9 @@
1
- import { ScoreSemiDonut, ScoreDonut } from "./component/score/Donut.mjs";
1
+ import "./component/score/index.mjs";
2
+ import "./component/trend/index.mjs";
2
3
  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";
4
+ import { ScoreDonut, ScoreSemiDonut } from "./component/score/Donut.mjs";
5
+ import { TrendHistogram, TrendBar } from "./component/trend/Bar.mjs";
6
+ import { TrendArea, TrendLine } from "./component/trend/Line.mjs";
5
7
  var miniCharts = {
6
8
  TrendLine,
7
9
  TrendArea,
@@ -0,0 +1,82 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
+ var ScoreDonutUtils = /* @__PURE__ */ (function() {
5
+ function ScoreDonutUtils2(value, isSemiDonut) {
6
+ _classCallCheck(this, ScoreDonutUtils2);
7
+ _defineProperty(this, "isSemiDonut", void 0);
8
+ _defineProperty(this, "value", void 0);
9
+ _defineProperty(this, "radius", void 0);
10
+ this.isSemiDonut = isSemiDonut;
11
+ this.radius = isSemiDonut ? 9 : 10;
12
+ this.value = Math.max(Math.min(value, 100), 0);
13
+ }
14
+ return _createClass(ScoreDonutUtils2, [{
15
+ key: "viewBox",
16
+ get: function get() {
17
+ return this.isSemiDonut ? "0 0 24 12" : "0 0 24 24";
18
+ }
19
+ }, {
20
+ key: "strokeWidth",
21
+ get: function get() {
22
+ return this.isSemiDonut ? 6 : 4;
23
+ }
24
+ }, {
25
+ key: "fullLength",
26
+ get: function get() {
27
+ return this.isSemiDonut ? Math.PI * this.radius : 2 * Math.PI * this.radius;
28
+ }
29
+ }, {
30
+ key: "point",
31
+ get: function get() {
32
+ return this.isSemiDonut ? this.fullLength / (100 / 3) : this.fullLength / 100;
33
+ }
34
+ }, {
35
+ key: "valueLength",
36
+ get: function get() {
37
+ return this.fullLength * (this.value / 100);
38
+ }
39
+ }, {
40
+ key: "animatedValueLength",
41
+ get: function get() {
42
+ return Math.min(this.valueLength, this.fullLength - this.startMargin - this.endMargin);
43
+ }
44
+ }, {
45
+ key: "startMargin",
46
+ get: function get() {
47
+ var margin = 0;
48
+ if (this.value > 0) margin = this.point;
49
+ return margin;
50
+ }
51
+ }, {
52
+ key: "endMargin",
53
+ get: function get() {
54
+ var margin = 0;
55
+ if (!this.isSemiDonut && this.value > 0) margin = this.point;
56
+ return margin;
57
+ }
58
+ }, {
59
+ key: "baseOffset",
60
+ get: function get() {
61
+ return -1 * (this.valueLength + this.startMargin);
62
+ }
63
+ }, {
64
+ key: "baseLength",
65
+ get: function get() {
66
+ return Math.max(this.fullLength - this.valueLength - this.startMargin - this.endMargin, 0);
67
+ }
68
+ }, {
69
+ key: "animatedBaseLengthFrom",
70
+ get: function get() {
71
+ return this.fullLength - this.startMargin - this.endMargin;
72
+ }
73
+ }, {
74
+ key: "animatedBaseLengthTo",
75
+ get: function get() {
76
+ return this.fullLength - this.valueLength - this.startMargin - this.endMargin;
77
+ }
78
+ }]);
79
+ })();
80
+ export {
81
+ ScoreDonutUtils
82
+ };
@@ -1,12 +1,9 @@
1
- import { ComponentType } from '@semcore/core';
2
- import { BoxProps } from '@semcore/flex-box';
3
- import resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';
4
- import { CommonScoreProps } from './Score';
1
+ import { type BoxProps } from '@semcore/base-components';
2
+ import type { CommonScoreProps } from './Score';
5
3
  export type ScoreDonutProps = BoxProps & CommonScoreProps;
6
- type Enhances = {
7
- resolveColor: ReturnType<typeof resolveColorEnhance>;
8
- isSemiDonut?: true;
9
- };
10
- export declare const ScoreDonut: ComponentType<ScoreDonutProps, {}, {}, Enhances>;
11
- export declare const ScoreSemiDonut: ComponentType<ScoreDonutProps, {}, {}, Enhances>;
12
- export {};
4
+ export declare const ScoreDonut: import("@semcore/core").Intergalactic.Component<"svg", ScoreDonutProps, {}, readonly [<T extends {}>(props: T) => T & {
5
+ duration: string;
6
+ }, (props: any) => any]>;
7
+ export declare const ScoreSemiDonut: import("@semcore/core").Intergalactic.Component<"svg", ScoreDonutProps, {}, readonly [<T extends {}>(props: T) => T & {
8
+ duration: string;
9
+ }, (props: any) => any]>;
@@ -1,2 +1,2 @@
1
- import { ScoreLineComponent } from './Line.types';
1
+ import type { ScoreLineComponent } from './Line.types';
2
2
  export declare const ScoreLine: ScoreLineComponent;
@@ -1,8 +1,8 @@
1
- import { Intergalactic, ComponentType } from '@semcore/utils/lib/core';
2
- import { CommonScoreProps } from './Score';
3
- import React from 'react';
4
- import { BoxProps, Box } from '@semcore/flex-box';
5
- import resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';
1
+ import type { BoxProps, Box } from '@semcore/base-components';
2
+ import type { Intergalactic } from '@semcore/core';
3
+ import type resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';
4
+ import type React from 'react';
5
+ import type { CommonScoreProps } from './Score';
6
6
  type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N ? Acc[number] : Enumerate<N, [...Acc, Acc['length']]>;
7
7
  type Range<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;
8
8
  export type SegmentColor = `chart-palette-order-${Range<1, 24>}`;
@@ -39,10 +39,12 @@ type CustomRenderScoreProps = {
39
39
  children: SegmentComponent[];
40
40
  };
41
41
  export type ScoreLineGaugeProps = BoxProps & Intergalactic.InternalTypings.EfficientOmit<CommonScoreProps, 'value' | 'color'> & (ValuedScoreProps | CustomRenderScoreProps);
42
- export type Enhances = {
43
- resolveColor: ReturnType<typeof resolveColorEnhance>;
44
- };
45
- export type ScoreLineComponent = ComponentType<ScoreLineGaugeProps, {}, {}, Enhances> & {
42
+ export type Enhances = [
43
+ () => {
44
+ resolveColor: ReturnType<typeof resolveColorEnhance>;
45
+ }
46
+ ];
47
+ export type ScoreLineComponent = Intergalactic.Component<'svg', ScoreLineGaugeProps, {}, Enhances> & {
46
48
  Segment: Intergalactic.Component<typeof Box, SegmentProps>;
47
49
  };
48
50
  export {};
@@ -1,6 +1,4 @@
1
- import { ComponentType } from '@semcore/core';
2
- import resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';
3
- import { CommonTrendProps } from './Trend';
1
+ import { type CommonTrendProps } from './Trend';
4
2
  type BarItem = {
5
3
  /**
6
4
  * Value
@@ -17,10 +15,6 @@ export type TrendBarProps = CommonTrendProps & {
17
15
  */
18
16
  data: BarItem[];
19
17
  };
20
- type Enhances = {
21
- resolveColor: ReturnType<typeof resolveColorEnhance>;
22
- isHistogram?: true;
23
- };
24
- export declare const TrendBar: ComponentType<TrendBarProps, {}, {}, Enhances>;
25
- export declare const TrendHistogram: ComponentType<TrendBarProps, {}, {}, Enhances>;
18
+ export declare const TrendBar: import("@semcore/core").Intergalactic.Component<"svg", TrendBarProps, {}, readonly [(props: any) => any]>;
19
+ export declare const TrendHistogram: import("@semcore/core").Intergalactic.Component<"svg", TrendBarProps, {}, readonly [(props: any) => any]>;
26
20
  export {};
@@ -1,6 +1,4 @@
1
- import { ComponentType } from '@semcore/core';
2
- import resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';
3
- import { CommonTrendProps } from './Trend';
1
+ import { type CommonTrendProps } from './Trend';
4
2
  export type TrendLineProps = CommonTrendProps & {
5
3
  /**
6
4
  * List of values
@@ -19,11 +17,9 @@ export type TrendLineProps = CommonTrendProps & {
19
17
  */
20
18
  lastPointRadius?: number;
21
19
  };
22
- type Enhances = {
23
- uid: string;
24
- resolveColor: ReturnType<typeof resolveColorEnhance>;
25
- withArea?: true;
26
- };
27
- export declare const TrendLine: ComponentType<TrendLineProps, {}, {}, Enhances>;
28
- export declare const TrendArea: ComponentType<TrendLineProps, {}, {}, Enhances>;
29
- export {};
20
+ export declare const TrendLine: import("@semcore/core").Intergalactic.Component<"svg", TrendLineProps, {}, readonly [(props: any) => any, (props: any) => {
21
+ uid: ReturnType<typeof import("@semcore/core/lib/utils/uniqueID").useUID>;
22
+ }]>;
23
+ export declare const TrendArea: import("@semcore/core").Intergalactic.Component<"svg", TrendLineProps, {}, readonly [(props: any) => any, (props: any) => {
24
+ uid: ReturnType<typeof import("@semcore/core/lib/utils/uniqueID").useUID>;
25
+ }]>;