@semcore/mini-chart 0.29.0-prerelease.11 → 0.29.0-prerelease.14

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 CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
- ## [0.29.0] - 2025-03-03
5
+ ## [0.29.0] - 2025-03-14
6
6
 
7
- ### Changed
7
+ ### Added
8
8
 
9
- - Version minor update due to children dependencies update (`@semcore/flex-box` [5.40.1 ~> 5.41.0], `@semcore/utils` [4.45.1 ~> 4.47.1], `@semcore/core` [2.38.1 ~> 2.39.0]).
9
+ - Build for ESM.
10
10
 
11
11
  ## [0.28.1] - 2025-02-05
12
12
 
@@ -0,0 +1,103 @@
1
+ import k from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import M from "@babel/runtime/helpers/esm/classCallCheck";
3
+ import W from "@babel/runtime/helpers/esm/createClass";
4
+ import G from "@babel/runtime/helpers/esm/inherits";
5
+ import N from "@babel/runtime/helpers/esm/createSuper";
6
+ import u from "@babel/runtime/helpers/esm/defineProperty";
7
+ import { sstyled as R } from "@semcore/utils/lib/core/index";
8
+ import C, { assignProps as P, sstyled as I, Component as j } from "@semcore/core";
9
+ import r from "react";
10
+ import { Box as F } from "@semcore/flex-box";
11
+ import q from "@semcore/utils/lib/enhances/resolveColorEnhance";
12
+ import { extractAriaProps as H } from "@semcore/utils/lib/ariaProps";
13
+ var J = (
14
+ /*__reshadow_css_start__*/
15
+ (R.insert(
16
+ /*__inner_css_start__*/
17
+ "@keyframes pulse_18pnz{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_18pnz_gg_.__loading_18pnz_gg_,.___SLineGauge_18pnz_gg_.__loading_18pnz_gg_,.___STrendBar_18pnz_gg_.__loading_18pnz_gg_,.___STrendLine_18pnz_gg_.__loading_18pnz_gg_{animation-name:pulse_18pnz;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SDonutContainer_18pnz_gg_.__semi_18pnz_gg_ g{transform:rotate(180deg) translate(-24px,-24px)}.___SDonutContainer_18pnz_gg_ g{transform:rotate(-90deg) translate(-24px)}.___SDonutContainer_18pnz_gg_.__animate_18pnz_gg_ circle{transition:all var(--intergalactic-duration-extra-slow, 500) ease-in-out}",
18
+ "18pnz_gg_"
19
+ ), {
20
+ __SLineGauge: "___SLineGauge_18pnz_gg_",
21
+ _loading: "__loading_18pnz_gg_",
22
+ __SDonutContainer: "___SDonutContainer_18pnz_gg_",
23
+ __STrendLine: "___STrendLine_18pnz_gg_",
24
+ __STrendBar: "___STrendBar_18pnz_gg_",
25
+ "@pulse": "pulse_18pnz",
26
+ _animate: "__animate_18pnz_gg_",
27
+ _semi: "__semi_18pnz_gg_"
28
+ })
29
+ ), p = /* @__PURE__ */ function(d) {
30
+ G(n, d);
31
+ var g = N(n);
32
+ function n() {
33
+ return M(this, n), g.apply(this, arguments);
34
+ }
35
+ return W(n, [{
36
+ key: "render",
37
+ value: function() {
38
+ var x = this.asProps, t, B = F, o = this.asProps, _ = o.value, b = o.styles, h = o.baseBgColor, E = h === void 0 ? "chart-grid-bar-chart-base-bg" : h, f = o.color, w = f === void 0 ? "chart-palette-order-1" : f, l = o.resolveColor, e = o.isSemiDonut, v = o.loading, m = e ? 6 : 4, i = e ? 9 : 10, a = e ? Math.PI * i : Math.PI * 2 * i, s = a * (_ / 100), S = a * ((100 - _) / 100), c = e ? a / (100 / 3) : a / 100, D = "".concat(S - 2 * c, " ").concat(c), y = "".concat(c, " ").concat(_ < 99 ? "".concat(D) : "", " ").concat(a);
39
+ e && (y = "".concat(c, " ").concat(_ < 95 ? "".concat(D) : "", " ").concat(a));
40
+ var L = e ? "0 0 24 12" : "0 0 24 24", T = -1 * (s + (e ? c : 0)), z = H(this.asProps), $ = z.__excludeProps, A = z.extractedAriaProps;
41
+ return t = I(b), /* @__PURE__ */ r.createElement(B, t.cn("SDonutContainer", k({}, P({
42
+ semi: e,
43
+ __excludeProps: $
44
+ }, x))), /* @__PURE__ */ r.createElement("svg", t.cn("svg", k({
45
+ width: "100%",
46
+ height: "100%",
47
+ viewBox: L,
48
+ fill: "none",
49
+ role: "img"
50
+ }, A)), /* @__PURE__ */ r.createElement("g", t.cn("g", {}), /* @__PURE__ */ r.createElement("circle", t.cn("circle", {
51
+ cx: "12",
52
+ cy: "12",
53
+ r: i,
54
+ strokeWidth: m,
55
+ stroke: l(E),
56
+ strokeDasharray: v ? void 0 : "".concat(S, " ").concat(a),
57
+ strokeDashoffset: T
58
+ })), !v && /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("circle", t.cn("circle", {
59
+ cx: "12",
60
+ cy: "12",
61
+ r: i,
62
+ strokeWidth: m,
63
+ stroke: l(w),
64
+ strokeDasharray: "".concat(s, " ").concat(a),
65
+ strokeDashoffset: s
66
+ }), /* @__PURE__ */ r.createElement("animate", t.cn("animate", {
67
+ attributeName: "stroke-dashoffset",
68
+ values: "0;".concat(s)
69
+ }))), _ !== 100 && !e && /* @__PURE__ */ r.createElement("circle", t.cn("circle", {
70
+ cx: "12",
71
+ cy: "12",
72
+ r: i,
73
+ strokeWidth: m,
74
+ stroke: l("chart-grid-border"),
75
+ strokeDasharray: y,
76
+ strokeDashoffset: -1 * s
77
+ }))))));
78
+ }
79
+ }]), n;
80
+ }(j);
81
+ u(p, "enhance", [q()]);
82
+ u(p, "style", J);
83
+ u(p, "defaultProps", {
84
+ animate: !0
85
+ });
86
+ var K = C(p);
87
+ K.displayName = "MiniChart.ScoreDonut";
88
+ var O = C(p, {}, {
89
+ enhancements: [function() {
90
+ return {
91
+ wrapperProps: function(g) {
92
+ return P(g, {
93
+ isSemiDonut: !0
94
+ });
95
+ }
96
+ };
97
+ }]
98
+ });
99
+ O.displayName = "MiniChart.ScoreSemiDonut";
100
+ export {
101
+ K as ScoreDonut,
102
+ O as ScoreSemiDonut
103
+ };
@@ -0,0 +1,104 @@
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 z } from "@semcore/utils/lib/core/index";
8
+ import F, { sstyled as y, assignProps as G, Component as M } from "@semcore/core";
9
+ import e from "react";
10
+ import { Box as l, Flex as q } from "@semcore/flex-box";
11
+ import H from "@semcore/utils/lib/enhances/resolveColorEnhance";
12
+ var J = (
13
+ /*__reshadow_css_start__*/
14
+ (z.insert(
15
+ /*__inner_css_start__*/
16
+ "@keyframes pulse_1lsyc{0%,to{opacity:1}50%{opacity:.4}}@keyframes move-line_1lsyc{0%{transform:translateX(0)}to{transform:translateX(100%)}}.___SDonutContainer_1lsyc_gg_.__loading_1lsyc_gg_,.___SLineGauge_1lsyc_gg_.__loading_1lsyc_gg_,.___STrendBar_1lsyc_gg_.__loading_1lsyc_gg_,.___STrendLine_1lsyc_gg_.__loading_1lsyc_gg_{animation-name:pulse_1lsyc;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SLineGauge_1lsyc_gg_{height:8px;background-color:var(--base-bg-color_1lsyc, var(--intergalactic-chart-grid-bar-chart-base-bg, #e0e1e9));border-radius:var(--intergalactic-chart-rounded, 2px);overflow:hidden;position:relative}.___SLineValue_1lsyc_gg_{height:8px;border-radius:var(--intergalactic-chart-rounded, 2px)0 0 var(--intergalactic-chart-rounded, 2px)}.___SLineValue_1lsyc_gg_.__percent_1lsyc_gg_{width:var(--percent_1lsyc)}.___SLineSegmentItem_1lsyc_gg_.__color_1lsyc_gg_,.___SLineValue_1lsyc_gg_.__color_1lsyc_gg_{background-color:var(--color_1lsyc, var(--intergalactic-chart-palette-order-1, #2bb3ff))}.___SLineGauge_1lsyc_gg_.__segments_1lsyc_gg_{border-radius:var(--intergalactic-progress-bar-rounded, 6px)}.___SAnimationLine_1lsyc_gg_,.___SLineGaugeSegment_1lsyc_gg_{position:absolute;top:0;left:0;right:0;bottom:0}.___SLineSegmentItem_1lsyc_gg_:last-child{margin-right:0;border-right:none}.___SLineSegmentItem_1lsyc_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_1lsyc_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_1lsyc;animation-duration:.5s;animation-timing-function:ease-in-out;animation-fill-mode:forwards}",
17
+ "1lsyc_gg_"
18
+ ), {
19
+ __SLineGauge: "___SLineGauge_1lsyc_gg_",
20
+ _loading: "__loading_1lsyc_gg_",
21
+ __SDonutContainer: "___SDonutContainer_1lsyc_gg_",
22
+ __STrendLine: "___STrendLine_1lsyc_gg_",
23
+ __STrendBar: "___STrendBar_1lsyc_gg_",
24
+ "@pulse": "pulse_1lsyc",
25
+ "--base-bg-color": "--base-bg-color_1lsyc",
26
+ __SLineValue: "___SLineValue_1lsyc_gg_",
27
+ _percent: "__percent_1lsyc_gg_",
28
+ "--percent": "--percent_1lsyc",
29
+ _color: "__color_1lsyc_gg_",
30
+ __SLineSegmentItem: "___SLineSegmentItem_1lsyc_gg_",
31
+ "--color": "--color_1lsyc",
32
+ _segments: "__segments_1lsyc_gg_",
33
+ __SLineGaugeSegment: "___SLineGaugeSegment_1lsyc_gg_",
34
+ __SAnimationLine: "___SAnimationLine_1lsyc_gg_",
35
+ "@move-line": "move-line_1lsyc"
36
+ })
37
+ ), c = /* @__PURE__ */ function(p) {
38
+ X(n, p);
39
+ var v = j(n);
40
+ function n() {
41
+ return N(this, n), v.apply(this, arguments);
42
+ }
43
+ return R(n, [{
44
+ key: "getSegmentProps",
45
+ value: function(t) {
46
+ var _ = this.asProps, s = _.children, L = _.resolveColor, a = 0;
47
+ e.Children.forEach(s, function(m) {
48
+ /* @__PURE__ */ e.isValidElement(m) && (a = a + m.props.value);
49
+ });
50
+ var g = a > 0 ? 100 * t.value / a : 0;
51
+ return {
52
+ w: "".concat(g, "%"),
53
+ "use:color": L(t.color)
54
+ };
55
+ }
56
+ }, {
57
+ key: "render",
58
+ value: function() {
59
+ var t = this.asProps, _, s = l, L = l, a = l, g = q, m = l, r = this.asProps, f = r.value, b = r.styles, E = r.color, P = E === void 0 ? "chart-palette-order-1" : E, k = r.baseBgColor, u = r.resolveColor, B = r.loading, T = r.children, $ = r.Children, w = r.animate;
60
+ if (T !== void 0) {
61
+ var i;
62
+ return i = y(b), /* @__PURE__ */ e.createElement(s, i.cn("SLineGauge", x({}, G({
63
+ segments: !0,
64
+ "base-bg-color": u(k)
65
+ }, t))), /* @__PURE__ */ e.createElement(g, i.cn("SLineGaugeSegment", {}), /* @__PURE__ */ e.createElement($, i.cn("Children", {}))), w && /* @__PURE__ */ e.createElement(a, i.cn("SAnimationLine", {})));
66
+ }
67
+ var o = this.asProps.segments, C = [];
68
+ if (o)
69
+ for (var d = 0; d < o; d++) {
70
+ var I, D = "calc((100% - ".concat(o - 1, "px) / ").concat(o, ")");
71
+ C.push((I = y(b), /* @__PURE__ */ e.createElement(m, I.cn("SLineSegmentItem", {
72
+ key: d,
73
+ color: d < f ? u(P) : void 0,
74
+ w: D
75
+ }))));
76
+ }
77
+ var V = "".concat(f, "%");
78
+ return o && (V = "".concat(f / o * 100, "%")), _ = y(b), /* @__PURE__ */ e.createElement(s, _.cn("SLineGauge", x({}, G({
79
+ "base-bg-color": u(k)
80
+ }, t))), !B && /* @__PURE__ */ e.createElement(L, _.cn("SLineValue", {
81
+ w: V,
82
+ color: u(P)
83
+ })), !!C.length && /* @__PURE__ */ e.createElement(g, _.cn("SLineGaugeSegment", {}), C), w && /* @__PURE__ */ e.createElement(a, _.cn("SAnimationLine", {})));
84
+ }
85
+ }]), n;
86
+ }(M);
87
+ S(c, "enhance", [H()]);
88
+ S(c, "displayName", "ScoreLine");
89
+ S(c, "style", J);
90
+ S(c, "defaultProps", {
91
+ animate: !0
92
+ });
93
+ function A(p) {
94
+ var v = arguments[0], n, h = p.styles, t = l;
95
+ return n = y(h), /* @__PURE__ */ e.createElement(t, n.cn("SLineSegmentItem", x({}, G({}, v))));
96
+ }
97
+ A.displayName = "Segment";
98
+ var K = F(c, {
99
+ Segment: A
100
+ });
101
+ K.displayName = "MiniChart.ScoreLine";
102
+ export {
103
+ K as ScoreLine
104
+ };
@@ -0,0 +1,106 @@
1
+ import k from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import h from "@babel/runtime/helpers/esm/objectSpread2";
3
+ import w from "@babel/runtime/helpers/esm/classCallCheck";
4
+ import L from "@babel/runtime/helpers/esm/createClass";
5
+ import A from "@babel/runtime/helpers/esm/inherits";
6
+ import D from "@babel/runtime/helpers/esm/createSuper";
7
+ import g from "@babel/runtime/helpers/esm/defineProperty";
8
+ import { sstyled as E } from "@semcore/utils/lib/core/index";
9
+ import v, { assignProps as y, sstyled as R } from "@semcore/core";
10
+ import _ from "react";
11
+ import G from "@semcore/utils/lib/enhances/resolveColorEnhance";
12
+ import { Trend as N } from "./Trend.mjs";
13
+ import { Box as $ } from "@semcore/flex-box";
14
+ import { extractAriaProps as M } from "@semcore/utils/lib/ariaProps";
15
+ var W = (
16
+ /*__reshadow_css_start__*/
17
+ (E.insert(
18
+ /*__inner_css_start__*/
19
+ "@keyframes pulse_382bi{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_382bi_gg_.__loading_382bi_gg_,.___SLineGauge_382bi_gg_.__loading_382bi_gg_,.___STrendBar_382bi_gg_.__loading_382bi_gg_,.___STrendLine_382bi_gg_.__loading_382bi_gg_{animation-name:pulse_382bi;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}",
20
+ "382bi_gg_"
21
+ ), {
22
+ __SLineGauge: "___SLineGauge_382bi_gg_",
23
+ _loading: "__loading_382bi_gg_",
24
+ __SDonutContainer: "___SDonutContainer_382bi_gg_",
25
+ __STrendLine: "___STrendLine_382bi_gg_",
26
+ __STrendBar: "___STrendBar_382bi_gg_",
27
+ "@pulse": "pulse_382bi"
28
+ })
29
+ ), o = /* @__PURE__ */ function(d) {
30
+ A(e, d);
31
+ var s = D(e);
32
+ function e() {
33
+ return w(this, e), s.apply(this, arguments);
34
+ }
35
+ return L(e, [{
36
+ key: "defaultData",
37
+ get: function() {
38
+ return [{
39
+ value: 20
40
+ }, {
41
+ value: 80
42
+ }, {
43
+ value: 45
44
+ }, {
45
+ value: 10
46
+ }];
47
+ }
48
+ }, {
49
+ key: "data",
50
+ get: function() {
51
+ var n = this.asProps, r = n.data, t = n.loading;
52
+ return t ? this.defaultData : r;
53
+ }
54
+ }, {
55
+ key: "render",
56
+ value: function() {
57
+ var n = this.asProps, r, t = this, b = $, a = this.asProps, S = a.styles, p = a.resolveColor, T = a.isHistogram, C = a.animate, B = a.loading, l = this.defaultWidth / this.data.length, m = M(this.asProps), x = m.__excludeProps, H = m.extractedAriaProps;
58
+ return r = R(S), /* @__PURE__ */ _.createElement(b, r.cn("STrendBar", h({}, y({
59
+ ref: this.containerRef,
60
+ __excludeProps: ["data"].concat(k(x))
61
+ }, n))), /* @__PURE__ */ _.createElement("svg", r.cn("svg", h({
62
+ width: "100%",
63
+ height: "100%",
64
+ viewBox: "0 0 ".concat(this.svgWidth, " ").concat(this.svgHeight),
65
+ role: "img"
66
+ }, H)), this.data.map(function(i, c) {
67
+ var f = p("chart-palette-order-other-data");
68
+ return i.color && (f = p(i.color)), /* @__PURE__ */ _.createElement("rect", {
69
+ key: c,
70
+ x: l * c,
71
+ y: t.defaultHeight - i.value,
72
+ width: T ? l : l * 0.8,
73
+ height: i.value,
74
+ fill: f
75
+ }, C && !B && /* @__PURE__ */ _.createElement("animate", {
76
+ attributeName: "y",
77
+ values: "".concat(t.defaultHeight, ";").concat(t.defaultHeight - i.value),
78
+ dur: "500ms"
79
+ }));
80
+ })));
81
+ }
82
+ }]), e;
83
+ }(N);
84
+ g(o, "enhance", [G()]);
85
+ g(o, "style", W);
86
+ g(o, "defaultProps", {
87
+ animate: !0
88
+ });
89
+ var P = v(o);
90
+ P.displayName = "MiniChart.TrendBar";
91
+ var ee = v(o, {}, {
92
+ enhancements: [function() {
93
+ return {
94
+ wrapperProps: function(s) {
95
+ return y(s, {
96
+ isHistogram: !0
97
+ });
98
+ }
99
+ };
100
+ }]
101
+ });
102
+ P.displayName = "MiniChart.TrendHistogram";
103
+ export {
104
+ P as TrendBar,
105
+ ee as TrendHistogram
106
+ };
@@ -0,0 +1,140 @@
1
+ import w from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import y from "@babel/runtime/helpers/esm/objectSpread2";
3
+ import A from "@babel/runtime/helpers/esm/classCallCheck";
4
+ import E from "@babel/runtime/helpers/esm/createClass";
5
+ import R from "@babel/runtime/helpers/esm/inherits";
6
+ import H from "@babel/runtime/helpers/esm/createSuper";
7
+ import g from "@babel/runtime/helpers/esm/defineProperty";
8
+ import { sstyled as W } from "@semcore/utils/lib/core/index";
9
+ import b, { assignProps as C, sstyled as $ } from "@semcore/core";
10
+ import r from "react";
11
+ import D from "@semcore/utils/lib/enhances/resolveColorEnhance";
12
+ import B from "@semcore/utils/lib/uniqueID";
13
+ import { Trend as j } from "./Trend.mjs";
14
+ import { Box as G } from "@semcore/flex-box";
15
+ import { extractAriaProps as N } from "@semcore/utils/lib/ariaProps";
16
+ var M = (
17
+ /*__reshadow_css_start__*/
18
+ (W.insert(
19
+ /*__inner_css_start__*/
20
+ "@keyframes pulse_382bi{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_382bi_gg_.__loading_382bi_gg_,.___SLineGauge_382bi_gg_.__loading_382bi_gg_,.___STrendBar_382bi_gg_.__loading_382bi_gg_,.___STrendLine_382bi_gg_.__loading_382bi_gg_{animation-name:pulse_382bi;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}",
21
+ "382bi_gg_"
22
+ ), {
23
+ __SLineGauge: "___SLineGauge_382bi_gg_",
24
+ _loading: "__loading_382bi_gg_",
25
+ __SDonutContainer: "___SDonutContainer_382bi_gg_",
26
+ __STrendLine: "___STrendLine_382bi_gg_",
27
+ __STrendBar: "___STrendBar_382bi_gg_",
28
+ "@pulse": "pulse_382bi"
29
+ })
30
+ ), l = /* @__PURE__ */ function(u) {
31
+ R(s, u);
32
+ var d = H(s);
33
+ function s() {
34
+ return A(this, s), d.apply(this, arguments);
35
+ }
36
+ return E(s, [{
37
+ key: "defaultData",
38
+ get: function() {
39
+ return [15, 70, 20, 85, 20];
40
+ }
41
+ }, {
42
+ key: "lastPointRadius",
43
+ get: function() {
44
+ var e;
45
+ return (e = this.asProps.lastPointRadius) !== null && e !== void 0 ? e : 6;
46
+ }
47
+ }, {
48
+ key: "data",
49
+ get: function() {
50
+ var e = this.asProps, t = e.data, o = e.loading;
51
+ return o ? this.defaultData : t;
52
+ }
53
+ }, {
54
+ key: "svgWidth",
55
+ get: function() {
56
+ return this.asProps.lastPointColor ? this.defaultWidth + this.lastPointRadius : this.defaultWidth;
57
+ }
58
+ }, {
59
+ key: "svgHeight",
60
+ get: function() {
61
+ return this.asProps.lastPointColor ? this.defaultHeight + this.lastPointRadius : this.defaultHeight;
62
+ }
63
+ }, {
64
+ key: "color",
65
+ get: function() {
66
+ var e = this.asProps, t = e.resolveColor, o = e.color, i = o === void 0 ? "chart-palette-order-1" : o, n = e.loading;
67
+ return t(n ? "skeleton-bg" : i);
68
+ }
69
+ }, {
70
+ key: "render",
71
+ value: function() {
72
+ for (var e = this.asProps, t, o = G, i = this.asProps, n = i.uid, S = i.withArea, k = i.animate, p = i.lastPointColor, m = i.resolveColor, f = i.loading, T = i.styles, h = [], _ = this.data.length, P = this.defaultWidth / (_ - 1), c = 0; c < _; c++)
73
+ h.push("".concat(P * c, ",").concat(this.defaultHeight - this.data[c]));
74
+ var v = N(this.asProps), x = v.__excludeProps, L = v.extractedAriaProps;
75
+ return t = $(T), /* @__PURE__ */ r.createElement(o, t.cn("STrendLine", y({}, C({
76
+ ref: this.containerRef,
77
+ __excludeProps: ["data"].concat(w(x))
78
+ }, e))), /* @__PURE__ */ r.createElement("svg", t.cn("svg", y({
79
+ width: "100%",
80
+ height: "100%",
81
+ viewBox: "0 0 ".concat(this.svgWidth, " ").concat(this.svgHeight),
82
+ role: "img"
83
+ }, L)), /* @__PURE__ */ r.createElement("polyline", t.cn("polyline", {
84
+ points: h.join(" "),
85
+ stroke: this.color,
86
+ strokeWidth: "4",
87
+ fill: "none",
88
+ clipPath: "url(#".concat(n, ")")
89
+ })), S && /* @__PURE__ */ r.createElement("polyline", t.cn("polyline", {
90
+ points: "0,".concat(this.defaultHeight, " ").concat(h.join(" "), " ").concat(this.defaultWidth, ",").concat(this.defaultHeight),
91
+ fill: this.color,
92
+ fillOpacity: 0.2,
93
+ clipPath: "url(#".concat(n, ")")
94
+ })), p && !f && /* @__PURE__ */ r.createElement("circle", t.cn("circle", {
95
+ cx: P * (_ - 1),
96
+ cy: this.defaultHeight - this.data[_ - 1],
97
+ r: this.lastPointRadius,
98
+ fill: m(p),
99
+ stroke: m("chart-grid-border"),
100
+ strokeWidth: 4,
101
+ clipPath: "url(#".concat(n, ")")
102
+ })), k && !f && /* @__PURE__ */ r.createElement("clipPath", t.cn("clipPath", {
103
+ id: n
104
+ }), /* @__PURE__ */ r.createElement("rect", t.cn("rect", {
105
+ x: "0",
106
+ y: "0",
107
+ width: "100%",
108
+ height: "100%",
109
+ fill: "black"
110
+ }), /* @__PURE__ */ r.createElement("animate", t.cn("animate", {
111
+ dur: "500ms",
112
+ attributeName: "width",
113
+ values: "0;100%"
114
+ }))))));
115
+ }
116
+ }]), s;
117
+ }(j);
118
+ g(l, "enhance", [D(), B()]);
119
+ g(l, "style", M);
120
+ g(l, "defaultProps", {
121
+ animate: !0
122
+ });
123
+ var q = b(l);
124
+ q.displayName = "MiniChart.TrendLine";
125
+ var I = b(l, {}, {
126
+ enhancements: [function() {
127
+ return {
128
+ wrapperProps: function(d) {
129
+ return C(d, {
130
+ withArea: !0
131
+ });
132
+ }
133
+ };
134
+ }]
135
+ });
136
+ I.displayName = "MiniChart.TrendArea";
137
+ export {
138
+ I as TrendArea,
139
+ q as TrendLine
140
+ };
@@ -0,0 +1,66 @@
1
+ import f from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import u from "@babel/runtime/helpers/esm/createClass";
3
+ import a from "@babel/runtime/helpers/esm/assertThisInitialized";
4
+ import c from "@babel/runtime/helpers/esm/inherits";
5
+ import d from "@babel/runtime/helpers/esm/createSuper";
6
+ import s from "@babel/runtime/helpers/esm/defineProperty";
7
+ import m from "react";
8
+ import { Component as p } from "@semcore/core";
9
+ var R = /* @__PURE__ */ function(h) {
10
+ c(n, h);
11
+ var o = d(n);
12
+ function n() {
13
+ for (var e, t = arguments.length, r = new Array(t), i = 0; i < t; i++)
14
+ r[i] = arguments[i];
15
+ return f(this, n), e = o.call.apply(o, [this].concat(r)), s(a(e), "state", {
16
+ width: 200,
17
+ height: 100
18
+ }), s(a(e), "containerRef", /* @__PURE__ */ m.createRef()), e;
19
+ }
20
+ return u(n, [{
21
+ key: "componentDidMount",
22
+ value: function() {
23
+ this.setSizes();
24
+ }
25
+ }, {
26
+ key: "componentDidUpdate",
27
+ value: function(t) {
28
+ (t.w !== this.props.w || t.h !== this.props.h || t.data !== this.props.data) && this.setSizes();
29
+ }
30
+ }, {
31
+ key: "defaultWidth",
32
+ get: function() {
33
+ var t = this.state, r = t.width, i = t.height;
34
+ return r / i * this.defaultHeight;
35
+ }
36
+ }, {
37
+ key: "defaultHeight",
38
+ get: function() {
39
+ return 100;
40
+ }
41
+ }, {
42
+ key: "svgWidth",
43
+ get: function() {
44
+ return this.defaultWidth;
45
+ }
46
+ }, {
47
+ key: "svgHeight",
48
+ get: function() {
49
+ return this.defaultHeight;
50
+ }
51
+ }, {
52
+ key: "setSizes",
53
+ value: function() {
54
+ if (this.containerRef.current) {
55
+ var t = this.containerRef.current.getBoundingClientRect(), r = t.width, i = t.height;
56
+ r > 0 && i > 0 && this.setState({
57
+ width: r,
58
+ height: i
59
+ });
60
+ }
61
+ }
62
+ }]), n;
63
+ }(p);
64
+ export {
65
+ R as Trend
66
+ };
@@ -0,0 +1,16 @@
1
+ import { ScoreSemiDonut as r, ScoreDonut as o } from "./component/score/Donut.mjs";
2
+ import { ScoreLine as e } from "./component/score/Line.mjs";
3
+ import { TrendLine as m, TrendArea as i } from "./component/trend/Line.mjs";
4
+ import { TrendBar as t, TrendHistogram as n } from "./component/trend/Bar.mjs";
5
+ var S = {
6
+ TrendLine: m,
7
+ TrendArea: i,
8
+ TrendBar: t,
9
+ TrendHistogram: n,
10
+ ScoreSemiDonut: r,
11
+ ScoreDonut: o,
12
+ ScoreLine: e
13
+ };
14
+ export {
15
+ S as default
16
+ };
package/package.json CHANGED
@@ -1,19 +1,24 @@
1
1
  {
2
2
  "name": "@semcore/mini-chart",
3
3
  "description": "Semrush MiniChart Component",
4
- "version": "0.29.0-prerelease.11",
4
+ "version": "0.29.0-prerelease.14",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
8
8
  "sideEffects": false,
9
9
  "author": "UI-kit team <ui-kit-team@semrush.com>",
10
10
  "license": "MIT",
11
+ "exports": {
12
+ "require": "./lib/cjs/index.js",
13
+ "import": "./lib/esm/index.mjs",
14
+ "types": "./lib/types/index.d.ts"
15
+ },
11
16
  "dependencies": {
12
- "@semcore/flex-box": "5.41.0-prerelease.11",
13
- "@semcore/utils": "4.47.1-prerelease.11"
17
+ "@semcore/flex-box": "5.41.0-prerelease.14",
18
+ "@semcore/utils": "4.48.0-prerelease.14"
14
19
  },
15
20
  "peerDependencies": {
16
- "@semcore/core": "^2.39.0-prerelease.11",
21
+ "@semcore/core": "^2.39.0-prerelease.14",
17
22
  "react": "16.8 - 18",
18
23
  "react-dom": "16.8 - 18"
19
24
  },
@@ -27,6 +32,6 @@
27
32
  "@semcore/testing-utils": "1.0.0"
28
33
  },
29
34
  "scripts": {
30
- "build": "pnpm semcore-builder --source=ts"
35
+ "build": "pnpm semcore-builder --source=ts && pnpm vite build"
31
36
  }
32
37
  }
package/vite.config.ts ADDED
@@ -0,0 +1,17 @@
1
+ import { defineConfig, mergeConfig } from 'vite';
2
+
3
+ import viteConfig from '../../commonVite.config';
4
+
5
+ export default mergeConfig(
6
+ viteConfig,
7
+ defineConfig({
8
+ build: {
9
+ lib: {
10
+ entry: './src/index.ts',
11
+ },
12
+ rollupOptions: {
13
+ external: ['react', 'react-dom', 'react/jsx-runtime', /@babel\/runtime\/*/, /@semcore\/*/],
14
+ },
15
+ },
16
+ }),
17
+ );