@semcore/mini-chart 0.29.4-prerelease.0 → 0.30.0-prerelease.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- 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/score/line.shadow.css +4 -4
- 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/score/line.shadow.css +4 -4
- 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/score/line.shadow.css +4 -4
- 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,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_776hj{0%,to{opacity:1}50%{opacity:.4}}@keyframes move-line_776hj{0%{transform:translateX(0)}to{transform:translateX(100%)}}.___SDonutContainer_776hj_gg_.__loading_776hj_gg_,.___SLineGauge_776hj_gg_.__loading_776hj_gg_,.___STrendBar_776hj_gg_.__loading_776hj_gg_,.___STrendLine_776hj_gg_.__loading_776hj_gg_{animation-name:pulse_776hj;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SLineGauge_776hj_gg_{height:8px;background-color:var(--base-bg-color_776hj, var(--intergalactic-chart-grid-bar-chart-base-bg, rgb(241, 242, 242)));border-radius:var(--intergalactic-chart-rounded, 2px);overflow:hidden;position:relative}.___SLineValue_776hj_gg_{height:8px;border-radius:var(--intergalactic-chart-rounded, 2px)0 0 var(--intergalactic-chart-rounded, 2px)}.___SLineValue_776hj_gg_.__percent_776hj_gg_{width:var(--percent_776hj)}.___SLineSegmentItem_776hj_gg_.__color_776hj_gg_,.___SLineValue_776hj_gg_.__color_776hj_gg_{background-color:var(--color_776hj, var(--intergalactic-chart-palette-order-1, rgb(104, 109, 210)))}.___SLineGauge_776hj_gg_.__segments_776hj_gg_{border-radius:var(--intergalactic-progress-bar-rounded, 6px)}.___SAnimationLine_776hj_gg_,.___SLineGaugeSegment_776hj_gg_{position:absolute;top:0;left:0;right:0;bottom:0}.___SLineSegmentItem_776hj_gg_:last-child{margin-right:0;border-right:none}.___SLineSegmentItem_776hj_gg_{height:8px;background:0 0;border-right-color:var(--intergalactic-chart-grid-border, #fff);border-right-style:solid;border-right-width:1px;box-sizing:content-box}.___SAnimationLine_776hj_gg_{background-color:var(--intergalactic-chart-grid-bar-chart-base-bg, rgb(241, 242, 242));transition:all var(--intergalactic-duration-extra-slow, 500) ease-in-out;animation-name:move-line_776hj;animation-duration:.5s;animation-timing-function:ease-in-out;animation-fill-mode:forwards}",
|
|
18
17
|
/*__inner_css_end__*/
|
|
19
|
-
"
|
|
18
|
+
"776hj_gg_"
|
|
20
19
|
), /*__reshadow_css_end__*/
|
|
21
20
|
{
|
|
22
|
-
"__SLineGauge": "
|
|
23
|
-
"_loading": "
|
|
24
|
-
"__SDonutContainer": "
|
|
25
|
-
"__STrendLine": "
|
|
26
|
-
"__STrendBar": "
|
|
27
|
-
"@pulse": "
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
21
|
+
"__SLineGauge": "___SLineGauge_776hj_gg_",
|
|
22
|
+
"_loading": "__loading_776hj_gg_",
|
|
23
|
+
"__SDonutContainer": "___SDonutContainer_776hj_gg_",
|
|
24
|
+
"__STrendLine": "___STrendLine_776hj_gg_",
|
|
25
|
+
"__STrendBar": "___STrendBar_776hj_gg_",
|
|
26
|
+
"@pulse": "pulse_776hj",
|
|
27
|
+
"__SLineValue": "___SLineValue_776hj_gg_",
|
|
28
|
+
"_percent": "__percent_776hj_gg_",
|
|
29
|
+
"--percent": "--percent_776hj",
|
|
30
|
+
"_color": "__color_776hj_gg_",
|
|
31
|
+
"__SLineSegmentItem": "___SLineSegmentItem_776hj_gg_",
|
|
32
|
+
"_segments": "__segments_776hj_gg_",
|
|
33
|
+
"__SLineGaugeSegment": "___SLineGaugeSegment_776hj_gg_",
|
|
34
|
+
"__SAnimationLine": "___SAnimationLine_776hj_gg_",
|
|
35
|
+
"@move-line": "move-line_776hj",
|
|
36
|
+
"--base-bg-color": "--base-bg-color_776hj",
|
|
37
|
+
"--color": "--color_776hj"
|
|
39
38
|
})
|
|
40
39
|
);
|
|
41
|
-
var LineRoot = /* @__PURE__ */ function(_Component) {
|
|
42
|
-
_inherits(LineRoot2, _Component);
|
|
43
|
-
var _super = _createSuper(LineRoot2);
|
|
40
|
+
var LineRoot = /* @__PURE__ */ (function(_Component) {
|
|
44
41
|
function LineRoot2() {
|
|
45
42
|
_classCallCheck(this, LineRoot2);
|
|
46
|
-
return
|
|
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,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
SLineGauge {
|
|
4
4
|
height: 8px;
|
|
5
|
-
background-color: var(--base-bg-color, var(--intergalactic-chart-grid-bar-chart-base-bg,
|
|
5
|
+
background-color: var(--base-bg-color, var(--intergalactic-chart-grid-bar-chart-base-bg, oklch(0.96 0.001 180)));
|
|
6
6
|
border-radius: var(--intergalactic-chart-rounded, 2px);
|
|
7
7
|
overflow: hidden;
|
|
8
8
|
position: relative;
|
|
@@ -18,7 +18,7 @@ SLineValue[percent] {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
SLineValue[color], SLineSegmentItem[color] {
|
|
21
|
-
background-color: var(--color, var(--intergalactic-chart-palette-order-1,
|
|
21
|
+
background-color: var(--color, var(--intergalactic-chart-palette-order-1, oklch(0.58 0.153 278.4)));
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
SLineGauge[segments] {
|
|
@@ -41,14 +41,14 @@ SLineSegmentItem:last-child {
|
|
|
41
41
|
SLineSegmentItem {
|
|
42
42
|
height: 8px;
|
|
43
43
|
background: transparent;
|
|
44
|
-
border-right-color: var(--intergalactic-chart-grid-border, #
|
|
44
|
+
border-right-color: var(--intergalactic-chart-grid-border, #fff);
|
|
45
45
|
border-right-style: solid;
|
|
46
46
|
border-right-width: 1px;
|
|
47
47
|
box-sizing: content-box;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
SAnimationLine {
|
|
51
|
-
background-color: var(--intergalactic-chart-grid-bar-chart-base-bg,
|
|
51
|
+
background-color: var(--intergalactic-chart-grid-bar-chart-base-bg, oklch(0.96 0.001 180));
|
|
52
52
|
transition: all var(--intergalactic-duration-extra-slow, 500) ease-in-out;
|
|
53
53
|
animation-name: move-line;
|
|
54
54
|
animation-duration: 0.5s;
|
|
@@ -2,42 +2,40 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
|
2
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
3
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
4
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
|
+
import _callSuper from "@babel/runtime/helpers/esm/callSuper";
|
|
5
6
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
-
import { sstyled } from "@semcore/
|
|
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", {
|
|
@@ -1,29 +1,27 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
import
|
|
3
|
+
import _callSuper from "@babel/runtime/helpers/esm/callSuper";
|
|
4
4
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
5
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
7
|
-
import React from "react";
|
|
8
6
|
import { Component } from "@semcore/core";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var _super = _createSuper(Trend2);
|
|
7
|
+
import React from "react";
|
|
8
|
+
var Trend = /* @__PURE__ */ (function(_Component) {
|
|
12
9
|
function Trend2() {
|
|
13
10
|
var _this;
|
|
14
11
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
15
12
|
args[_key] = arguments[_key];
|
|
16
13
|
}
|
|
17
14
|
_classCallCheck(this, Trend2);
|
|
18
|
-
_this =
|
|
19
|
-
_defineProperty(
|
|
15
|
+
_this = _callSuper(this, Trend2, [].concat(args));
|
|
16
|
+
_defineProperty(_this, "state", {
|
|
20
17
|
width: 200,
|
|
21
18
|
height: 100
|
|
22
19
|
});
|
|
23
|
-
_defineProperty(
|
|
20
|
+
_defineProperty(_this, "containerRef", /* @__PURE__ */ React.createRef());
|
|
24
21
|
return _this;
|
|
25
22
|
}
|
|
26
|
-
|
|
23
|
+
_inherits(Trend2, _Component);
|
|
24
|
+
return _createClass(Trend2, [{
|
|
27
25
|
key: "componentDidMount",
|
|
28
26
|
value: function componentDidMount() {
|
|
29
27
|
this.setSizes();
|
|
@@ -71,8 +69,7 @@ var Trend = /* @__PURE__ */ function(_Component) {
|
|
|
71
69
|
}
|
|
72
70
|
}
|
|
73
71
|
}]);
|
|
74
|
-
|
|
75
|
-
}(Component);
|
|
72
|
+
})(Component);
|
|
76
73
|
export {
|
|
77
74
|
Trend
|
|
78
75
|
};
|
package/lib/esm/index.mjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./component/score/index.mjs";
|
|
2
|
+
import "./component/trend/index.mjs";
|
|
2
3
|
import { ScoreLine } from "./component/score/Line.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
4
|
+
import { ScoreDonut, ScoreSemiDonut } from "./component/score/Donut.mjs";
|
|
5
|
+
import { TrendHistogram, TrendBar } from "./component/trend/Bar.mjs";
|
|
6
|
+
import { TrendArea, TrendLine } from "./component/trend/Line.mjs";
|
|
5
7
|
var miniCharts = {
|
|
6
8
|
TrendLine,
|
|
7
9
|
TrendArea,
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
+
var ScoreDonutUtils = /* @__PURE__ */ (function() {
|
|
5
|
+
function ScoreDonutUtils2(value, isSemiDonut) {
|
|
6
|
+
_classCallCheck(this, ScoreDonutUtils2);
|
|
7
|
+
_defineProperty(this, "isSemiDonut", void 0);
|
|
8
|
+
_defineProperty(this, "value", void 0);
|
|
9
|
+
_defineProperty(this, "radius", void 0);
|
|
10
|
+
this.isSemiDonut = isSemiDonut;
|
|
11
|
+
this.radius = isSemiDonut ? 9 : 10;
|
|
12
|
+
this.value = Math.max(Math.min(value, 100), 0);
|
|
13
|
+
}
|
|
14
|
+
return _createClass(ScoreDonutUtils2, [{
|
|
15
|
+
key: "viewBox",
|
|
16
|
+
get: function get() {
|
|
17
|
+
return this.isSemiDonut ? "0 0 24 12" : "0 0 24 24";
|
|
18
|
+
}
|
|
19
|
+
}, {
|
|
20
|
+
key: "strokeWidth",
|
|
21
|
+
get: function get() {
|
|
22
|
+
return this.isSemiDonut ? 6 : 4;
|
|
23
|
+
}
|
|
24
|
+
}, {
|
|
25
|
+
key: "fullLength",
|
|
26
|
+
get: function get() {
|
|
27
|
+
return this.isSemiDonut ? Math.PI * this.radius : 2 * Math.PI * this.radius;
|
|
28
|
+
}
|
|
29
|
+
}, {
|
|
30
|
+
key: "point",
|
|
31
|
+
get: function get() {
|
|
32
|
+
return this.isSemiDonut ? this.fullLength / (100 / 3) : this.fullLength / 100;
|
|
33
|
+
}
|
|
34
|
+
}, {
|
|
35
|
+
key: "valueLength",
|
|
36
|
+
get: function get() {
|
|
37
|
+
return this.fullLength * (this.value / 100);
|
|
38
|
+
}
|
|
39
|
+
}, {
|
|
40
|
+
key: "animatedValueLength",
|
|
41
|
+
get: function get() {
|
|
42
|
+
return Math.min(this.valueLength, this.fullLength - this.startMargin - this.endMargin);
|
|
43
|
+
}
|
|
44
|
+
}, {
|
|
45
|
+
key: "startMargin",
|
|
46
|
+
get: function get() {
|
|
47
|
+
var margin = 0;
|
|
48
|
+
if (this.value > 0) margin = this.point;
|
|
49
|
+
return margin;
|
|
50
|
+
}
|
|
51
|
+
}, {
|
|
52
|
+
key: "endMargin",
|
|
53
|
+
get: function get() {
|
|
54
|
+
var margin = 0;
|
|
55
|
+
if (!this.isSemiDonut && this.value > 0) margin = this.point;
|
|
56
|
+
return margin;
|
|
57
|
+
}
|
|
58
|
+
}, {
|
|
59
|
+
key: "baseOffset",
|
|
60
|
+
get: function get() {
|
|
61
|
+
return -1 * (this.valueLength + this.startMargin);
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
64
|
+
key: "baseLength",
|
|
65
|
+
get: function get() {
|
|
66
|
+
return Math.max(this.fullLength - this.valueLength - this.startMargin - this.endMargin, 0);
|
|
67
|
+
}
|
|
68
|
+
}, {
|
|
69
|
+
key: "animatedBaseLengthFrom",
|
|
70
|
+
get: function get() {
|
|
71
|
+
return this.fullLength - this.startMargin - this.endMargin;
|
|
72
|
+
}
|
|
73
|
+
}, {
|
|
74
|
+
key: "animatedBaseLengthTo",
|
|
75
|
+
get: function get() {
|
|
76
|
+
return this.fullLength - this.valueLength - this.startMargin - this.endMargin;
|
|
77
|
+
}
|
|
78
|
+
}]);
|
|
79
|
+
})();
|
|
80
|
+
export {
|
|
81
|
+
ScoreDonutUtils
|
|
82
|
+
};
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';
|
|
4
|
-
import { CommonScoreProps } from './Score';
|
|
1
|
+
import { type BoxProps } from '@semcore/base-components';
|
|
2
|
+
import type { CommonScoreProps } from './Score';
|
|
5
3
|
export type ScoreDonutProps = BoxProps & CommonScoreProps;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export {};
|
|
4
|
+
export declare const ScoreDonut: import("@semcore/core").Intergalactic.Component<"svg", ScoreDonutProps, {}, readonly [<T extends {}>(props: T) => T & {
|
|
5
|
+
duration: string;
|
|
6
|
+
}, (props: any) => any]>;
|
|
7
|
+
export declare const ScoreSemiDonut: import("@semcore/core").Intergalactic.Component<"svg", ScoreDonutProps, {}, readonly [<T extends {}>(props: T) => T & {
|
|
8
|
+
duration: string;
|
|
9
|
+
}, (props: any) => any]>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ScoreLineComponent } from './Line.types';
|
|
1
|
+
import type { ScoreLineComponent } from './Line.types';
|
|
2
2
|
export declare const ScoreLine: ScoreLineComponent;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import type { BoxProps, Box } from '@semcore/base-components';
|
|
2
|
+
import type { Intergalactic } from '@semcore/core';
|
|
3
|
+
import type resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';
|
|
4
|
+
import type React from 'react';
|
|
5
|
+
import type { CommonScoreProps } from './Score';
|
|
6
6
|
type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N ? Acc[number] : Enumerate<N, [...Acc, Acc['length']]>;
|
|
7
7
|
type Range<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;
|
|
8
8
|
export type SegmentColor = `chart-palette-order-${Range<1, 24>}`;
|
|
@@ -39,10 +39,12 @@ type CustomRenderScoreProps = {
|
|
|
39
39
|
children: SegmentComponent[];
|
|
40
40
|
};
|
|
41
41
|
export type ScoreLineGaugeProps = BoxProps & Intergalactic.InternalTypings.EfficientOmit<CommonScoreProps, 'value' | 'color'> & (ValuedScoreProps | CustomRenderScoreProps);
|
|
42
|
-
export type Enhances =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
export type Enhances = [
|
|
43
|
+
() => {
|
|
44
|
+
resolveColor: ReturnType<typeof resolveColorEnhance>;
|
|
45
|
+
}
|
|
46
|
+
];
|
|
47
|
+
export type ScoreLineComponent = Intergalactic.Component<'svg', ScoreLineGaugeProps, {}, Enhances> & {
|
|
46
48
|
Segment: Intergalactic.Component<typeof Box, SegmentProps>;
|
|
47
49
|
};
|
|
48
50
|
export {};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';
|
|
3
|
-
import { CommonTrendProps } from './Trend';
|
|
1
|
+
import { type CommonTrendProps } from './Trend';
|
|
4
2
|
type BarItem = {
|
|
5
3
|
/**
|
|
6
4
|
* Value
|
|
@@ -17,10 +15,6 @@ export type TrendBarProps = CommonTrendProps & {
|
|
|
17
15
|
*/
|
|
18
16
|
data: BarItem[];
|
|
19
17
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
isHistogram?: true;
|
|
23
|
-
};
|
|
24
|
-
export declare const TrendBar: ComponentType<TrendBarProps, {}, {}, Enhances>;
|
|
25
|
-
export declare const TrendHistogram: ComponentType<TrendBarProps, {}, {}, Enhances>;
|
|
18
|
+
export declare const TrendBar: import("@semcore/core").Intergalactic.Component<"svg", TrendBarProps, {}, readonly [(props: any) => any]>;
|
|
19
|
+
export declare const TrendHistogram: import("@semcore/core").Intergalactic.Component<"svg", TrendBarProps, {}, readonly [(props: any) => any]>;
|
|
26
20
|
export {};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';
|
|
3
|
-
import { CommonTrendProps } from './Trend';
|
|
1
|
+
import { type CommonTrendProps } from './Trend';
|
|
4
2
|
export type TrendLineProps = CommonTrendProps & {
|
|
5
3
|
/**
|
|
6
4
|
* List of values
|
|
@@ -19,11 +17,9 @@ export type TrendLineProps = CommonTrendProps & {
|
|
|
19
17
|
*/
|
|
20
18
|
lastPointRadius?: number;
|
|
21
19
|
};
|
|
22
|
-
|
|
23
|
-
uid:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export declare const TrendArea: ComponentType<TrendLineProps, {}, {}, Enhances>;
|
|
29
|
-
export {};
|
|
20
|
+
export declare const TrendLine: import("@semcore/core").Intergalactic.Component<"svg", TrendLineProps, {}, readonly [(props: any) => any, (props: any) => {
|
|
21
|
+
uid: ReturnType<typeof import("@semcore/core/lib/utils/uniqueID").useUID>;
|
|
22
|
+
}]>;
|
|
23
|
+
export declare const TrendArea: import("@semcore/core").Intergalactic.Component<"svg", TrendLineProps, {}, readonly [(props: any) => any, (props: any) => {
|
|
24
|
+
uid: ReturnType<typeof import("@semcore/core/lib/utils/uniqueID").useUID>;
|
|
25
|
+
}]>;
|