@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.
@@ -1,102 +1,122 @@
1
- import C from "@babel/runtime/helpers/esm/objectSpread2";
2
- import G from "@babel/runtime/helpers/esm/classCallCheck";
3
- import N from "@babel/runtime/helpers/esm/createClass";
4
- import R from "@babel/runtime/helpers/esm/inherits";
5
- import I from "@babel/runtime/helpers/esm/createSuper";
6
- import p from "@babel/runtime/helpers/esm/defineProperty";
7
- import { sstyled as P, createComponent as x, assignProps as B, Component as j } from "@semcore/core";
8
- import r from "react";
9
- import { Box as F } from "@semcore/flex-box";
10
- import q from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
11
- import { extractAriaProps as z } from "@semcore/core/lib/utils/ariaProps";
12
- var H = (
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
- (P.insert(
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
- __SLineGauge: "___SLineGauge_1cm94_gg_",
20
- _loading: "__loading_1cm94_gg_",
21
- __SDonutContainer: "___SDonutContainer_1cm94_gg_",
22
- __STrendLine: "___STrendLine_1cm94_gg_",
23
- __STrendBar: "___STrendBar_1cm94_gg_",
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
- ), m = /* @__PURE__ */ function(d) {
29
- R(n, d);
30
- var g = I(n);
31
- function n() {
32
- return G(this, n), g.apply(this, arguments);
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
- return N(n, [{
39
+ _createClass(DonutRoot2, [{
35
40
  key: "render",
36
- value: function() {
37
- var b = this.asProps, t, E = F, o = this.asProps, _ = o.value, w = o.styles, h = o.baseBgColor, L = h === void 0 ? "chart-grid-bar-chart-base-bg" : h, f = o.color, T = f === void 0 ? "chart-palette-order-1" : f, l = o.resolveColor, e = o.isSemiDonut, v = o.loading, u = e ? 6 : 4, i = e ? 9 : 10, a = e ? Math.PI * i : Math.PI * 2 * i, c = a * (_ / 100), S = a * ((100 - _) / 100), s = e ? a / (100 / 3) : a / 100, D = "".concat(S - 2 * s, " ").concat(s), y = "".concat(s, " ").concat(_ < 99 ? "".concat(D) : "", " ").concat(a);
38
- e && (y = "".concat(s, " ").concat(_ < 95 ? "".concat(D) : "", " ").concat(a));
39
- var $ = e ? "0 0 24 12" : "0 0 24 24", A = -1 * (c + (e ? s : 0)), k = z(this.asProps), M = k.__excludeProps, W = k.extractedAriaProps;
40
- return t = P(w), /* @__PURE__ */ r.createElement(E, t.cn("SDonutContainer", C({}, B({
41
- semi: e,
42
- __excludeProps: M
43
- }, b))), /* @__PURE__ */ r.createElement("svg", t.cn("svg", C({
44
- width: "100%",
45
- height: "100%",
46
- viewBox: $,
47
- fill: "none",
48
- role: "img"
49
- }, W)), /* @__PURE__ */ r.createElement("g", t.cn("g", {}), /* @__PURE__ */ r.createElement("circle", t.cn("circle", {
50
- cx: "12",
51
- cy: "12",
52
- r: i,
53
- strokeWidth: u,
54
- stroke: l(L),
55
- strokeDasharray: v ? void 0 : "".concat(S, " ").concat(a),
56
- strokeDashoffset: A
57
- })), !v && /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("circle", t.cn("circle", {
58
- cx: "12",
59
- cy: "12",
60
- r: i,
61
- strokeWidth: u,
62
- stroke: l(T),
63
- strokeDasharray: "".concat(c, " ").concat(a),
64
- strokeDashoffset: c
65
- }), /* @__PURE__ */ r.createElement("animate", t.cn("animate", {
66
- attributeName: "stroke-dashoffset",
67
- values: "0;".concat(c)
68
- }))), _ !== 100 && !e && /* @__PURE__ */ r.createElement("circle", t.cn("circle", {
69
- cx: "12",
70
- cy: "12",
71
- r: i,
72
- strokeWidth: u,
73
- stroke: l("chart-grid-border"),
74
- strokeDasharray: y,
75
- strokeDashoffset: -1 * c
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
- }]), n;
79
- }(j);
80
- p(m, "enhance", [q()]);
81
- p(m, "style", H);
82
- p(m, "defaultProps", {
83
- animate: !0
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 J = x(m);
86
- J.displayName = "MiniChart.ScoreDonut";
87
- var K = x(m, {}, {
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(g) {
91
- return B(g, {
92
- isSemiDonut: !0
110
+ wrapperProps: function wrapperProps(props) {
111
+ return assignProps(props, {
112
+ isSemiDonut: true
93
113
  });
94
114
  }
95
115
  };
96
116
  }]
97
117
  });
98
- K.displayName = "MiniChart.ScoreSemiDonut";
118
+ ScoreSemiDonut.displayName = "MiniChart.ScoreSemiDonut";
99
119
  export {
100
- J as ScoreDonut,
101
- K as ScoreSemiDonut
120
+ ScoreDonut,
121
+ ScoreSemiDonut
102
122
  };
@@ -1,103 +1,126 @@
1
- import x from "@babel/runtime/helpers/esm/objectSpread2";
2
- import N from "@babel/runtime/helpers/esm/classCallCheck";
3
- import R from "@babel/runtime/helpers/esm/createClass";
4
- import X from "@babel/runtime/helpers/esm/inherits";
5
- import j from "@babel/runtime/helpers/esm/createSuper";
6
- import S from "@babel/runtime/helpers/esm/defineProperty";
7
- import { sstyled as m, createComponent as z, assignProps as G, Component as F } from "@semcore/core";
8
- import e from "react";
9
- import { Box as g, Flex as M } from "@semcore/flex-box";
10
- import q from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
11
- var H = (
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
- (m.insert(
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
- __SLineGauge: "___SLineGauge_2vm7d_gg_",
19
- _loading: "__loading_2vm7d_gg_",
20
- __SDonutContainer: "___SDonutContainer_2vm7d_gg_",
21
- __STrendLine: "___STrendLine_2vm7d_gg_",
22
- __STrendBar: "___STrendBar_2vm7d_gg_",
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
- ), l = /* @__PURE__ */ function(p) {
37
- X(r, p);
38
- var h = j(r);
39
- function r() {
40
- return N(this, r), h.apply(this, arguments);
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
- return R(r, [{
47
+ _createClass(LineRoot2, [{
43
48
  key: "getSegmentProps",
44
- value: function(t) {
45
- var _ = this.asProps, c = _.children, f = _.resolveColor, a = 0;
46
- e.Children.forEach(c, function(s) {
47
- /* @__PURE__ */ e.isValidElement(s) && (a = a + s.props.value);
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 d = a > 0 ? 100 * t.value / a : 0;
57
+ var width = sum > 0 ? 100 * segmentProps.value / sum : 0;
50
58
  return {
51
- w: "".concat(d, "%"),
52
- "use:color": f(t.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 t = this.asProps, _, c = g, f = g, a = g, d = M, s = g, n = this.asProps, b = n.value, y = n.styles, E = n.color, P = E === void 0 ? "chart-palette-order-1" : E, k = n.baseBgColor, v = n.resolveColor, B = n.loading, T = n.children, $ = n.Children, w = n.animate;
59
- if (T !== void 0) {
60
- var i;
61
- return i = m(y), /* @__PURE__ */ e.createElement(c, i.cn("SLineGauge", x({}, G({
62
- segments: !0,
63
- "base-bg-color": v(k)
64
- }, t))), /* @__PURE__ */ e.createElement(d, i.cn("SLineGaugeSegment", {}), /* @__PURE__ */ e.createElement($, i.cn("Children", {}))), w && /* @__PURE__ */ e.createElement(a, i.cn("SAnimationLine", {})));
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 o = this.asProps.segments, C = [];
67
- if (o)
68
- for (var u = 0; u < o; u++) {
69
- var I, D = "calc((100% - ".concat(o - 1, "px) / ").concat(o, ")");
70
- C.push((I = m(y), /* @__PURE__ */ e.createElement(s, I.cn("SLineSegmentItem", {
71
- key: u,
72
- color: u < b ? v(P) : void 0,
73
- w: D
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
- var V = "".concat(b, "%");
77
- return o && (V = "".concat(b / o * 100, "%")), _ = m(y), /* @__PURE__ */ e.createElement(c, _.cn("SLineGauge", x({}, G({
78
- "base-bg-color": v(k)
79
- }, t))), !B && /* @__PURE__ */ e.createElement(f, _.cn("SLineValue", {
80
- w: V,
81
- color: v(P)
82
- })), !!C.length && /* @__PURE__ */ e.createElement(d, _.cn("SLineGaugeSegment", {}), C), w && /* @__PURE__ */ e.createElement(a, _.cn("SAnimationLine", {})));
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
- }]), r;
85
- }(F);
86
- S(l, "enhance", [q()]);
87
- S(l, "displayName", "ScoreLine");
88
- S(l, "style", H);
89
- S(l, "defaultProps", {
90
- animate: !0
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 A(p) {
93
- var h = arguments[0], r, L = p.styles, t = g;
94
- return r = m(L), /* @__PURE__ */ e.createElement(t, r.cn("SLineSegmentItem", x({}, G({}, h))));
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
- A.displayName = "Segment";
97
- var J = z(l, {
98
- Segment: A
119
+ Segment.displayName = "Segment";
120
+ var ScoreLine = createComponent(LineRoot, {
121
+ Segment
99
122
  });
100
- J.displayName = "MiniChart.ScoreLine";
123
+ ScoreLine.displayName = "MiniChart.ScoreLine";
101
124
  export {
102
- J as ScoreLine
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
+ }