@semcore/mini-chart 0.30.0-prerelease.4 → 0.30.0-prerelease.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/component/score/Donut.js +60 -64
- package/lib/cjs/component/score/Donut.js.map +1 -1
- package/lib/cjs/component/score/Line.js +38 -41
- package/lib/cjs/component/score/Line.js.map +1 -1
- package/lib/cjs/component/score/Line.types.js.map +1 -1
- package/lib/cjs/component/score/Score.js.map +1 -1
- package/lib/cjs/component/score/index.js.map +1 -1
- package/lib/cjs/component/trend/Bar.js +22 -28
- package/lib/cjs/component/trend/Bar.js.map +1 -1
- package/lib/cjs/component/trend/Line.js +20 -26
- package/lib/cjs/component/trend/Line.js.map +1 -1
- package/lib/cjs/component/trend/Trend.js +9 -13
- package/lib/cjs/component/trend/Trend.js.map +1 -1
- package/lib/cjs/component/trend/index.js +1 -1
- package/lib/cjs/component/trend/index.js.map +1 -1
- package/lib/cjs/index.js +1 -2
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/utils/ScoreDonutUtils.js +87 -0
- package/lib/cjs/utils/ScoreDonutUtils.js.map +1 -0
- package/lib/es6/component/score/Donut.js +57 -58
- package/lib/es6/component/score/Donut.js.map +1 -1
- package/lib/es6/component/score/Line.js +31 -31
- package/lib/es6/component/score/Line.js.map +1 -1
- package/lib/es6/component/score/Line.types.js.map +1 -1
- package/lib/es6/component/score/Score.js.map +1 -1
- package/lib/es6/component/score/index.js.map +1 -1
- package/lib/es6/component/trend/Bar.js +19 -21
- package/lib/es6/component/trend/Bar.js.map +1 -1
- package/lib/es6/component/trend/Line.js +17 -19
- package/lib/es6/component/trend/Line.js.map +1 -1
- package/lib/es6/component/trend/Trend.js +7 -10
- package/lib/es6/component/trend/Trend.js.map +1 -1
- package/lib/es6/component/trend/index.js +1 -1
- package/lib/es6/component/trend/index.js.map +1 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/utils/ScoreDonutUtils.js +80 -0
- package/lib/es6/utils/ScoreDonutUtils.js.map +1 -0
- package/lib/esm/component/score/Donut.mjs +58 -61
- package/lib/esm/component/score/Line.mjs +35 -37
- package/lib/esm/component/score/index.mjs +7 -0
- package/lib/esm/component/trend/Bar.mjs +20 -23
- package/lib/esm/component/trend/Line.mjs +20 -23
- package/lib/esm/component/trend/Trend.mjs +9 -12
- package/lib/esm/component/trend/index.mjs +8 -0
- package/lib/esm/index.mjs +5 -3
- package/lib/esm/utils/ScoreDonutUtils.mjs +82 -0
- package/lib/types/component/score/Donut.d.ts +8 -11
- package/lib/types/component/score/Line.d.ts +1 -1
- package/lib/types/component/score/Line.types.d.ts +11 -9
- package/lib/types/component/trend/Bar.d.ts +3 -9
- package/lib/types/component/trend/Line.d.ts +7 -11
- package/lib/types/component/trend/Trend.d.ts +4 -4
- package/lib/types/component/trend/index.d.ts +1 -1
- package/lib/types/utils/ScoreDonutUtils.d.ts +18 -0
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["TrendBar","TrendHistogram","TrendLine","TrendArea"],"sources":["../../../../src/component/trend/index.ts"],"sourcesContent":["import { TrendBar, TrendHistogram } from './Bar';\nimport { TrendLine, TrendArea } from './Line';\n\nexport { TrendLine, TrendArea, TrendBar, TrendHistogram };\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,cAAc,QAAQ,OAAO;AAChD,SAASC,SAAS,EAAEC,SAAS,QAAQ,QAAQ;AAE7C,SAASD,SAAS,EAAEC,SAAS,EAAEH,QAAQ,EAAEC,cAAc","ignoreList":[]}
|
package/lib/es6/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ScoreLine","ScoreDonut","ScoreSemiDonut","TrendLine","TrendArea","TrendBar","TrendHistogram","miniCharts"],"sources":["../../src/index.ts"],"sourcesContent":["import { ScoreLine, ScoreDonut, ScoreSemiDonut } from './component/score';\nimport { TrendLine, TrendArea, TrendBar, TrendHistogram } from './component/trend';\n\nconst miniCharts: {\n TrendLine: typeof TrendLine;\n TrendArea: typeof TrendArea;\n TrendBar: typeof TrendBar;\n TrendHistogram: typeof TrendHistogram;\n ScoreSemiDonut: typeof ScoreSemiDonut;\n ScoreDonut: typeof ScoreDonut;\n ScoreLine: typeof ScoreLine;\n} = {\n TrendLine,\n TrendArea,\n TrendBar,\n TrendHistogram,\n ScoreSemiDonut,\n ScoreDonut,\n ScoreLine,\n};\n\nexport default miniCharts;\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,UAAU,EAAEC,cAAc,QAAQ,mBAAmB;AACzE,SAASC,SAAS,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,cAAc,QAAQ,mBAAmB;AAElF,IAAMC,UAQL,GAAG;EACFJ,SAAS,EAATA,SAAS;EACTC,SAAS,EAATA,SAAS;EACTC,QAAQ,EAARA,QAAQ;EACRC,cAAc,EAAdA,cAAc;EACdJ,cAAc,EAAdA,cAAc;EACdD,UAAU,EAAVA,UAAU;EACVD,SAAS,EAATA;AACF,CAAC;AAED,eAAeO,UAAU"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["ScoreLine","ScoreDonut","ScoreSemiDonut","TrendLine","TrendArea","TrendBar","TrendHistogram","miniCharts"],"sources":["../../src/index.ts"],"sourcesContent":["import { ScoreLine, ScoreDonut, ScoreSemiDonut } from './component/score';\nimport { TrendLine, TrendArea, TrendBar, TrendHistogram } from './component/trend';\n\nconst miniCharts: {\n TrendLine: typeof TrendLine;\n TrendArea: typeof TrendArea;\n TrendBar: typeof TrendBar;\n TrendHistogram: typeof TrendHistogram;\n ScoreSemiDonut: typeof ScoreSemiDonut;\n ScoreDonut: typeof ScoreDonut;\n ScoreLine: typeof ScoreLine;\n} = {\n TrendLine,\n TrendArea,\n TrendBar,\n TrendHistogram,\n ScoreSemiDonut,\n ScoreDonut,\n ScoreLine,\n};\n\nexport default miniCharts;\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,UAAU,EAAEC,cAAc,QAAQ,mBAAmB;AACzE,SAASC,SAAS,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,cAAc,QAAQ,mBAAmB;AAElF,IAAMC,UAQL,GAAG;EACFJ,SAAS,EAATA,SAAS;EACTC,SAAS,EAATA,SAAS;EACTC,QAAQ,EAARA,QAAQ;EACRC,cAAc,EAAdA,cAAc;EACdJ,cAAc,EAAdA,cAAc;EACdD,UAAU,EAAVA,UAAU;EACVD,SAAS,EAATA;AACF,CAAC;AAED,eAAeO,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
export var ScoreDonutUtils = /*#__PURE__*/function () {
|
|
5
|
+
function ScoreDonutUtils(value, isSemiDonut) {
|
|
6
|
+
_classCallCheck(this, ScoreDonutUtils);
|
|
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(ScoreDonutUtils, [{
|
|
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
|
+
//# sourceMappingURL=ScoreDonutUtils.js.map
|
|
@@ -0,0 +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,104 +1,101 @@
|
|
|
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/
|
|
8
|
-
import
|
|
7
|
+
import { sstyled, assignProps, Component, createComponent } from "@semcore/core";
|
|
8
|
+
import { Box } from "@semcore/base-components";
|
|
9
|
+
import { extractAriaProps } from "@semcore/core/lib/utils/ariaProps";
|
|
10
|
+
import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
|
|
11
|
+
import { cssVariableEnhance } from "@semcore/core/lib/utils/useCssVariable";
|
|
9
12
|
import React from "react";
|
|
10
|
-
import {
|
|
11
|
-
import resolveColorEnhance from "@semcore/utils/lib/enhances/resolveColorEnhance";
|
|
12
|
-
import { extractAriaProps } from "@semcore/utils/lib/ariaProps";
|
|
13
|
+
import { ScoreDonutUtils } from "../../utils/ScoreDonutUtils.mjs";
|
|
13
14
|
/*!__reshadow-styles__:"./donut.shadow.css"*/
|
|
14
15
|
var style = (
|
|
15
16
|
/*__reshadow_css_start__*/
|
|
16
17
|
(sstyled.insert(
|
|
17
18
|
/*__inner_css_start__*/
|
|
18
|
-
"@keyframes
|
|
19
|
+
"@keyframes pulse_w54vj{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_w54vj_gg_.__loading_w54vj_gg_,.___SLineGauge_w54vj_gg_.__loading_w54vj_gg_,.___STrendBar_w54vj_gg_.__loading_w54vj_gg_,.___STrendLine_w54vj_gg_.__loading_w54vj_gg_{animation-name:pulse_w54vj;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SDonutContainer_w54vj_gg_.__semi_w54vj_gg_ g{transform:rotate(180deg) translate(-24px,-24px)}.___SDonutContainer_w54vj_gg_ g{transform:rotate(-90deg) translate(-24px)}.___SDonutContainer_w54vj_gg_.__animate_w54vj_gg_ circle{transition:all var(--intergalactic-duration-extra-slow, 500) ease-in-out}",
|
|
19
20
|
/*__inner_css_end__*/
|
|
20
|
-
"
|
|
21
|
+
"w54vj_gg_"
|
|
21
22
|
), /*__reshadow_css_end__*/
|
|
22
23
|
{
|
|
23
|
-
"__SLineGauge": "
|
|
24
|
-
"_loading": "
|
|
25
|
-
"__SDonutContainer": "
|
|
26
|
-
"__STrendLine": "
|
|
27
|
-
"__STrendBar": "
|
|
28
|
-
"@pulse": "
|
|
29
|
-
"_animate": "
|
|
30
|
-
"_semi": "
|
|
24
|
+
"__SLineGauge": "___SLineGauge_w54vj_gg_",
|
|
25
|
+
"_loading": "__loading_w54vj_gg_",
|
|
26
|
+
"__SDonutContainer": "___SDonutContainer_w54vj_gg_",
|
|
27
|
+
"__STrendLine": "___STrendLine_w54vj_gg_",
|
|
28
|
+
"__STrendBar": "___STrendBar_w54vj_gg_",
|
|
29
|
+
"@pulse": "pulse_w54vj",
|
|
30
|
+
"_animate": "__animate_w54vj_gg_",
|
|
31
|
+
"_semi": "__semi_w54vj_gg_"
|
|
31
32
|
})
|
|
32
33
|
);
|
|
33
|
-
var DonutRoot = /* @__PURE__ */ function(_Component) {
|
|
34
|
-
_inherits(DonutRoot2, _Component);
|
|
35
|
-
var _super = _createSuper(DonutRoot2);
|
|
34
|
+
var DonutRoot = /* @__PURE__ */ (function(_Component) {
|
|
36
35
|
function DonutRoot2() {
|
|
37
36
|
_classCallCheck(this, DonutRoot2);
|
|
38
|
-
return
|
|
37
|
+
return _callSuper(this, DonutRoot2, arguments);
|
|
39
38
|
}
|
|
40
|
-
|
|
39
|
+
_inherits(DonutRoot2, _Component);
|
|
40
|
+
return _createClass(DonutRoot2, [{
|
|
41
41
|
key: "render",
|
|
42
42
|
value: function render() {
|
|
43
43
|
var _ref = this.asProps, _ref2;
|
|
44
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;
|
|
46
|
-
var
|
|
47
|
-
var radius = isSemiDonut ? 9 : 10;
|
|
48
|
-
var baseStrokeDasharray = isSemiDonut ? Math.PI * radius : Math.PI * 2 * radius;
|
|
49
|
-
var valueStrokeDasharray = baseStrokeDasharray * (value / 100);
|
|
50
|
-
var greyStrokeDasharray = baseStrokeDasharray * ((100 - value) / 100);
|
|
51
|
-
var offsetPoint = isSemiDonut ? baseStrokeDasharray / (100 / 3) : baseStrokeDasharray / 100;
|
|
52
|
-
var strokeDasharrayBetweenSpaces = "".concat(greyStrokeDasharray - 2 * offsetPoint, " ").concat(offsetPoint);
|
|
53
|
-
var spaceStrokeDasharray = "".concat(offsetPoint, " ").concat(value < 99 ? "".concat(strokeDasharrayBetweenSpaces) : "", " ").concat(baseStrokeDasharray);
|
|
54
|
-
if (isSemiDonut) {
|
|
55
|
-
spaceStrokeDasharray = "".concat(offsetPoint, " ").concat(value < 95 ? "".concat(strokeDasharrayBetweenSpaces) : "", " ").concat(baseStrokeDasharray);
|
|
56
|
-
}
|
|
57
|
-
var viewBox = isSemiDonut ? "0 0 24 12" : "0 0 24 24";
|
|
58
|
-
var strokeDashoffsetBase = -1 * (valueStrokeDasharray + (isSemiDonut ? offsetPoint : 0));
|
|
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);
|
|
59
47
|
var _extractAriaProps = extractAriaProps(this.asProps), __excludeProps = _extractAriaProps.__excludeProps, extractedAriaProps = _extractAriaProps.extractedAriaProps;
|
|
60
|
-
return _ref2 = sstyled
|
|
48
|
+
return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(SDonutContainer, _ref2.cn("SDonutContainer", _objectSpread({}, assignProps({
|
|
61
49
|
"semi": isSemiDonut,
|
|
62
50
|
"__excludeProps": __excludeProps
|
|
63
51
|
}, _ref))), /* @__PURE__ */ React.createElement("svg", _ref2.cn("svg", _objectSpread({
|
|
64
52
|
"width": "100%",
|
|
65
53
|
"height": "100%",
|
|
66
|
-
"viewBox": viewBox,
|
|
54
|
+
"viewBox": scoreDonut.viewBox,
|
|
67
55
|
"fill": "none",
|
|
68
56
|
"role": "img"
|
|
69
57
|
}, extractedAriaProps)), /* @__PURE__ */ React.createElement("g", _ref2.cn("g", {}), /* @__PURE__ */ React.createElement("circle", _ref2.cn("circle", {
|
|
70
58
|
"cx": "12",
|
|
71
59
|
"cy": "12",
|
|
72
|
-
"r": radius,
|
|
73
|
-
"strokeWidth": strokeWidth,
|
|
60
|
+
"r": scoreDonut.radius,
|
|
61
|
+
"strokeWidth": scoreDonut.strokeWidth,
|
|
74
62
|
"stroke": resolveColor(baseBgColor),
|
|
75
|
-
"strokeDasharray": loading ? void 0 : "".concat(
|
|
76
|
-
"strokeDashoffset":
|
|
77
|
-
})
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
|
|
83
|
-
"strokeDasharray": "".concat(valueStrokeDasharray, " ").concat(baseStrokeDasharray),
|
|
84
|
-
"strokeDashoffset": valueStrokeDasharray
|
|
85
|
-
}), /* @__PURE__ */ React.createElement("animate", _ref2.cn("animate", {
|
|
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", {
|
|
86
71
|
"attributeName": "stroke-dashoffset",
|
|
87
|
-
"
|
|
88
|
-
|
|
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", {
|
|
89
76
|
"cx": "12",
|
|
90
77
|
"cy": "12",
|
|
91
|
-
"r": radius,
|
|
92
|
-
"strokeWidth": strokeWidth,
|
|
93
|
-
"stroke": resolveColor(
|
|
94
|
-
"strokeDasharray":
|
|
95
|
-
|
|
96
|
-
|
|
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
|
+
})))))));
|
|
97
88
|
}
|
|
98
89
|
}]);
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
90
|
+
})(Component);
|
|
91
|
+
_defineProperty(DonutRoot, "enhance", [cssVariableEnhance({
|
|
92
|
+
variable: "--intergalactic-duration-extra-slow",
|
|
93
|
+
fallback: "500",
|
|
94
|
+
map: function map(v) {
|
|
95
|
+
return Number.parseInt(v, 10).toString();
|
|
96
|
+
},
|
|
97
|
+
prop: "duration"
|
|
98
|
+
}), resolveColorEnhance()]);
|
|
102
99
|
_defineProperty(DonutRoot, "style", style);
|
|
103
100
|
_defineProperty(DonutRoot, "defaultProps", {
|
|
104
101
|
animate: true
|
|
@@ -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/
|
|
8
|
-
import
|
|
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
|
|
16
|
+
"@keyframes pulse_1y4lp{0%,to{opacity:1}50%{opacity:.4}}@keyframes move-line_1y4lp{0%{transform:translateX(0)}to{transform:translateX(100%)}}.___SDonutContainer_1y4lp_gg_.__loading_1y4lp_gg_,.___SLineGauge_1y4lp_gg_.__loading_1y4lp_gg_,.___STrendBar_1y4lp_gg_.__loading_1y4lp_gg_,.___STrendLine_1y4lp_gg_.__loading_1y4lp_gg_{animation-name:pulse_1y4lp;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SLineGauge_1y4lp_gg_{height:8px;background-color:var(--base-bg-color_1y4lp, var(--intergalactic-chart-grid-bar-chart-base-bg, rgb(241, 242, 242)));border-radius:var(--intergalactic-chart-rounded, 2px);overflow:hidden;position:relative}.___SLineValue_1y4lp_gg_{height:8px;border-radius:var(--intergalactic-chart-rounded, 2px)0 0 var(--intergalactic-chart-rounded, 2px)}.___SLineValue_1y4lp_gg_.__percent_1y4lp_gg_{width:var(--percent_1y4lp)}.___SLineSegmentItem_1y4lp_gg_.__color_1y4lp_gg_,.___SLineValue_1y4lp_gg_.__color_1y4lp_gg_{background-color:var(--color_1y4lp, var(--intergalactic-chart-palette-order-1, rgb(102, 107, 219)))}.___SLineGauge_1y4lp_gg_.__segments_1y4lp_gg_{border-radius:var(--intergalactic-progress-bar-rounded, 6px)}.___SAnimationLine_1y4lp_gg_,.___SLineGaugeSegment_1y4lp_gg_{position:absolute;top:0;left:0;right:0;bottom:0}.___SLineSegmentItem_1y4lp_gg_:last-child{margin-right:0;border-right:none}.___SLineSegmentItem_1y4lp_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_1y4lp_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_1y4lp;animation-duration:.5s;animation-timing-function:ease-in-out;animation-fill-mode:forwards}",
|
|
18
17
|
/*__inner_css_end__*/
|
|
19
|
-
"
|
|
18
|
+
"1y4lp_gg_"
|
|
20
19
|
), /*__reshadow_css_end__*/
|
|
21
20
|
{
|
|
22
|
-
"__SLineGauge": "
|
|
23
|
-
"_loading": "
|
|
24
|
-
"__SDonutContainer": "
|
|
25
|
-
"__STrendLine": "
|
|
26
|
-
"__STrendBar": "
|
|
27
|
-
"@pulse": "
|
|
28
|
-
"__SLineValue": "
|
|
29
|
-
"_percent": "
|
|
30
|
-
"--percent": "--
|
|
31
|
-
"_color": "
|
|
32
|
-
"__SLineSegmentItem": "
|
|
33
|
-
"_segments": "
|
|
34
|
-
"__SLineGaugeSegment": "
|
|
35
|
-
"__SAnimationLine": "
|
|
36
|
-
"@move-line": "move-
|
|
37
|
-
"--base-bg-color": "--base-bg-
|
|
38
|
-
"--color": "--
|
|
21
|
+
"__SLineGauge": "___SLineGauge_1y4lp_gg_",
|
|
22
|
+
"_loading": "__loading_1y4lp_gg_",
|
|
23
|
+
"__SDonutContainer": "___SDonutContainer_1y4lp_gg_",
|
|
24
|
+
"__STrendLine": "___STrendLine_1y4lp_gg_",
|
|
25
|
+
"__STrendBar": "___STrendBar_1y4lp_gg_",
|
|
26
|
+
"@pulse": "pulse_1y4lp",
|
|
27
|
+
"__SLineValue": "___SLineValue_1y4lp_gg_",
|
|
28
|
+
"_percent": "__percent_1y4lp_gg_",
|
|
29
|
+
"--percent": "--percent_1y4lp",
|
|
30
|
+
"_color": "__color_1y4lp_gg_",
|
|
31
|
+
"__SLineSegmentItem": "___SLineSegmentItem_1y4lp_gg_",
|
|
32
|
+
"_segments": "__segments_1y4lp_gg_",
|
|
33
|
+
"__SLineGaugeSegment": "___SLineGaugeSegment_1y4lp_gg_",
|
|
34
|
+
"__SAnimationLine": "___SAnimationLine_1y4lp_gg_",
|
|
35
|
+
"@move-line": "move-line_1y4lp",
|
|
36
|
+
"--base-bg-color": "--base-bg-color_1y4lp",
|
|
37
|
+
"--color": "--color_1y4lp"
|
|
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
|
|
43
|
+
return _callSuper(this, LineRoot2, arguments);
|
|
47
44
|
}
|
|
48
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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, {
|
|
@@ -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/
|
|
9
|
-
import
|
|
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
|
|
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
|
-
"
|
|
21
|
+
"1yrsa_gg_"
|
|
23
22
|
), /*__reshadow_css_end__*/
|
|
24
23
|
{
|
|
25
|
-
"__SLineGauge": "
|
|
26
|
-
"_loading": "
|
|
27
|
-
"__SDonutContainer": "
|
|
28
|
-
"__STrendLine": "
|
|
29
|
-
"__STrendBar": "
|
|
30
|
-
"@pulse": "
|
|
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
|
|
35
|
+
return _callSuper(this, TrendBarRoot2, arguments);
|
|
39
36
|
}
|
|
40
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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/
|
|
9
|
-
import
|
|
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
|
|
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
|
-
"
|
|
22
|
+
"1yrsa_gg_"
|
|
24
23
|
), /*__reshadow_css_end__*/
|
|
25
24
|
{
|
|
26
|
-
"__SLineGauge": "
|
|
27
|
-
"_loading": "
|
|
28
|
-
"__SDonutContainer": "
|
|
29
|
-
"__STrendLine": "
|
|
30
|
-
"__STrendBar": "
|
|
31
|
-
"@pulse": "
|
|
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
|
|
36
|
+
return _callSuper(this, TrendLineRoot2, arguments);
|
|
40
37
|
}
|
|
41
|
-
|
|
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
|
|
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
|
-
|
|
136
|
-
}(Trend);
|
|
133
|
+
})(Trend);
|
|
137
134
|
_defineProperty(TrendLineRoot, "enhance", [resolveColorEnhance(), uniqueIDEnhancement()]);
|
|
138
135
|
_defineProperty(TrendLineRoot, "style", style);
|
|
139
136
|
_defineProperty(TrendLineRoot, "defaultProps", {
|