@semcore/mini-chart 16.1.1-prerelease.5 → 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 +7 -1
  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 +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"ScoreDonutUtils.js","names":["ScoreDonutUtils","value","isSemiDonut","_classCallCheck","_defineProperty","radius","Math","max","min","_createClass","key","get","PI","fullLength","valueLength","startMargin","endMargin","margin","point"],"sources":["../../../src/utils/ScoreDonutUtils.ts"],"sourcesContent":["export class ScoreDonutUtils {\n private readonly isSemiDonut: boolean;\n private readonly value: number;\n\n public readonly radius: number;\n\n constructor(value: number, isSemiDonut: boolean) {\n this.isSemiDonut = isSemiDonut;\n this.radius = isSemiDonut ? 9 : 10;\n this.value = Math.max(Math.min(value, 100), 0);\n }\n\n public get viewBox() {\n return this.isSemiDonut ? '0 0 24 12' : '0 0 24 24';\n }\n\n public get strokeWidth() {\n return this.isSemiDonut ? 6 : 4;\n }\n\n public get fullLength() {\n return this.isSemiDonut ? Math.PI * this.radius : 2 * Math.PI * this.radius;\n }\n\n public get point() {\n return this.isSemiDonut\n ? this.fullLength / (100 / 3)\n : this.fullLength / 100;\n }\n\n public get valueLength() {\n return this.fullLength * (this.value / 100);\n }\n\n public get animatedValueLength() {\n return Math.min(this.valueLength, this.fullLength - this.startMargin - this.endMargin);\n }\n\n public get startMargin() {\n let margin = 0;\n if (this.value > 0) margin = this.point;\n return margin;\n }\n\n public get endMargin() {\n let margin = 0;\n if (!this.isSemiDonut && this.value > 0) margin = this.point;\n return margin;\n }\n\n public get baseOffset() {\n return -1 * (this.valueLength + this.startMargin);\n };\n\n public get baseLength() {\n return Math.max(this.fullLength - this.valueLength - this.startMargin - this.endMargin, 0);\n }\n\n public get animatedBaseLengthFrom() {\n return this.fullLength - this.startMargin - this.endMargin;\n }\n\n public get animatedBaseLengthTo() {\n return this.fullLength - this.valueLength - this.startMargin - this.endMargin;\n }\n}\n"],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"file":"ScoreDonutUtils.js","names":["ScoreDonutUtils","constructor","value","isSemiDonut","_defineProperty","radius","Math","max","min","viewBox","strokeWidth","fullLength","PI","point","valueLength","animatedValueLength","startMargin","endMargin","margin","baseOffset","baseLength","animatedBaseLengthFrom","animatedBaseLengthTo"],"sources":["../../../src/utils/ScoreDonutUtils.ts"],"sourcesContent":["export class ScoreDonutUtils {\n private readonly isSemiDonut: boolean;\n private readonly value: number;\n\n public readonly radius: number;\n\n constructor(value: number, isSemiDonut: boolean) {\n this.isSemiDonut = isSemiDonut;\n this.radius = isSemiDonut ? 9 : 10;\n this.value = Math.max(Math.min(value, 100), 0);\n }\n\n public get viewBox() {\n return this.isSemiDonut ? '0 0 24 12' : '0 0 24 24';\n }\n\n public get strokeWidth() {\n return this.isSemiDonut ? 6 : 4;\n }\n\n public get fullLength() {\n return this.isSemiDonut ? Math.PI * this.radius : 2 * Math.PI * this.radius;\n }\n\n public get point() {\n return this.isSemiDonut\n ? this.fullLength / (100 / 3)\n : this.fullLength / 100;\n }\n\n public get valueLength() {\n return this.fullLength * (this.value / 100);\n }\n\n public get animatedValueLength() {\n return Math.min(this.valueLength, this.fullLength - this.startMargin - this.endMargin);\n }\n\n public get startMargin() {\n let margin = 0;\n if (this.value > 0) margin = this.point;\n return margin;\n }\n\n public get endMargin() {\n let margin = 0;\n if (!this.isSemiDonut && this.value > 0) margin = this.point;\n return margin;\n }\n\n public get baseOffset() {\n return -1 * (this.valueLength + this.startMargin);\n };\n\n public get baseLength() {\n return Math.max(this.fullLength - this.valueLength - this.startMargin - this.endMargin, 0);\n }\n\n public get animatedBaseLengthFrom() {\n return this.fullLength - this.startMargin - this.endMargin;\n }\n\n public get animatedBaseLengthTo() {\n return this.fullLength - this.valueLength - this.startMargin - this.endMargin;\n }\n}\n"],"mappings":";AAAA,OAAO,MAAMA,eAAe,CAAC;EAM3BC,WAAWA,CAACC,KAAa,EAAEC,WAAoB,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAC/C,IAAI,CAACD,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACE,MAAM,GAAGF,WAAW,GAAG,CAAC,GAAG,EAAE;IAClC,IAAI,CAACD,KAAK,GAAGI,IAAI,CAACC,GAAG,CAACD,IAAI,CAACE,GAAG,CAACN,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;EAChD;EAEA,IAAWO,OAAOA,CAAA,EAAG;IACnB,OAAO,IAAI,CAACN,WAAW,GAAG,WAAW,GAAG,WAAW;EACrD;EAEA,IAAWO,WAAWA,CAAA,EAAG;IACvB,OAAO,IAAI,CAACP,WAAW,GAAG,CAAC,GAAG,CAAC;EACjC;EAEA,IAAWQ,UAAUA,CAAA,EAAG;IACtB,OAAO,IAAI,CAACR,WAAW,GAAGG,IAAI,CAACM,EAAE,GAAG,IAAI,CAACP,MAAM,GAAG,CAAC,GAAGC,IAAI,CAACM,EAAE,GAAG,IAAI,CAACP,MAAM;EAC7E;EAEA,IAAWQ,KAAKA,CAAA,EAAG;IACjB,OAAO,IAAI,CAACV,WAAW,GACnB,IAAI,CAACQ,UAAU,IAAI,GAAG,GAAG,CAAC,CAAC,GAC3B,IAAI,CAACA,UAAU,GAAG,GAAG;EAC3B;EAEA,IAAWG,WAAWA,CAAA,EAAG;IACvB,OAAO,IAAI,CAACH,UAAU,IAAI,IAAI,CAACT,KAAK,GAAG,GAAG,CAAC;EAC7C;EAEA,IAAWa,mBAAmBA,CAAA,EAAG;IAC/B,OAAOT,IAAI,CAACE,GAAG,CAAC,IAAI,CAACM,WAAW,EAAE,IAAI,CAACH,UAAU,GAAG,IAAI,CAACK,WAAW,GAAG,IAAI,CAACC,SAAS,CAAC;EACxF;EAEA,IAAWD,WAAWA,CAAA,EAAG;IACvB,IAAIE,MAAM,GAAG,CAAC;IACd,IAAI,IAAI,CAAChB,KAAK,GAAG,CAAC,EAAEgB,MAAM,GAAG,IAAI,CAACL,KAAK;IACvC,OAAOK,MAAM;EACf;EAEA,IAAWD,SAASA,CAAA,EAAG;IACrB,IAAIC,MAAM,GAAG,CAAC;IACd,IAAI,CAAC,IAAI,CAACf,WAAW,IAAI,IAAI,CAACD,KAAK,GAAG,CAAC,EAAEgB,MAAM,GAAG,IAAI,CAACL,KAAK;IAC5D,OAAOK,MAAM;EACf;EAEA,IAAWC,UAAUA,CAAA,EAAG;IACtB,OAAO,CAAC,CAAC,IAAI,IAAI,CAACL,WAAW,GAAG,IAAI,CAACE,WAAW,CAAC;EACnD;EAEA,IAAWI,UAAUA,CAAA,EAAG;IACtB,OAAOd,IAAI,CAACC,GAAG,CAAC,IAAI,CAACI,UAAU,GAAG,IAAI,CAACG,WAAW,GAAG,IAAI,CAACE,WAAW,GAAG,IAAI,CAACC,SAAS,EAAE,CAAC,CAAC;EAC5F;EAEA,IAAWI,sBAAsBA,CAAA,EAAG;IAClC,OAAO,IAAI,CAACV,UAAU,GAAG,IAAI,CAACK,WAAW,GAAG,IAAI,CAACC,SAAS;EAC5D;EAEA,IAAWK,oBAAoBA,CAAA,EAAG;IAChC,OAAO,IAAI,CAACX,UAAU,GAAG,IAAI,CAACG,WAAW,GAAG,IAAI,CAACE,WAAW,GAAG,IAAI,CAACC,SAAS;EAC/E;AACF","ignoreList":[]}
@@ -1,111 +1,112 @@
1
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/esm/createClass";
4
- import _callSuper from "@babel/runtime/helpers/esm/callSuper";
5
- import _inherits from "@babel/runtime/helpers/esm/inherits";
6
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
7
2
  import { createComponent, sstyled, assignProps, Component } from "@semcore/core";
3
+ import { Box } from "@semcore/base-components";
8
4
  import { extractAriaProps } from "@semcore/core/lib/utils/ariaProps";
9
5
  import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
10
6
  import { cssVariableEnhance } from "@semcore/core/lib/utils/useCssVariable";
11
- import { Box } from "@semcore/flex-box";
12
7
  import React from "react";
13
8
  import { ScoreDonutUtils } from "../../utils/ScoreDonutUtils.mjs";
14
9
  /*!__reshadow-styles__:"./donut.shadow.css"*/
15
- var style = (
10
+ const style = (
16
11
  /*__reshadow_css_start__*/
17
12
  (sstyled.insert(
18
13
  /*__inner_css_start__*/
19
- "@keyframes pulse_1kq41{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_1kq41_gg_.__loading_1kq41_gg_,.___SLineGauge_1kq41_gg_.__loading_1kq41_gg_,.___STrendBar_1kq41_gg_.__loading_1kq41_gg_,.___STrendLine_1kq41_gg_.__loading_1kq41_gg_{animation-name:pulse_1kq41;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SDonutContainer_1kq41_gg_.__semi_1kq41_gg_ g{transform:rotate(180deg) translate(-24px,-24px)}.___SDonutContainer_1kq41_gg_ g{transform:rotate(-90deg) translate(-24px)}.___SDonutContainer_1kq41_gg_.__animate_1kq41_gg_ circle{transition:all var(--intergalactic-duration-extra-slow, 500) ease-in-out}",
14
+ "@keyframes pulse_1yj1g{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_1yj1g_gg_.__loading_1yj1g_gg_,.___SLineGauge_1yj1g_gg_.__loading_1yj1g_gg_,.___STrendBar_1yj1g_gg_.__loading_1yj1g_gg_,.___STrendLine_1yj1g_gg_.__loading_1yj1g_gg_{animation-name:pulse_1yj1g;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SDonutContainer_1yj1g_gg_.__semi_1yj1g_gg_ g{transform:rotate(180deg) translate(-24px,-24px)}.___SDonutContainer_1yj1g_gg_ g{transform:rotate(-90deg) translate(-24px)}.___SDonutContainer_1yj1g_gg_.__animate_1yj1g_gg_ circle{transition:all var(--intergalactic-duration-extra-slow, 500) ease-in-out}",
20
15
  /*__inner_css_end__*/
21
- "1kq41_gg_"
16
+ "1yj1g_gg_"
22
17
  ), /*__reshadow_css_end__*/
23
18
  {
24
- "__SLineGauge": "___SLineGauge_1kq41_gg_",
25
- "_loading": "__loading_1kq41_gg_",
26
- "__SDonutContainer": "___SDonutContainer_1kq41_gg_",
27
- "__STrendLine": "___STrendLine_1kq41_gg_",
28
- "__STrendBar": "___STrendBar_1kq41_gg_",
29
- "@pulse": "pulse_1kq41",
30
- "_animate": "__animate_1kq41_gg_",
31
- "_semi": "__semi_1kq41_gg_"
19
+ "__SLineGauge": "___SLineGauge_1yj1g_gg_",
20
+ "_loading": "__loading_1yj1g_gg_",
21
+ "__SDonutContainer": "___SDonutContainer_1yj1g_gg_",
22
+ "__STrendLine": "___STrendLine_1yj1g_gg_",
23
+ "__STrendBar": "___STrendBar_1yj1g_gg_",
24
+ "@pulse": "pulse_1yj1g",
25
+ "_animate": "__animate_1yj1g_gg_",
26
+ "_semi": "__semi_1yj1g_gg_"
32
27
  })
33
28
  );
34
- var DonutRoot = /* @__PURE__ */ (function(_Component) {
35
- function DonutRoot2() {
36
- _classCallCheck(this, DonutRoot2);
37
- return _callSuper(this, DonutRoot2, arguments);
38
- }
39
- _inherits(DonutRoot2, _Component);
40
- return _createClass(DonutRoot2, [{
41
- key: "render",
42
- value: function render() {
43
- var _ref = this.asProps, _ref2;
44
- var SDonutContainer = Box;
45
- var _this$asProps = this.asProps, value = _this$asProps.value, styles = _this$asProps.styles, _this$asProps$baseBgC = _this$asProps.baseBgColor, baseBgColor = _this$asProps$baseBgC === void 0 ? "chart-grid-bar-chart-base-bg" : _this$asProps$baseBgC, _this$asProps$color = _this$asProps.color, color = _this$asProps$color === void 0 ? "chart-palette-order-1" : _this$asProps$color, resolveColor = _this$asProps.resolveColor, isSemiDonut = _this$asProps.isSemiDonut, loading = _this$asProps.loading, animate = _this$asProps.animate, duration = _this$asProps.duration;
46
- var scoreDonut = new ScoreDonutUtils(value, isSemiDonut);
47
- var _extractAriaProps = extractAriaProps(this.asProps), __excludeProps = _extractAriaProps.__excludeProps, extractedAriaProps = _extractAriaProps.extractedAriaProps;
48
- return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(SDonutContainer, _ref2.cn("SDonutContainer", _objectSpread({}, assignProps({
29
+ class DonutRoot extends Component {
30
+ render() {
31
+ var _ref = this.asProps, _ref2;
32
+ const SDonutContainer = Box;
33
+ const {
34
+ value,
35
+ styles,
36
+ baseBgColor = "chart-grid-bar-chart-base-bg",
37
+ color = "chart-palette-order-1",
38
+ resolveColor,
39
+ isSemiDonut,
40
+ loading,
41
+ animate,
42
+ duration
43
+ } = this.asProps;
44
+ const scoreDonut = new ScoreDonutUtils(value, isSemiDonut);
45
+ const {
46
+ __excludeProps,
47
+ extractedAriaProps
48
+ } = extractAriaProps(this.asProps);
49
+ return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(SDonutContainer, _ref2.cn("SDonutContainer", {
50
+ ...assignProps({
49
51
  "semi": isSemiDonut,
50
52
  "__excludeProps": __excludeProps
51
- }, _ref))), /* @__PURE__ */ React.createElement("svg", _ref2.cn("svg", _objectSpread({
52
- "width": "100%",
53
- "height": "100%",
54
- "viewBox": scoreDonut.viewBox,
55
- "fill": "none",
56
- "role": "img"
57
- }, extractedAriaProps)), /* @__PURE__ */ React.createElement("g", _ref2.cn("g", {}), /* @__PURE__ */ React.createElement("circle", _ref2.cn("circle", {
58
- "cx": "12",
59
- "cy": "12",
60
- "r": scoreDonut.radius,
61
- "strokeWidth": scoreDonut.strokeWidth,
62
- "stroke": resolveColor(baseBgColor),
63
- "strokeDasharray": loading ? void 0 : "".concat(scoreDonut.baseLength, " ").concat(scoreDonut.fullLength),
64
- "strokeDashoffset": scoreDonut.baseOffset
65
- }), animate && value > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("animate", _ref2.cn("animate", {
66
- "attributeName": "stroke-dasharray",
67
- "from": "".concat(scoreDonut.animatedBaseLengthFrom, " ").concat(scoreDonut.fullLength),
68
- "to": "".concat(scoreDonut.animatedBaseLengthTo, " ").concat(scoreDonut.fullLength),
69
- "dur": duration + "ms"
70
- })), /* @__PURE__ */ React.createElement("animate", _ref2.cn("animate", {
71
- "attributeName": "stroke-dashoffset",
72
- "from": -1 * scoreDonut.startMargin,
73
- "to": scoreDonut.baseOffset,
74
- "dur": duration + "ms"
75
- })))), !loading && value > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("circle", _ref2.cn("circle", {
76
- "cx": "12",
77
- "cy": "12",
78
- "r": scoreDonut.radius,
79
- "strokeWidth": scoreDonut.strokeWidth,
80
- "stroke": resolveColor(color),
81
- "strokeDasharray": "".concat(scoreDonut.valueLength, " ").concat(scoreDonut.fullLength)
82
- }), animate && /* @__PURE__ */ React.createElement("animate", _ref2.cn("animate", {
83
- "attributeName": "stroke-dasharray",
84
- "from": "0 ".concat(scoreDonut.fullLength),
85
- "to": "".concat(scoreDonut.valueLength, " ").concat(scoreDonut.fullLength),
86
- "dur": duration + "ms"
87
- })))))));
88
- }
89
- }]);
90
- })(Component);
53
+ }, _ref)
54
+ }), /* @__PURE__ */ React.createElement("svg", _ref2.cn("svg", {
55
+ "width": "100%",
56
+ "height": "100%",
57
+ "viewBox": scoreDonut.viewBox,
58
+ "fill": "none",
59
+ "role": "img",
60
+ ...extractedAriaProps
61
+ }), /* @__PURE__ */ React.createElement("g", _ref2.cn("g", {}), /* @__PURE__ */ React.createElement("circle", _ref2.cn("circle", {
62
+ "cx": "12",
63
+ "cy": "12",
64
+ "r": scoreDonut.radius,
65
+ "strokeWidth": scoreDonut.strokeWidth,
66
+ "stroke": resolveColor(baseBgColor),
67
+ "strokeDasharray": loading ? void 0 : `${scoreDonut.baseLength} ${scoreDonut.fullLength}`,
68
+ "strokeDashoffset": scoreDonut.baseOffset
69
+ }), animate && value > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("animate", _ref2.cn("animate", {
70
+ "attributeName": "stroke-dasharray",
71
+ "from": `${scoreDonut.animatedBaseLengthFrom} ${scoreDonut.fullLength}`,
72
+ "to": `${scoreDonut.animatedBaseLengthTo} ${scoreDonut.fullLength}`,
73
+ "dur": duration + "ms"
74
+ })), /* @__PURE__ */ React.createElement("animate", _ref2.cn("animate", {
75
+ "attributeName": "stroke-dashoffset",
76
+ "from": -1 * scoreDonut.startMargin,
77
+ "to": scoreDonut.baseOffset,
78
+ "dur": duration + "ms"
79
+ })))), !loading && value > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("circle", _ref2.cn("circle", {
80
+ "cx": "12",
81
+ "cy": "12",
82
+ "r": scoreDonut.radius,
83
+ "strokeWidth": scoreDonut.strokeWidth,
84
+ "stroke": resolveColor(color),
85
+ "strokeDasharray": `${scoreDonut.valueLength} ${scoreDonut.fullLength}`
86
+ }), animate && /* @__PURE__ */ React.createElement("animate", _ref2.cn("animate", {
87
+ "attributeName": "stroke-dasharray",
88
+ "from": `0 ${scoreDonut.fullLength}`,
89
+ "to": `${scoreDonut.valueLength} ${scoreDonut.fullLength}`,
90
+ "dur": duration + "ms"
91
+ })))))));
92
+ }
93
+ }
91
94
  _defineProperty(DonutRoot, "enhance", [cssVariableEnhance({
92
95
  variable: "--intergalactic-duration-extra-slow",
93
96
  fallback: "500",
94
- map: function map(v) {
95
- return Number.parseInt(v, 10).toString();
96
- },
97
+ map: (v) => Number.parseInt(v, 10).toString(),
97
98
  prop: "duration"
98
99
  }), resolveColorEnhance()]);
99
100
  _defineProperty(DonutRoot, "style", style);
100
101
  _defineProperty(DonutRoot, "defaultProps", {
101
102
  animate: true
102
103
  });
103
- var ScoreDonut = createComponent(DonutRoot);
104
+ const ScoreDonut = createComponent(DonutRoot);
104
105
  ScoreDonut.displayName = "MiniChart.ScoreDonut";
105
- var ScoreSemiDonut = createComponent(DonutRoot, {}, {
106
- enhancements: [function() {
106
+ const ScoreSemiDonut = createComponent(DonutRoot, {}, {
107
+ enhancements: [() => {
107
108
  return {
108
- wrapperProps: function wrapperProps(props) {
109
+ wrapperProps: (props) => {
109
110
  return assignProps(props, {
110
111
  isSemiDonut: true
111
112
  });
@@ -1,107 +1,111 @@
1
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/esm/createClass";
4
- import _callSuper from "@babel/runtime/helpers/esm/callSuper";
5
- import _inherits from "@babel/runtime/helpers/esm/inherits";
6
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
7
- import { createComponent, sstyled, assignProps, Component } from "@semcore/core";
2
+ import { createComponent, Component, sstyled, assignProps } from "@semcore/core";
3
+ import { Box, Flex } from "@semcore/base-components";
8
4
  import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
9
- import { Box, Flex } from "@semcore/flex-box";
10
5
  import React from "react";
11
6
  /*!__reshadow-styles__:"./line.shadow.css"*/
12
- var style = (
7
+ const style = (
13
8
  /*__reshadow_css_start__*/
14
9
  (sstyled.insert(
15
10
  /*__inner_css_start__*/
16
- "@keyframes pulse_fmdk9{0%,to{opacity:1}50%{opacity:.4}}@keyframes move-line_fmdk9{0%{transform:translateX(0)}to{transform:translateX(100%)}}.___SDonutContainer_fmdk9_gg_.__loading_fmdk9_gg_,.___SLineGauge_fmdk9_gg_.__loading_fmdk9_gg_,.___STrendBar_fmdk9_gg_.__loading_fmdk9_gg_,.___STrendLine_fmdk9_gg_.__loading_fmdk9_gg_{animation-name:pulse_fmdk9;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SLineGauge_fmdk9_gg_{height:8px;background-color:var(--base-bg-color_fmdk9, var(--intergalactic-chart-grid-bar-chart-base-bg, #e0e1e9));border-radius:var(--intergalactic-chart-rounded, 2px);overflow:hidden;position:relative}.___SLineValue_fmdk9_gg_{height:8px;border-radius:var(--intergalactic-chart-rounded, 2px)0 0 var(--intergalactic-chart-rounded, 2px)}.___SLineValue_fmdk9_gg_.__percent_fmdk9_gg_{width:var(--percent_fmdk9)}.___SLineSegmentItem_fmdk9_gg_.__color_fmdk9_gg_,.___SLineValue_fmdk9_gg_.__color_fmdk9_gg_{background-color:var(--color_fmdk9, var(--intergalactic-chart-palette-order-1, #2bb3ff))}.___SLineGauge_fmdk9_gg_.__segments_fmdk9_gg_{border-radius:var(--intergalactic-progress-bar-rounded, 6px)}.___SAnimationLine_fmdk9_gg_,.___SLineGaugeSegment_fmdk9_gg_{position:absolute;top:0;left:0;right:0;bottom:0}.___SLineSegmentItem_fmdk9_gg_:last-child{margin-right:0;border-right:none}.___SLineSegmentItem_fmdk9_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_fmdk9_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_fmdk9;animation-duration:.5s;animation-timing-function:ease-in-out;animation-fill-mode:forwards}",
11
+ "@keyframes pulse_1q9hd{0%,to{opacity:1}50%{opacity:.4}}@keyframes move-line_1q9hd{0%{transform:translateX(0)}to{transform:translateX(100%)}}.___SDonutContainer_1q9hd_gg_.__loading_1q9hd_gg_,.___SLineGauge_1q9hd_gg_.__loading_1q9hd_gg_,.___STrendBar_1q9hd_gg_.__loading_1q9hd_gg_,.___STrendLine_1q9hd_gg_.__loading_1q9hd_gg_{animation-name:pulse_1q9hd;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SLineGauge_1q9hd_gg_{height:8px;background-color:var(--base-bg-color_1q9hd, var(--intergalactic-chart-grid-bar-chart-base-bg, #e0e1e9));border-radius:var(--intergalactic-chart-rounded, 2px);overflow:hidden;position:relative}.___SLineValue_1q9hd_gg_{height:8px;border-radius:var(--intergalactic-chart-rounded, 2px)0 0 var(--intergalactic-chart-rounded, 2px)}.___SLineValue_1q9hd_gg_.__percent_1q9hd_gg_{width:var(--percent_1q9hd)}.___SLineSegmentItem_1q9hd_gg_.__color_1q9hd_gg_,.___SLineValue_1q9hd_gg_.__color_1q9hd_gg_{background-color:var(--color_1q9hd, var(--intergalactic-chart-palette-order-1, #2bb3ff))}.___SLineGauge_1q9hd_gg_.__segments_1q9hd_gg_{border-radius:var(--intergalactic-progress-bar-rounded, 6px)}.___SAnimationLine_1q9hd_gg_,.___SLineGaugeSegment_1q9hd_gg_{position:absolute;top:0;left:0;right:0;bottom:0}.___SLineSegmentItem_1q9hd_gg_:last-child{margin-right:0;border-right:none}.___SLineSegmentItem_1q9hd_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_1q9hd_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_1q9hd;animation-duration:.5s;animation-timing-function:ease-in-out;animation-fill-mode:forwards}",
17
12
  /*__inner_css_end__*/
18
- "fmdk9_gg_"
13
+ "1q9hd_gg_"
19
14
  ), /*__reshadow_css_end__*/
20
15
  {
21
- "__SLineGauge": "___SLineGauge_fmdk9_gg_",
22
- "_loading": "__loading_fmdk9_gg_",
23
- "__SDonutContainer": "___SDonutContainer_fmdk9_gg_",
24
- "__STrendLine": "___STrendLine_fmdk9_gg_",
25
- "__STrendBar": "___STrendBar_fmdk9_gg_",
26
- "@pulse": "pulse_fmdk9",
27
- "--base-bg-color": "--base-bg-color_fmdk9",
28
- "__SLineValue": "___SLineValue_fmdk9_gg_",
29
- "_percent": "__percent_fmdk9_gg_",
30
- "--percent": "--percent_fmdk9",
31
- "_color": "__color_fmdk9_gg_",
32
- "__SLineSegmentItem": "___SLineSegmentItem_fmdk9_gg_",
33
- "--color": "--color_fmdk9",
34
- "_segments": "__segments_fmdk9_gg_",
35
- "__SLineGaugeSegment": "___SLineGaugeSegment_fmdk9_gg_",
36
- "__SAnimationLine": "___SAnimationLine_fmdk9_gg_",
37
- "@move-line": "move-line_fmdk9"
16
+ "__SLineGauge": "___SLineGauge_1q9hd_gg_",
17
+ "_loading": "__loading_1q9hd_gg_",
18
+ "__SDonutContainer": "___SDonutContainer_1q9hd_gg_",
19
+ "__STrendLine": "___STrendLine_1q9hd_gg_",
20
+ "__STrendBar": "___STrendBar_1q9hd_gg_",
21
+ "@pulse": "pulse_1q9hd",
22
+ "--base-bg-color": "--base-bg-color_1q9hd",
23
+ "__SLineValue": "___SLineValue_1q9hd_gg_",
24
+ "_percent": "__percent_1q9hd_gg_",
25
+ "--percent": "--percent_1q9hd",
26
+ "_color": "__color_1q9hd_gg_",
27
+ "__SLineSegmentItem": "___SLineSegmentItem_1q9hd_gg_",
28
+ "--color": "--color_1q9hd",
29
+ "_segments": "__segments_1q9hd_gg_",
30
+ "__SLineGaugeSegment": "___SLineGaugeSegment_1q9hd_gg_",
31
+ "__SAnimationLine": "___SAnimationLine_1q9hd_gg_",
32
+ "@move-line": "move-line_1q9hd"
38
33
  })
39
34
  );
40
- var LineRoot = /* @__PURE__ */ (function(_Component) {
41
- function LineRoot2() {
42
- _classCallCheck(this, LineRoot2);
43
- return _callSuper(this, LineRoot2, arguments);
35
+ class LineRoot extends Component {
36
+ getSegmentProps(segmentProps) {
37
+ const {
38
+ children,
39
+ resolveColor
40
+ } = this.asProps;
41
+ let sum = 0;
42
+ React.Children.forEach(children, (child) => {
43
+ if (/* @__PURE__ */ React.isValidElement(child)) {
44
+ sum = sum + child.props.value;
45
+ }
46
+ });
47
+ const width = sum > 0 ? 100 * segmentProps.value / sum : 0;
48
+ return {
49
+ "w": `${width}%`,
50
+ "use:color": resolveColor(segmentProps.color)
51
+ };
44
52
  }
45
- _inherits(LineRoot2, _Component);
46
- return _createClass(LineRoot2, [{
47
- key: "getSegmentProps",
48
- value: function getSegmentProps(segmentProps) {
49
- var _this$asProps = this.asProps, children = _this$asProps.children, resolveColor = _this$asProps.resolveColor;
50
- var sum = 0;
51
- React.Children.forEach(children, function(child) {
52
- if (/* @__PURE__ */ React.isValidElement(child)) {
53
- sum = sum + child.props.value;
54
- }
55
- });
56
- var width = sum > 0 ? 100 * segmentProps.value / sum : 0;
57
- return {
58
- "w": "".concat(width, "%"),
59
- "use:color": resolveColor(segmentProps.color)
60
- };
61
- }
62
- }, {
63
- key: "render",
64
- value: function render() {
65
- var _ref = this.asProps, _ref5;
66
- var SLineGauge = Box;
67
- var SLineValue = Box;
68
- var SAnimationLine = Box;
69
- var SLineGaugeSegment = Flex;
70
- var SLineSegmentItem = Box;
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;
72
- if (children !== void 0) {
73
- var _ref3;
74
- return _ref3 = sstyled(styles), /* @__PURE__ */ React.createElement(SLineGauge, _ref3.cn("SLineGauge", _objectSpread({}, assignProps({
53
+ render() {
54
+ var _ref = this.asProps, _ref5;
55
+ const SLineGauge = Box;
56
+ const SLineValue = Box;
57
+ const SAnimationLine = Box;
58
+ const SLineGaugeSegment = Flex;
59
+ const SLineSegmentItem = Box;
60
+ const {
61
+ value,
62
+ styles,
63
+ color = "chart-palette-order-1",
64
+ baseBgColor,
65
+ resolveColor,
66
+ loading,
67
+ children,
68
+ Children,
69
+ animate
70
+ } = this.asProps;
71
+ if (children !== void 0) {
72
+ var _ref3;
73
+ return _ref3 = sstyled(styles), /* @__PURE__ */ React.createElement(SLineGauge, _ref3.cn("SLineGauge", {
74
+ ...assignProps({
75
75
  "segments": true,
76
76
  "base-bg-color": resolveColor(baseBgColor)
77
- }, _ref))), /* @__PURE__ */ React.createElement(SLineGaugeSegment, _ref3.cn("SLineGaugeSegment", {}), /* @__PURE__ */ React.createElement(Children, _ref3.cn("Children", {}))), animate && /* @__PURE__ */ React.createElement(SAnimationLine, _ref3.cn("SAnimationLine", {})));
78
- }
79
- var segments = this.asProps.segments;
80
- var SegmentItems = [];
81
- if (segments) {
82
- for (var i = 0; i < segments; i++) {
83
- var _ref4;
84
- var width = "calc((100% - ".concat(segments - 1, "px) / ").concat(segments, ")");
85
- SegmentItems.push((_ref4 = sstyled(styles), /* @__PURE__ */ React.createElement(SLineSegmentItem, _ref4.cn("SLineSegmentItem", {
86
- "key": i,
87
- "color": i < value ? resolveColor(color) : void 0,
88
- "w": width
89
- }))));
90
- }
91
- }
92
- var percent = "".concat(value, "%");
93
- if (segments) {
94
- percent = "".concat(value / segments * 100, "%");
77
+ }, _ref)
78
+ }), /* @__PURE__ */ React.createElement(SLineGaugeSegment, _ref3.cn("SLineGaugeSegment", {}), /* @__PURE__ */ React.createElement(Children, _ref3.cn("Children", {}))), animate && /* @__PURE__ */ React.createElement(SAnimationLine, _ref3.cn("SAnimationLine", {})));
79
+ }
80
+ const {
81
+ segments
82
+ } = this.asProps;
83
+ const SegmentItems = [];
84
+ if (segments) {
85
+ for (let i = 0; i < segments; i++) {
86
+ var _ref4;
87
+ const width = `calc((100% - ${segments - 1}px) / ${segments})`;
88
+ SegmentItems.push((_ref4 = sstyled(styles), /* @__PURE__ */ React.createElement(SLineSegmentItem, _ref4.cn("SLineSegmentItem", {
89
+ "key": i,
90
+ "color": i < value ? resolveColor(color) : void 0,
91
+ "w": width
92
+ }))));
95
93
  }
96
- return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(SLineGauge, _ref5.cn("SLineGauge", _objectSpread({}, assignProps({
97
- "base-bg-color": resolveColor(baseBgColor)
98
- }, _ref))), !loading && /* @__PURE__ */ React.createElement(SLineValue, _ref5.cn("SLineValue", {
99
- "w": percent,
100
- "color": resolveColor(color)
101
- })), Boolean(SegmentItems.length) && /* @__PURE__ */ React.createElement(SLineGaugeSegment, _ref5.cn("SLineGaugeSegment", {}), SegmentItems), animate && /* @__PURE__ */ React.createElement(SAnimationLine, _ref5.cn("SAnimationLine", {})));
102
94
  }
103
- }]);
104
- })(Component);
95
+ let percent = `${value}%`;
96
+ if (segments) {
97
+ percent = `${value / segments * 100}%`;
98
+ }
99
+ return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(SLineGauge, _ref5.cn("SLineGauge", {
100
+ ...assignProps({
101
+ "base-bg-color": resolveColor(baseBgColor)
102
+ }, _ref)
103
+ }), !loading && /* @__PURE__ */ React.createElement(SLineValue, _ref5.cn("SLineValue", {
104
+ "w": percent,
105
+ "color": resolveColor(color)
106
+ })), Boolean(SegmentItems.length) && /* @__PURE__ */ React.createElement(SLineGaugeSegment, _ref5.cn("SLineGaugeSegment", {}), SegmentItems), animate && /* @__PURE__ */ React.createElement(SAnimationLine, _ref5.cn("SAnimationLine", {})));
107
+ }
108
+ }
105
109
  _defineProperty(LineRoot, "enhance", [resolveColorEnhance()]);
106
110
  _defineProperty(LineRoot, "displayName", "ScoreLine");
107
111
  _defineProperty(LineRoot, "style", style);
@@ -110,13 +114,18 @@ _defineProperty(LineRoot, "defaultProps", {
110
114
  });
111
115
  function Segment(props) {
112
116
  var _ref2 = arguments[0], _ref6;
113
- var styles = props.styles, value = props.value;
114
- var SLineSegmentItem = Box;
117
+ const {
118
+ styles,
119
+ value
120
+ } = props;
121
+ const SLineSegmentItem = Box;
115
122
  if (!value) return null;
116
- return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SLineSegmentItem, _ref6.cn("SLineSegmentItem", _objectSpread({}, assignProps({}, _ref2))));
123
+ return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SLineSegmentItem, _ref6.cn("SLineSegmentItem", {
124
+ ...assignProps({}, _ref2)
125
+ }));
117
126
  }
118
127
  Segment.displayName = "Segment";
119
- var ScoreLine = createComponent(LineRoot, {
128
+ const ScoreLine = createComponent(LineRoot, {
120
129
  Segment
121
130
  });
122
131
  ScoreLine.displayName = "MiniChart.ScoreLine";