@semcore/mini-chart 16.0.0-prerelease.2 → 16.0.0-prerelease.21
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/CHANGELOG.md +19 -1
- package/lib/cjs/component/score/Donut.js +4 -2
- package/lib/cjs/component/score/Donut.js.map +1 -1
- package/lib/cjs/component/score/Line.js +4 -2
- package/lib/cjs/component/score/Line.js.map +1 -1
- package/lib/cjs/component/trend/Bar.js +4 -2
- package/lib/cjs/component/trend/Bar.js.map +1 -1
- package/lib/cjs/component/trend/Line.js +4 -2
- package/lib/cjs/component/trend/Line.js.map +1 -1
- package/lib/es6/component/score/Donut.js +4 -2
- package/lib/es6/component/score/Donut.js.map +1 -1
- package/lib/es6/component/score/Line.js +4 -2
- package/lib/es6/component/score/Line.js.map +1 -1
- package/lib/es6/component/trend/Bar.js +4 -2
- package/lib/es6/component/trend/Bar.js.map +1 -1
- package/lib/es6/component/trend/Line.js +4 -2
- package/lib/es6/component/trend/Line.js.map +1 -1
- package/lib/esm/component/score/Donut.mjs +102 -82
- package/lib/esm/component/score/Line.mjs +99 -76
- package/lib/esm/component/score/donut.shadow.css +17 -0
- package/lib/esm/component/score/line.shadow.css +62 -0
- package/lib/esm/component/skeleton/skeleton.shadow.css +24 -0
- package/lib/esm/component/trend/Bar.mjs +83 -67
- package/lib/esm/component/trend/Line.mjs +117 -98
- package/lib/esm/component/trend/Trend.mjs +47 -35
- package/lib/esm/index.mjs +13 -13
- package/package.json +3 -3
|
@@ -1,102 +1,122 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { sstyled
|
|
8
|
-
import
|
|
9
|
-
import { Box
|
|
10
|
-
import
|
|
11
|
-
import { extractAriaProps
|
|
12
|
-
|
|
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 _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
7
|
+
import { sstyled, createComponent, assignProps, Component } from "@semcore/core";
|
|
8
|
+
import React from "react";
|
|
9
|
+
import { Box } from "@semcore/flex-box";
|
|
10
|
+
import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
|
|
11
|
+
import { extractAriaProps } from "@semcore/core/lib/utils/ariaProps";
|
|
12
|
+
/*!__reshadow-styles__:"./donut.shadow.css"*/
|
|
13
|
+
var style = (
|
|
13
14
|
/*__reshadow_css_start__*/
|
|
14
|
-
(
|
|
15
|
+
(sstyled.insert(
|
|
15
16
|
/*__inner_css_start__*/
|
|
16
17
|
"@keyframes pulse_1cm94{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_1cm94_gg_.__loading_1cm94_gg_,.___SLineGauge_1cm94_gg_.__loading_1cm94_gg_,.___STrendBar_1cm94_gg_.__loading_1cm94_gg_,.___STrendLine_1cm94_gg_.__loading_1cm94_gg_{animation-name:pulse_1cm94;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SDonutContainer_1cm94_gg_.__semi_1cm94_gg_ g{transform:rotate(180deg) translate(-24px,-24px)}.___SDonutContainer_1cm94_gg_ g{transform:rotate(-90deg) translate(-24px)}.___SDonutContainer_1cm94_gg_.__animate_1cm94_gg_ circle{transition:all var(--intergalactic-duration-extra-slow, 500) ease-in-out}",
|
|
18
|
+
/*__inner_css_end__*/
|
|
17
19
|
"1cm94_gg_"
|
|
18
|
-
),
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
), /*__reshadow_css_end__*/
|
|
21
|
+
{
|
|
22
|
+
"__SLineGauge": "___SLineGauge_1cm94_gg_",
|
|
23
|
+
"_loading": "__loading_1cm94_gg_",
|
|
24
|
+
"__SDonutContainer": "___SDonutContainer_1cm94_gg_",
|
|
25
|
+
"__STrendLine": "___STrendLine_1cm94_gg_",
|
|
26
|
+
"__STrendBar": "___STrendBar_1cm94_gg_",
|
|
24
27
|
"@pulse": "pulse_1cm94",
|
|
25
|
-
_animate: "__animate_1cm94_gg_",
|
|
26
|
-
_semi: "__semi_1cm94_gg_"
|
|
28
|
+
"_animate": "__animate_1cm94_gg_",
|
|
29
|
+
"_semi": "__semi_1cm94_gg_"
|
|
27
30
|
})
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
);
|
|
32
|
+
var DonutRoot = /* @__PURE__ */ function(_Component) {
|
|
33
|
+
_inherits(DonutRoot2, _Component);
|
|
34
|
+
var _super = _createSuper(DonutRoot2);
|
|
35
|
+
function DonutRoot2() {
|
|
36
|
+
_classCallCheck(this, DonutRoot2);
|
|
37
|
+
return _super.apply(this, arguments);
|
|
33
38
|
}
|
|
34
|
-
|
|
39
|
+
_createClass(DonutRoot2, [{
|
|
35
40
|
key: "render",
|
|
36
|
-
value: function() {
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
var $ =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
})),
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
41
|
+
value: function render() {
|
|
42
|
+
var _ref = this.asProps, _ref2;
|
|
43
|
+
var SDonutContainer = Box;
|
|
44
|
+
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;
|
|
45
|
+
var strokeWidth = isSemiDonut ? 6 : 4;
|
|
46
|
+
var radius = isSemiDonut ? 9 : 10;
|
|
47
|
+
var baseStrokeDasharray = isSemiDonut ? Math.PI * radius : Math.PI * 2 * radius;
|
|
48
|
+
var valueStrokeDasharray = baseStrokeDasharray * (value / 100);
|
|
49
|
+
var greyStrokeDasharray = baseStrokeDasharray * ((100 - value) / 100);
|
|
50
|
+
var offsetPoint = isSemiDonut ? baseStrokeDasharray / (100 / 3) : baseStrokeDasharray / 100;
|
|
51
|
+
var strokeDasharrayBetweenSpaces = "".concat(greyStrokeDasharray - 2 * offsetPoint, " ").concat(offsetPoint);
|
|
52
|
+
var spaceStrokeDasharray = "".concat(offsetPoint, " ").concat(value < 99 ? "".concat(strokeDasharrayBetweenSpaces) : "", " ").concat(baseStrokeDasharray);
|
|
53
|
+
if (isSemiDonut) {
|
|
54
|
+
spaceStrokeDasharray = "".concat(offsetPoint, " ").concat(value < 95 ? "".concat(strokeDasharrayBetweenSpaces) : "", " ").concat(baseStrokeDasharray);
|
|
55
|
+
}
|
|
56
|
+
var viewBox = isSemiDonut ? "0 0 24 12" : "0 0 24 24";
|
|
57
|
+
var strokeDashoffsetBase = -1 * (valueStrokeDasharray + (isSemiDonut ? offsetPoint : 0));
|
|
58
|
+
var _extractAriaProps = extractAriaProps(this.asProps), __excludeProps = _extractAriaProps.__excludeProps, extractedAriaProps = _extractAriaProps.extractedAriaProps;
|
|
59
|
+
return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(SDonutContainer, _ref2.cn("SDonutContainer", _objectSpread({}, assignProps({
|
|
60
|
+
"semi": isSemiDonut,
|
|
61
|
+
"__excludeProps": __excludeProps
|
|
62
|
+
}, _ref))), /* @__PURE__ */ React.createElement("svg", _ref2.cn("svg", _objectSpread({
|
|
63
|
+
"width": "100%",
|
|
64
|
+
"height": "100%",
|
|
65
|
+
"viewBox": viewBox,
|
|
66
|
+
"fill": "none",
|
|
67
|
+
"role": "img"
|
|
68
|
+
}, extractedAriaProps)), /* @__PURE__ */ React.createElement("g", _ref2.cn("g", {}), /* @__PURE__ */ React.createElement("circle", _ref2.cn("circle", {
|
|
69
|
+
"cx": "12",
|
|
70
|
+
"cy": "12",
|
|
71
|
+
"r": radius,
|
|
72
|
+
"strokeWidth": strokeWidth,
|
|
73
|
+
"stroke": resolveColor(baseBgColor),
|
|
74
|
+
"strokeDasharray": loading ? void 0 : "".concat(greyStrokeDasharray, " ").concat(baseStrokeDasharray),
|
|
75
|
+
"strokeDashoffset": strokeDashoffsetBase
|
|
76
|
+
})), !loading && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("circle", _ref2.cn("circle", {
|
|
77
|
+
"cx": "12",
|
|
78
|
+
"cy": "12",
|
|
79
|
+
"r": radius,
|
|
80
|
+
"strokeWidth": strokeWidth,
|
|
81
|
+
"stroke": resolveColor(color),
|
|
82
|
+
"strokeDasharray": "".concat(valueStrokeDasharray, " ").concat(baseStrokeDasharray),
|
|
83
|
+
"strokeDashoffset": valueStrokeDasharray
|
|
84
|
+
}), /* @__PURE__ */ React.createElement("animate", _ref2.cn("animate", {
|
|
85
|
+
"attributeName": "stroke-dashoffset",
|
|
86
|
+
"values": "0;".concat(valueStrokeDasharray)
|
|
87
|
+
}))), value !== 100 && !isSemiDonut && /* @__PURE__ */ React.createElement("circle", _ref2.cn("circle", {
|
|
88
|
+
"cx": "12",
|
|
89
|
+
"cy": "12",
|
|
90
|
+
"r": radius,
|
|
91
|
+
"strokeWidth": strokeWidth,
|
|
92
|
+
"stroke": resolveColor("chart-grid-border"),
|
|
93
|
+
"strokeDasharray": spaceStrokeDasharray,
|
|
94
|
+
"strokeDashoffset": -1 * valueStrokeDasharray
|
|
76
95
|
}))))));
|
|
77
96
|
}
|
|
78
|
-
}])
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
97
|
+
}]);
|
|
98
|
+
return DonutRoot2;
|
|
99
|
+
}(Component);
|
|
100
|
+
_defineProperty(DonutRoot, "enhance", [resolveColorEnhance()]);
|
|
101
|
+
_defineProperty(DonutRoot, "style", style);
|
|
102
|
+
_defineProperty(DonutRoot, "defaultProps", {
|
|
103
|
+
animate: true
|
|
84
104
|
});
|
|
85
|
-
var
|
|
86
|
-
|
|
87
|
-
var
|
|
105
|
+
var ScoreDonut = createComponent(DonutRoot);
|
|
106
|
+
ScoreDonut.displayName = "MiniChart.ScoreDonut";
|
|
107
|
+
var ScoreSemiDonut = createComponent(DonutRoot, {}, {
|
|
88
108
|
enhancements: [function() {
|
|
89
109
|
return {
|
|
90
|
-
wrapperProps: function(
|
|
91
|
-
return
|
|
92
|
-
isSemiDonut:
|
|
110
|
+
wrapperProps: function wrapperProps(props) {
|
|
111
|
+
return assignProps(props, {
|
|
112
|
+
isSemiDonut: true
|
|
93
113
|
});
|
|
94
114
|
}
|
|
95
115
|
};
|
|
96
116
|
}]
|
|
97
117
|
});
|
|
98
|
-
|
|
118
|
+
ScoreSemiDonut.displayName = "MiniChart.ScoreSemiDonut";
|
|
99
119
|
export {
|
|
100
|
-
|
|
101
|
-
|
|
120
|
+
ScoreDonut,
|
|
121
|
+
ScoreSemiDonut
|
|
102
122
|
};
|
|
@@ -1,103 +1,126 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { sstyled
|
|
8
|
-
import
|
|
9
|
-
import { Box
|
|
10
|
-
import
|
|
11
|
-
|
|
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 _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
7
|
+
import { sstyled, createComponent, assignProps, Component } from "@semcore/core";
|
|
8
|
+
import React from "react";
|
|
9
|
+
import { Box, Flex } from "@semcore/flex-box";
|
|
10
|
+
import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
|
|
11
|
+
/*!__reshadow-styles__:"./line.shadow.css"*/
|
|
12
|
+
var style = (
|
|
12
13
|
/*__reshadow_css_start__*/
|
|
13
|
-
(
|
|
14
|
+
(sstyled.insert(
|
|
14
15
|
/*__inner_css_start__*/
|
|
15
16
|
"@keyframes pulse_2vm7d{0%,to{opacity:1}50%{opacity:.4}}@keyframes move-line_2vm7d{0%{transform:translateX(0)}to{transform:translateX(100%)}}.___SDonutContainer_2vm7d_gg_.__loading_2vm7d_gg_,.___SLineGauge_2vm7d_gg_.__loading_2vm7d_gg_,.___STrendBar_2vm7d_gg_.__loading_2vm7d_gg_,.___STrendLine_2vm7d_gg_.__loading_2vm7d_gg_{animation-name:pulse_2vm7d;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SLineGauge_2vm7d_gg_{height:8px;background-color:var(--base-bg-color_2vm7d, var(--intergalactic-chart-grid-bar-chart-base-bg, #e0e1e9));border-radius:var(--intergalactic-chart-rounded, 2px);overflow:hidden;position:relative}.___SLineValue_2vm7d_gg_{height:8px;border-radius:var(--intergalactic-chart-rounded, 2px)0 0 var(--intergalactic-chart-rounded, 2px)}.___SLineValue_2vm7d_gg_.__percent_2vm7d_gg_{width:var(--percent_2vm7d)}.___SLineSegmentItem_2vm7d_gg_.__color_2vm7d_gg_,.___SLineValue_2vm7d_gg_.__color_2vm7d_gg_{background-color:var(--color_2vm7d, var(--intergalactic-chart-palette-order-1, #2bb3ff))}.___SLineGauge_2vm7d_gg_.__segments_2vm7d_gg_{border-radius:var(--intergalactic-progress-bar-rounded, 6px)}.___SAnimationLine_2vm7d_gg_,.___SLineGaugeSegment_2vm7d_gg_{position:absolute;top:0;left:0;right:0;bottom:0}.___SLineSegmentItem_2vm7d_gg_:last-child{margin-right:0;border-right:none}.___SLineSegmentItem_2vm7d_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_2vm7d_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_2vm7d;animation-duration:.5s;animation-timing-function:ease-in-out;animation-fill-mode:forwards}",
|
|
17
|
+
/*__inner_css_end__*/
|
|
16
18
|
"2vm7d_gg_"
|
|
17
|
-
),
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
), /*__reshadow_css_end__*/
|
|
20
|
+
{
|
|
21
|
+
"__SLineGauge": "___SLineGauge_2vm7d_gg_",
|
|
22
|
+
"_loading": "__loading_2vm7d_gg_",
|
|
23
|
+
"__SDonutContainer": "___SDonutContainer_2vm7d_gg_",
|
|
24
|
+
"__STrendLine": "___STrendLine_2vm7d_gg_",
|
|
25
|
+
"__STrendBar": "___STrendBar_2vm7d_gg_",
|
|
23
26
|
"@pulse": "pulse_2vm7d",
|
|
24
27
|
"--base-bg-color": "--base-bg-color_2vm7d",
|
|
25
|
-
__SLineValue: "___SLineValue_2vm7d_gg_",
|
|
26
|
-
_percent: "__percent_2vm7d_gg_",
|
|
28
|
+
"__SLineValue": "___SLineValue_2vm7d_gg_",
|
|
29
|
+
"_percent": "__percent_2vm7d_gg_",
|
|
27
30
|
"--percent": "--percent_2vm7d",
|
|
28
|
-
_color: "__color_2vm7d_gg_",
|
|
29
|
-
__SLineSegmentItem: "___SLineSegmentItem_2vm7d_gg_",
|
|
31
|
+
"_color": "__color_2vm7d_gg_",
|
|
32
|
+
"__SLineSegmentItem": "___SLineSegmentItem_2vm7d_gg_",
|
|
30
33
|
"--color": "--color_2vm7d",
|
|
31
|
-
_segments: "__segments_2vm7d_gg_",
|
|
32
|
-
__SLineGaugeSegment: "___SLineGaugeSegment_2vm7d_gg_",
|
|
33
|
-
__SAnimationLine: "___SAnimationLine_2vm7d_gg_",
|
|
34
|
+
"_segments": "__segments_2vm7d_gg_",
|
|
35
|
+
"__SLineGaugeSegment": "___SLineGaugeSegment_2vm7d_gg_",
|
|
36
|
+
"__SAnimationLine": "___SAnimationLine_2vm7d_gg_",
|
|
34
37
|
"@move-line": "move-line_2vm7d"
|
|
35
38
|
})
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
);
|
|
40
|
+
var LineRoot = /* @__PURE__ */ function(_Component) {
|
|
41
|
+
_inherits(LineRoot2, _Component);
|
|
42
|
+
var _super = _createSuper(LineRoot2);
|
|
43
|
+
function LineRoot2() {
|
|
44
|
+
_classCallCheck(this, LineRoot2);
|
|
45
|
+
return _super.apply(this, arguments);
|
|
41
46
|
}
|
|
42
|
-
|
|
47
|
+
_createClass(LineRoot2, [{
|
|
43
48
|
key: "getSegmentProps",
|
|
44
|
-
value: function(
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
value: function getSegmentProps(segmentProps) {
|
|
50
|
+
var _this$asProps = this.asProps, children = _this$asProps.children, resolveColor = _this$asProps.resolveColor;
|
|
51
|
+
var sum = 0;
|
|
52
|
+
React.Children.forEach(children, function(child) {
|
|
53
|
+
if (/* @__PURE__ */ React.isValidElement(child)) {
|
|
54
|
+
sum = sum + child.props.value;
|
|
55
|
+
}
|
|
48
56
|
});
|
|
49
|
-
var
|
|
57
|
+
var width = sum > 0 ? 100 * segmentProps.value / sum : 0;
|
|
50
58
|
return {
|
|
51
|
-
w: "".concat(
|
|
52
|
-
"use:color":
|
|
59
|
+
w: "".concat(width, "%"),
|
|
60
|
+
"use:color": resolveColor(segmentProps.color)
|
|
53
61
|
};
|
|
54
62
|
}
|
|
55
63
|
}, {
|
|
56
64
|
key: "render",
|
|
57
|
-
value: function() {
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
value: function render() {
|
|
66
|
+
var _ref = this.asProps, _ref5;
|
|
67
|
+
var SLineGauge = Box;
|
|
68
|
+
var SLineValue = Box;
|
|
69
|
+
var SAnimationLine = Box;
|
|
70
|
+
var SLineGaugeSegment = Flex;
|
|
71
|
+
var SLineSegmentItem = Box;
|
|
72
|
+
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;
|
|
73
|
+
if (children !== void 0) {
|
|
74
|
+
var _ref3;
|
|
75
|
+
return _ref3 = sstyled(styles), /* @__PURE__ */ React.createElement(SLineGauge, _ref3.cn("SLineGauge", _objectSpread({}, assignProps({
|
|
76
|
+
"segments": true,
|
|
77
|
+
"base-bg-color": resolveColor(baseBgColor)
|
|
78
|
+
}, _ref))), /* @__PURE__ */ React.createElement(SLineGaugeSegment, _ref3.cn("SLineGaugeSegment", {}), /* @__PURE__ */ React.createElement(Children, _ref3.cn("Children", {}))), animate && /* @__PURE__ */ React.createElement(SAnimationLine, _ref3.cn("SAnimationLine", {})));
|
|
65
79
|
}
|
|
66
|
-
var
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
80
|
+
var segments = this.asProps.segments;
|
|
81
|
+
var SegmentItems = [];
|
|
82
|
+
if (segments) {
|
|
83
|
+
for (var i = 0; i < segments; i++) {
|
|
84
|
+
var _ref4;
|
|
85
|
+
var width = "calc((100% - ".concat(segments - 1, "px) / ").concat(segments, ")");
|
|
86
|
+
SegmentItems.push((_ref4 = sstyled(styles), /* @__PURE__ */ React.createElement(SLineSegmentItem, _ref4.cn("SLineSegmentItem", {
|
|
87
|
+
"key": i,
|
|
88
|
+
"color": i < value ? resolveColor(color) : void 0,
|
|
89
|
+
"w": width
|
|
74
90
|
}))));
|
|
75
91
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
92
|
+
}
|
|
93
|
+
var percent = "".concat(value, "%");
|
|
94
|
+
if (segments) {
|
|
95
|
+
percent = "".concat(value / segments * 100, "%");
|
|
96
|
+
}
|
|
97
|
+
return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(SLineGauge, _ref5.cn("SLineGauge", _objectSpread({}, assignProps({
|
|
98
|
+
"base-bg-color": resolveColor(baseBgColor)
|
|
99
|
+
}, _ref))), !loading && /* @__PURE__ */ React.createElement(SLineValue, _ref5.cn("SLineValue", {
|
|
100
|
+
"w": percent,
|
|
101
|
+
"color": resolveColor(color)
|
|
102
|
+
})), Boolean(SegmentItems.length) && /* @__PURE__ */ React.createElement(SLineGaugeSegment, _ref5.cn("SLineGaugeSegment", {}), SegmentItems), animate && /* @__PURE__ */ React.createElement(SAnimationLine, _ref5.cn("SAnimationLine", {})));
|
|
83
103
|
}
|
|
84
|
-
}])
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
104
|
+
}]);
|
|
105
|
+
return LineRoot2;
|
|
106
|
+
}(Component);
|
|
107
|
+
_defineProperty(LineRoot, "enhance", [resolveColorEnhance()]);
|
|
108
|
+
_defineProperty(LineRoot, "displayName", "ScoreLine");
|
|
109
|
+
_defineProperty(LineRoot, "style", style);
|
|
110
|
+
_defineProperty(LineRoot, "defaultProps", {
|
|
111
|
+
animate: true
|
|
91
112
|
});
|
|
92
|
-
function
|
|
93
|
-
var
|
|
94
|
-
|
|
113
|
+
function Segment(props) {
|
|
114
|
+
var _ref2 = arguments[0], _ref6;
|
|
115
|
+
var styles = props.styles;
|
|
116
|
+
var SLineSegmentItem = Box;
|
|
117
|
+
return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SLineSegmentItem, _ref6.cn("SLineSegmentItem", _objectSpread({}, assignProps({}, _ref2))));
|
|
95
118
|
}
|
|
96
|
-
|
|
97
|
-
var
|
|
98
|
-
Segment
|
|
119
|
+
Segment.displayName = "Segment";
|
|
120
|
+
var ScoreLine = createComponent(LineRoot, {
|
|
121
|
+
Segment
|
|
99
122
|
});
|
|
100
|
-
|
|
123
|
+
ScoreLine.displayName = "MiniChart.ScoreLine";
|
|
101
124
|
export {
|
|
102
|
-
|
|
125
|
+
ScoreLine
|
|
103
126
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@import '../skeleton/skeleton.shadow.css';
|
|
2
|
+
|
|
3
|
+
SDonutContainer[semi] {
|
|
4
|
+
g {
|
|
5
|
+
transform: rotate(180deg) translate(-24px, -24px);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
SDonutContainer {
|
|
10
|
+
g {
|
|
11
|
+
transform: rotate(-90deg) translate(-24px)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
SDonutContainer[animate] circle {
|
|
16
|
+
transition: all var(--intergalactic-duration-extra-slow, 500) ease-in-out;
|
|
17
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
@import '../skeleton/skeleton.shadow.css';
|
|
2
|
+
|
|
3
|
+
SLineGauge {
|
|
4
|
+
height: 8px;
|
|
5
|
+
background-color: var(--base-bg-color, var(--intergalactic-chart-grid-bar-chart-base-bg, #e0e1e9));
|
|
6
|
+
border-radius: var(--intergalactic-chart-rounded, 2px);
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
position: relative;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
SLineValue {
|
|
12
|
+
height: 8px;
|
|
13
|
+
border-radius: var(--intergalactic-chart-rounded, 2px) 0 0 var(--intergalactic-chart-rounded, 2px);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
SLineValue[percent] {
|
|
17
|
+
width: var(--percent);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
SLineValue[color], SLineSegmentItem[color] {
|
|
21
|
+
background-color: var(--color, var(--intergalactic-chart-palette-order-1, #2bb3ff));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
SLineGauge[segments] {
|
|
25
|
+
border-radius: var(--intergalactic-progress-bar-rounded, 6px);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
SLineGaugeSegment, SAnimationLine {
|
|
29
|
+
position: absolute;
|
|
30
|
+
top: 0;
|
|
31
|
+
left: 0;
|
|
32
|
+
right: 0;
|
|
33
|
+
bottom: 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
SLineSegmentItem:last-child {
|
|
37
|
+
margin-right: 0;
|
|
38
|
+
border-right: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
SLineSegmentItem {
|
|
42
|
+
height: 8px;
|
|
43
|
+
background: transparent;
|
|
44
|
+
border-right-color: var(--intergalactic-chart-grid-border, #ffffff);
|
|
45
|
+
border-right-style: solid;
|
|
46
|
+
border-right-width: 1px;
|
|
47
|
+
box-sizing: content-box;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
SAnimationLine {
|
|
51
|
+
background-color: var(--intergalactic-chart-grid-bar-chart-base-bg, #e0e1e9);
|
|
52
|
+
transition: all var(--intergalactic-duration-extra-slow, 500) ease-in-out;
|
|
53
|
+
animation-name: move-line;
|
|
54
|
+
animation-duration: 0.5s;
|
|
55
|
+
animation-timing-function: ease-in-out;
|
|
56
|
+
animation-fill-mode: forwards;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@keyframes move-line {
|
|
60
|
+
0% {transform: translateX(0);}
|
|
61
|
+
100% {transform: translateX(100%);}
|
|
62
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
SLineGauge[loading],
|
|
2
|
+
SDonutContainer[loading],
|
|
3
|
+
STrendLine[loading],
|
|
4
|
+
STrendBar[loading] {
|
|
5
|
+
animation-name: pulse;
|
|
6
|
+
animation-iteration-count: infinite;
|
|
7
|
+
animation-timing-function: ease-in-out;
|
|
8
|
+
animation-duration: 1.6s;
|
|
9
|
+
will-change: opacity;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@keyframes pulse {
|
|
13
|
+
0% {
|
|
14
|
+
opacity: 1;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
50% {
|
|
18
|
+
opacity: 0.4;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
100% {
|
|
22
|
+
opacity: 1;
|
|
23
|
+
}
|
|
24
|
+
}
|