@semcore/mini-chart 16.1.1-prerelease.5 → 17.0.0-prerelease.17

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/README.md +4 -4
  3. package/lib/cjs/component/score/Donut.js +84 -96
  4. package/lib/cjs/component/score/Donut.js.map +1 -1
  5. package/lib/cjs/component/score/Line.js +104 -108
  6. package/lib/cjs/component/score/Line.js.map +1 -1
  7. package/lib/cjs/component/score/Line.types.js.map +1 -1
  8. package/lib/cjs/component/score/index.js +3 -3
  9. package/lib/cjs/component/trend/Bar.js +83 -96
  10. package/lib/cjs/component/trend/Bar.js.map +1 -1
  11. package/lib/cjs/component/trend/Line.js +114 -135
  12. package/lib/cjs/component/trend/Line.js.map +1 -1
  13. package/lib/cjs/component/trend/Trend.js +43 -65
  14. package/lib/cjs/component/trend/Trend.js.map +1 -1
  15. package/lib/cjs/component/trend/index.js +4 -4
  16. package/lib/cjs/index.js +3 -3
  17. package/lib/cjs/index.js.map +1 -1
  18. package/lib/cjs/utils/ScoreDonutUtils.js +48 -75
  19. package/lib/cjs/utils/ScoreDonutUtils.js.map +1 -1
  20. package/lib/es6/component/score/Donut.js +80 -93
  21. package/lib/es6/component/score/Donut.js.map +1 -1
  22. package/lib/es6/component/score/Line.js +99 -103
  23. package/lib/es6/component/score/Line.js.map +1 -1
  24. package/lib/es6/component/score/Line.types.js.map +1 -1
  25. package/lib/es6/component/trend/Bar.js +78 -91
  26. package/lib/es6/component/trend/Bar.js.map +1 -1
  27. package/lib/es6/component/trend/Line.js +109 -130
  28. package/lib/es6/component/trend/Line.js.map +1 -1
  29. package/lib/es6/component/trend/Trend.js +41 -64
  30. package/lib/es6/component/trend/Trend.js.map +1 -1
  31. package/lib/es6/index.js +8 -8
  32. package/lib/es6/index.js.map +1 -1
  33. package/lib/es6/utils/ScoreDonutUtils.js +43 -71
  34. package/lib/es6/utils/ScoreDonutUtils.js.map +1 -1
  35. package/lib/esm/component/score/Donut.mjs +80 -79
  36. package/lib/esm/component/score/Line.mjs +100 -91
  37. package/lib/esm/component/trend/Bar.mjs +79 -82
  38. package/lib/esm/component/trend/Line.mjs +110 -116
  39. package/lib/esm/component/trend/Trend.mjs +41 -61
  40. package/lib/esm/index.mjs +1 -1
  41. package/lib/esm/utils/ScoreDonutUtils.mjs +43 -71
  42. package/lib/types/component/score/Donut.d.ts +7 -12
  43. package/lib/types/component/score/Line.types.d.ts +8 -6
  44. package/lib/types/component/trend/Bar.d.ts +2 -8
  45. package/lib/types/component/trend/Line.d.ts +6 -10
  46. package/lib/types/component/trend/Trend.d.ts +3 -3
  47. package/package.json +5 -5
@@ -1,87 +1,60 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.ScoreDonutUtils = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
- var ScoreDonutUtils = exports.ScoreDonutUtils = /*#__PURE__*/function () {
12
- function ScoreDonutUtils(value, isSemiDonut) {
13
- (0, _classCallCheck2["default"])(this, ScoreDonutUtils);
14
- (0, _defineProperty2["default"])(this, "isSemiDonut", void 0);
15
- (0, _defineProperty2["default"])(this, "value", void 0);
16
- (0, _defineProperty2["default"])(this, "radius", void 0);
9
+ class ScoreDonutUtils {
10
+ constructor(value, isSemiDonut) {
11
+ (0, _defineProperty2.default)(this, "isSemiDonut", void 0);
12
+ (0, _defineProperty2.default)(this, "value", void 0);
13
+ (0, _defineProperty2.default)(this, "radius", void 0);
17
14
  this.isSemiDonut = isSemiDonut;
18
15
  this.radius = isSemiDonut ? 9 : 10;
19
16
  this.value = Math.max(Math.min(value, 100), 0);
20
17
  }
21
- return (0, _createClass2["default"])(ScoreDonutUtils, [{
22
- key: "viewBox",
23
- get: function get() {
24
- return this.isSemiDonut ? '0 0 24 12' : '0 0 24 24';
25
- }
26
- }, {
27
- key: "strokeWidth",
28
- get: function get() {
29
- return this.isSemiDonut ? 6 : 4;
30
- }
31
- }, {
32
- key: "fullLength",
33
- get: function get() {
34
- return this.isSemiDonut ? Math.PI * this.radius : 2 * Math.PI * this.radius;
35
- }
36
- }, {
37
- key: "point",
38
- get: function get() {
39
- return this.isSemiDonut ? this.fullLength / (100 / 3) : this.fullLength / 100;
40
- }
41
- }, {
42
- key: "valueLength",
43
- get: function get() {
44
- return this.fullLength * (this.value / 100);
45
- }
46
- }, {
47
- key: "animatedValueLength",
48
- get: function get() {
49
- return Math.min(this.valueLength, this.fullLength - this.startMargin - this.endMargin);
50
- }
51
- }, {
52
- key: "startMargin",
53
- get: function get() {
54
- var margin = 0;
55
- if (this.value > 0) margin = this.point;
56
- return margin;
57
- }
58
- }, {
59
- key: "endMargin",
60
- get: function get() {
61
- var margin = 0;
62
- if (!this.isSemiDonut && this.value > 0) margin = this.point;
63
- return margin;
64
- }
65
- }, {
66
- key: "baseOffset",
67
- get: function get() {
68
- return -1 * (this.valueLength + this.startMargin);
69
- }
70
- }, {
71
- key: "baseLength",
72
- get: function get() {
73
- return Math.max(this.fullLength - this.valueLength - this.startMargin - this.endMargin, 0);
74
- }
75
- }, {
76
- key: "animatedBaseLengthFrom",
77
- get: function get() {
78
- return this.fullLength - this.startMargin - this.endMargin;
79
- }
80
- }, {
81
- key: "animatedBaseLengthTo",
82
- get: function get() {
83
- return this.fullLength - this.valueLength - this.startMargin - this.endMargin;
84
- }
85
- }]);
86
- }();
18
+ get viewBox() {
19
+ return this.isSemiDonut ? '0 0 24 12' : '0 0 24 24';
20
+ }
21
+ get strokeWidth() {
22
+ return this.isSemiDonut ? 6 : 4;
23
+ }
24
+ get fullLength() {
25
+ return this.isSemiDonut ? Math.PI * this.radius : 2 * Math.PI * this.radius;
26
+ }
27
+ get point() {
28
+ return this.isSemiDonut ? this.fullLength / (100 / 3) : this.fullLength / 100;
29
+ }
30
+ get valueLength() {
31
+ return this.fullLength * (this.value / 100);
32
+ }
33
+ get animatedValueLength() {
34
+ return Math.min(this.valueLength, this.fullLength - this.startMargin - this.endMargin);
35
+ }
36
+ get startMargin() {
37
+ let margin = 0;
38
+ if (this.value > 0) margin = this.point;
39
+ return margin;
40
+ }
41
+ get endMargin() {
42
+ let margin = 0;
43
+ if (!this.isSemiDonut && this.value > 0) margin = this.point;
44
+ return margin;
45
+ }
46
+ get baseOffset() {
47
+ return -1 * (this.valueLength + this.startMargin);
48
+ }
49
+ get baseLength() {
50
+ return Math.max(this.fullLength - this.valueLength - this.startMargin - this.endMargin, 0);
51
+ }
52
+ get animatedBaseLengthFrom() {
53
+ return this.fullLength - this.startMargin - this.endMargin;
54
+ }
55
+ get animatedBaseLengthTo() {
56
+ return this.fullLength - this.valueLength - this.startMargin - this.endMargin;
57
+ }
58
+ }
59
+ exports.ScoreDonutUtils = ScoreDonutUtils;
87
60
  //# sourceMappingURL=ScoreDonutUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ScoreDonutUtils.js","names":["ScoreDonutUtils","exports","value","isSemiDonut","_classCallCheck2","_defineProperty2","radius","Math","max","min","_createClass2","key","get","PI","fullLength","valueLength","startMargin","endMargin","margin","point"],"sources":["../../../src/utils/ScoreDonutUtils.ts"],"sourcesContent":["export class ScoreDonutUtils {\n private readonly isSemiDonut: boolean;\n private readonly value: number;\n\n public readonly radius: number;\n\n constructor(value: number, isSemiDonut: boolean) {\n this.isSemiDonut = isSemiDonut;\n this.radius = isSemiDonut ? 9 : 10;\n this.value = Math.max(Math.min(value, 100), 0);\n }\n\n public get viewBox() {\n return this.isSemiDonut ? '0 0 24 12' : '0 0 24 24';\n }\n\n public get strokeWidth() {\n return this.isSemiDonut ? 6 : 4;\n }\n\n public get fullLength() {\n return this.isSemiDonut ? Math.PI * this.radius : 2 * Math.PI * this.radius;\n }\n\n public get point() {\n return this.isSemiDonut\n ? this.fullLength / (100 / 3)\n : this.fullLength / 100;\n }\n\n public get valueLength() {\n return this.fullLength * (this.value / 100);\n }\n\n public get animatedValueLength() {\n return Math.min(this.valueLength, this.fullLength - this.startMargin - this.endMargin);\n }\n\n public get startMargin() {\n let margin = 0;\n if (this.value > 0) margin = this.point;\n return margin;\n }\n\n public get endMargin() {\n let margin = 0;\n if (!this.isSemiDonut && this.value > 0) margin = this.point;\n return margin;\n }\n\n public get baseOffset() {\n return -1 * (this.valueLength + this.startMargin);\n };\n\n public get baseLength() {\n return Math.max(this.fullLength - this.valueLength - this.startMargin - this.endMargin, 0);\n }\n\n public get animatedBaseLengthFrom() {\n return this.fullLength - this.startMargin - this.endMargin;\n }\n\n public get animatedBaseLengthTo() {\n return this.fullLength - this.valueLength - this.startMargin - this.endMargin;\n }\n}\n"],"mappings":";;;;;;;;;;IAAaA,eAAe,GAAAC,OAAA,CAAAD,eAAA;EAM1B,SAAAA,gBAAYE,KAAa,EAAEC,WAAoB,EAAE;IAAA,IAAAC,gBAAA,mBAAAJ,eAAA;IAAA,IAAAK,gBAAA;IAAA,IAAAA,gBAAA;IAAA,IAAAA,gBAAA;IAC/C,IAAI,CAACF,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACG,MAAM,GAAGH,WAAW,GAAG,CAAC,GAAG,EAAE;IAClC,IAAI,CAACD,KAAK,GAAGK,IAAI,CAACC,GAAG,CAACD,IAAI,CAACE,GAAG,CAACP,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;EAChD;EAAC,WAAAQ,aAAA,aAAAV,eAAA;IAAAW,GAAA;IAAAC,GAAA,EAED,SAAAA,IAAA,EAAqB;MACnB,OAAO,IAAI,CAACT,WAAW,GAAG,WAAW,GAAG,WAAW;IACrD;EAAC;IAAAQ,GA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OAAOD,MAAM;IACf;EAAC;IAAAP,GAAA;IAAAC,GAAA,EAED,SAAAA,IAAA,EAAwB;MACtB,OAAO,CAAC,CAAC,IAAI,IAAI,CAACG,WAAW,GAAG,IAAI,CAACC,WAAW,CAAC;IACnD;EAAC;IAAAL,GAAA;IAAAC,GAAA,EAED,SAAAA,IAAA,EAAwB;MACtB,OAAOL,IAAI,CAACC,GAAG,CAAC,IAAI,CAACM,UAAU,GAAG,IAAI,CAACC,WAAW,GAAG,IAAI,CAACC,WAAW,GAAG,IAAI,CAACC,SAAS,EAAE,CAAC,CAAC;IAC5F;EAAC;IAAAN,GAAA;IAAAC,GAAA,EAED,SAAAA,IAAA,EAAoC;MAClC,OAAO,IAAI,CAACE,UAAU,GAAG,IAAI,CAACE,WAAW,GAAG,IAAI,CAACC,SAAS;IAC5D;EAAC;IAAAN,GAAA;IAAAC,GAAA,EAED,SAAAA,IAAA,EAAkC;MAChC,OAAO,IAAI,CAACE,UAAU,GAAG,IAAI,CAACC,WAAW,GAAG,IAAI,CAACC,WAAW,GAAG,IAAI,CAACC,SAAS;IAC/E;EAAC;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"ScoreDonutUtils.js","names":["ScoreDonutUtils","constructor","value","isSemiDonut","_defineProperty2","default","radius","Math","max","min","viewBox","strokeWidth","fullLength","PI","point","valueLength","animatedValueLength","startMargin","endMargin","margin","baseOffset","baseLength","animatedBaseLengthFrom","animatedBaseLengthTo","exports"],"sources":["../../../src/utils/ScoreDonutUtils.ts"],"sourcesContent":["export class ScoreDonutUtils {\n private readonly isSemiDonut: boolean;\n private readonly value: number;\n\n public readonly radius: number;\n\n constructor(value: number, isSemiDonut: boolean) {\n this.isSemiDonut = isSemiDonut;\n this.radius = isSemiDonut ? 9 : 10;\n this.value = Math.max(Math.min(value, 100), 0);\n }\n\n public get viewBox() {\n return this.isSemiDonut ? '0 0 24 12' : '0 0 24 24';\n }\n\n public get strokeWidth() {\n return this.isSemiDonut ? 6 : 4;\n }\n\n public get fullLength() {\n return this.isSemiDonut ? Math.PI * this.radius : 2 * Math.PI * this.radius;\n }\n\n public get point() {\n return this.isSemiDonut\n ? this.fullLength / (100 / 3)\n : this.fullLength / 100;\n }\n\n public get valueLength() {\n return this.fullLength * (this.value / 100);\n }\n\n public get animatedValueLength() {\n return Math.min(this.valueLength, this.fullLength - this.startMargin - this.endMargin);\n }\n\n public get startMargin() {\n let margin = 0;\n if (this.value > 0) margin = this.point;\n return margin;\n }\n\n public get endMargin() {\n let margin = 0;\n if (!this.isSemiDonut && this.value > 0) margin = this.point;\n return margin;\n }\n\n public get baseOffset() {\n return -1 * (this.valueLength + this.startMargin);\n };\n\n public get baseLength() {\n return Math.max(this.fullLength - this.valueLength - this.startMargin - this.endMargin, 0);\n }\n\n public get animatedBaseLengthFrom() {\n return this.fullLength - this.startMargin - this.endMargin;\n }\n\n public get animatedBaseLengthTo() {\n return this.fullLength - this.valueLength - this.startMargin - this.endMargin;\n }\n}\n"],"mappings":";;;;;;;;AAAO,MAAMA,eAAe,CAAC;EAM3BC,WAAWA,CAACC,KAAa,EAAEC,WAAoB,EAAE;IAAA,IAAAC,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAC/C,IAAI,CAACF,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACG,MAAM,GAAGH,WAAW,GAAG,CAAC,GAAG,EAAE;IAClC,IAAI,CAACD,KAAK,GAAGK,IAAI,CAACC,GAAG,CAACD,IAAI,CAACE,GAAG,CAACP,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;EAChD;EAEA,IAAWQ,OAAOA,CAAA,EAAG;IACnB,OAAO,IAAI,CAACP,WAAW,GAAG,WAAW,GAAG,WAAW;EACrD;EAEA,IAAWQ,WAAWA,CAAA,EAAG;IACvB,OAAO,IAAI,CAACR,WAAW,GAAG,CAAC,GAAG,CAAC;EACjC;EAEA,IAAWS,UAAUA,CAA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IAAI,CAACC,SAAS,EAAE,CAAC,CAAC;EAC5F;EAEA,IAAWI,sBAAsBA,CAAA,EAAG;IAClC,OAAO,IAAI,CAACV,UAAU,GAAG,IAAI,CAACK,WAAW,GAAG,IAAI,CAACC,SAAS;EAC5D;EAEA,IAAWK,oBAAoBA,CAAA,EAAG;IAChC,OAAO,IAAI,CAACX,UAAU,GAAG,IAAI,CAACG,WAAW,GAAG,IAAI,CAACE,WAAW,GAAG,IAAI,CAACC,SAAS;EAC/E;AACF;AAACM,OAAA,CAAAxB,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -1,121 +1,108 @@
1
- import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/createClass";
4
- import _callSuper from "@babel/runtime/helpers/callSuper";
5
- import _inherits from "@babel/runtime/helpers/inherits";
6
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
7
2
  import { sstyled as _sstyled } from "@semcore/core";
8
3
  import { assignProps as _assignProps } from "@semcore/core";
9
- import { createComponent, Component, Root, sstyled } from '@semcore/core';
10
- import { assignProps } from '@semcore/core';
4
+ import { Box } from '@semcore/base-components';
5
+ import { createComponent, Component, Root, sstyled, assignProps } from '@semcore/core';
11
6
  import { extractAriaProps } from '@semcore/core/lib/utils/ariaProps';
12
7
  import resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';
13
8
  import { cssVariableEnhance } from '@semcore/core/lib/utils/useCssVariable';
14
- import { Box } from '@semcore/flex-box';
15
9
  import React from 'react';
16
10
  /*!__reshadow-styles__:"./donut.shadow.css"*/
17
- var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/"@keyframes pulse_1kq41{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_1kq41_gg_.__loading_1kq41_gg_,.___SLineGauge_1kq41_gg_.__loading_1kq41_gg_,.___STrendBar_1kq41_gg_.__loading_1kq41_gg_,.___STrendLine_1kq41_gg_.__loading_1kq41_gg_{animation-name:pulse_1kq41;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SDonutContainer_1kq41_gg_.__semi_1kq41_gg_ g{transform:rotate(180deg) translate(-24px,-24px)}.___SDonutContainer_1kq41_gg_ g{transform:rotate(-90deg) translate(-24px)}.___SDonutContainer_1kq41_gg_.__animate_1kq41_gg_ circle{transition:all var(--intergalactic-duration-extra-slow, 500) ease-in-out}", /*__inner_css_end__*/"1kq41_gg_"),
11
+ const style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/"@keyframes pulse_1yj1g{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_1yj1g_gg_.__loading_1yj1g_gg_,.___SLineGauge_1yj1g_gg_.__loading_1yj1g_gg_,.___STrendBar_1yj1g_gg_.__loading_1yj1g_gg_,.___STrendLine_1yj1g_gg_.__loading_1yj1g_gg_{animation-name:pulse_1yj1g;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SDonutContainer_1yj1g_gg_.__semi_1yj1g_gg_ g{transform:rotate(180deg) translate(-24px,-24px)}.___SDonutContainer_1yj1g_gg_ g{transform:rotate(-90deg) translate(-24px)}.___SDonutContainer_1yj1g_gg_.__animate_1yj1g_gg_ circle{transition:all var(--intergalactic-duration-extra-slow, 500) ease-in-out}", /*__inner_css_end__*/"1yj1g_gg_"),
18
12
  /*__reshadow_css_end__*/
19
13
  {
20
- "__SLineGauge": "___SLineGauge_1kq41_gg_",
21
- "_loading": "__loading_1kq41_gg_",
22
- "__SDonutContainer": "___SDonutContainer_1kq41_gg_",
23
- "__STrendLine": "___STrendLine_1kq41_gg_",
24
- "__STrendBar": "___STrendBar_1kq41_gg_",
25
- "@pulse": "pulse_1kq41",
26
- "_animate": "__animate_1kq41_gg_",
27
- "_semi": "__semi_1kq41_gg_"
14
+ "__SLineGauge": "___SLineGauge_1yj1g_gg_",
15
+ "_loading": "__loading_1yj1g_gg_",
16
+ "__SDonutContainer": "___SDonutContainer_1yj1g_gg_",
17
+ "__STrendLine": "___STrendLine_1yj1g_gg_",
18
+ "__STrendBar": "___STrendBar_1yj1g_gg_",
19
+ "@pulse": "pulse_1yj1g",
20
+ "_animate": "__animate_1yj1g_gg_",
21
+ "_semi": "__semi_1yj1g_gg_"
28
22
  });
29
23
  import { ScoreDonutUtils } from '../../utils/ScoreDonutUtils';
30
- var DonutRoot = /*#__PURE__*/function (_Component) {
31
- function DonutRoot() {
32
- _classCallCheck(this, DonutRoot);
33
- return _callSuper(this, DonutRoot, arguments);
34
- }
35
- _inherits(DonutRoot, _Component);
36
- return _createClass(DonutRoot, [{
37
- key: "render",
38
- value: function render() {
39
- var _ref = this.asProps,
40
- _ref2;
41
- var SDonutContainer = Box;
42
- var _this$asProps = this.asProps,
43
- value = _this$asProps.value,
44
- styles = _this$asProps.styles,
45
- _this$asProps$baseBgC = _this$asProps.baseBgColor,
46
- baseBgColor = _this$asProps$baseBgC === void 0 ? 'chart-grid-bar-chart-base-bg' : _this$asProps$baseBgC,
47
- _this$asProps$color = _this$asProps.color,
48
- color = _this$asProps$color === void 0 ? 'chart-palette-order-1' : _this$asProps$color,
49
- resolveColor = _this$asProps.resolveColor,
50
- isSemiDonut = _this$asProps.isSemiDonut,
51
- loading = _this$asProps.loading,
52
- animate = _this$asProps.animate,
53
- duration = _this$asProps.duration;
54
- var scoreDonut = new ScoreDonutUtils(value, isSemiDonut);
55
- var _extractAriaProps = extractAriaProps(this.asProps),
56
- __excludeProps = _extractAriaProps.__excludeProps,
57
- extractedAriaProps = _extractAriaProps.extractedAriaProps;
58
- return _ref2 = sstyled(styles), /*#__PURE__*/React.createElement(SDonutContainer, _ref2.cn("SDonutContainer", _objectSpread({}, _assignProps({
24
+ class DonutRoot extends Component {
25
+ render() {
26
+ var _ref = this.asProps,
27
+ _ref2;
28
+ const SDonutContainer = Box;
29
+ const {
30
+ value,
31
+ styles,
32
+ baseBgColor = 'chart-grid-bar-chart-base-bg',
33
+ color = 'chart-palette-order-1',
34
+ resolveColor,
35
+ isSemiDonut,
36
+ loading,
37
+ animate,
38
+ duration
39
+ } = this.asProps;
40
+ const scoreDonut = new ScoreDonutUtils(value, isSemiDonut);
41
+ const {
42
+ __excludeProps,
43
+ extractedAriaProps
44
+ } = extractAriaProps(this.asProps);
45
+ return _ref2 = sstyled(styles), /*#__PURE__*/React.createElement(SDonutContainer, _ref2.cn("SDonutContainer", {
46
+ ..._assignProps({
59
47
  "semi": isSemiDonut,
60
48
  "__excludeProps": __excludeProps
61
- }, _ref))), /*#__PURE__*/React.createElement("svg", _ref2.cn("svg", _objectSpread({
62
- "width": '100%',
63
- "height": '100%',
64
- "viewBox": scoreDonut.viewBox,
65
- "fill": 'none',
66
- "role": 'img'
67
- }, extractedAriaProps)), /*#__PURE__*/React.createElement("g", _ref2.cn("g", {}), /*#__PURE__*/React.createElement("circle", _ref2.cn("circle", {
68
- "cx": '12',
69
- "cy": '12',
70
- "r": scoreDonut.radius,
71
- "strokeWidth": scoreDonut.strokeWidth,
72
- "stroke": resolveColor(baseBgColor),
73
- "strokeDasharray": loading ? undefined : "".concat(scoreDonut.baseLength, " ").concat(scoreDonut.fullLength),
74
- "strokeDashoffset": scoreDonut.baseOffset
75
- }), animate && value > 0 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("animate", _ref2.cn("animate", {
76
- "attributeName": 'stroke-dasharray',
77
- "from": "".concat(scoreDonut.animatedBaseLengthFrom, " ").concat(scoreDonut.fullLength),
78
- "to": "".concat(scoreDonut.animatedBaseLengthTo, " ").concat(scoreDonut.fullLength),
79
- "dur": duration + 'ms'
80
- })), /*#__PURE__*/React.createElement("animate", _ref2.cn("animate", {
81
- "attributeName": 'stroke-dashoffset',
82
- "from": -1 * scoreDonut.startMargin,
83
- "to": scoreDonut.baseOffset,
84
- "dur": duration + 'ms'
85
- })))), !loading && value > 0 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("circle", _ref2.cn("circle", {
86
- "cx": '12',
87
- "cy": '12',
88
- "r": scoreDonut.radius,
89
- "strokeWidth": scoreDonut.strokeWidth,
90
- "stroke": resolveColor(color),
91
- "strokeDasharray": "".concat(scoreDonut.valueLength, " ").concat(scoreDonut.fullLength)
92
- }), animate && /*#__PURE__*/React.createElement("animate", _ref2.cn("animate", {
93
- "attributeName": 'stroke-dasharray',
94
- "from": "0 ".concat(scoreDonut.fullLength),
95
- "to": "".concat(scoreDonut.valueLength, " ").concat(scoreDonut.fullLength),
96
- "dur": duration + 'ms'
97
- })))))));
98
- }
99
- }]);
100
- }(Component);
49
+ }, _ref)
50
+ }), /*#__PURE__*/React.createElement("svg", _ref2.cn("svg", {
51
+ "width": '100%',
52
+ "height": '100%',
53
+ "viewBox": scoreDonut.viewBox,
54
+ "fill": 'none',
55
+ "role": 'img',
56
+ ...extractedAriaProps
57
+ }), /*#__PURE__*/React.createElement("g", _ref2.cn("g", {}), /*#__PURE__*/React.createElement("circle", _ref2.cn("circle", {
58
+ "cx": '12',
59
+ "cy": '12',
60
+ "r": scoreDonut.radius,
61
+ "strokeWidth": scoreDonut.strokeWidth,
62
+ "stroke": resolveColor(baseBgColor),
63
+ "strokeDasharray": loading ? undefined : `${scoreDonut.baseLength} ${scoreDonut.fullLength}`,
64
+ "strokeDashoffset": scoreDonut.baseOffset
65
+ }), animate && value > 0 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("animate", _ref2.cn("animate", {
66
+ "attributeName": 'stroke-dasharray',
67
+ "from": `${scoreDonut.animatedBaseLengthFrom} ${scoreDonut.fullLength}`,
68
+ "to": `${scoreDonut.animatedBaseLengthTo} ${scoreDonut.fullLength}`,
69
+ "dur": duration + 'ms'
70
+ })), /*#__PURE__*/React.createElement("animate", _ref2.cn("animate", {
71
+ "attributeName": 'stroke-dashoffset',
72
+ "from": -1 * scoreDonut.startMargin,
73
+ "to": scoreDonut.baseOffset,
74
+ "dur": duration + 'ms'
75
+ })))), !loading && value > 0 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("circle", _ref2.cn("circle", {
76
+ "cx": '12',
77
+ "cy": '12',
78
+ "r": scoreDonut.radius,
79
+ "strokeWidth": scoreDonut.strokeWidth,
80
+ "stroke": resolveColor(color),
81
+ "strokeDasharray": `${scoreDonut.valueLength} ${scoreDonut.fullLength}`
82
+ }), animate && /*#__PURE__*/React.createElement("animate", _ref2.cn("animate", {
83
+ "attributeName": 'stroke-dasharray',
84
+ "from": `0 ${scoreDonut.fullLength}`,
85
+ "to": `${scoreDonut.valueLength} ${scoreDonut.fullLength}`,
86
+ "dur": duration + 'ms'
87
+ })))))));
88
+ }
89
+ }
101
90
  _defineProperty(DonutRoot, "enhance", [cssVariableEnhance({
102
91
  variable: '--intergalactic-duration-extra-slow',
103
92
  fallback: '500',
104
- map: function map(v) {
105
- return Number.parseInt(v, 10).toString();
106
- },
93
+ map: v => Number.parseInt(v, 10).toString(),
107
94
  prop: 'duration'
108
95
  }), resolveColorEnhance()]);
109
96
  _defineProperty(DonutRoot, "style", style);
110
97
  _defineProperty(DonutRoot, "defaultProps", {
111
98
  animate: true
112
99
  });
113
- export var ScoreDonut = createComponent(DonutRoot);
100
+ export const ScoreDonut = createComponent(DonutRoot);
114
101
  ScoreDonut.displayName = 'MiniChart.ScoreDonut';
115
- export var ScoreSemiDonut = createComponent(DonutRoot, {}, {
116
- enhancements: [function () {
102
+ export const ScoreSemiDonut = createComponent(DonutRoot, {}, {
103
+ enhancements: [() => {
117
104
  return {
118
- wrapperProps: function wrapperProps(props) {
105
+ wrapperProps: props => {
119
106
  return assignProps(props, {
120
107
  isSemiDonut: true
121
108
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Donut.js","names":["createComponent","Component","Root","sstyled","assignProps","extractAriaProps","resolveColorEnhance","cssVariableEnhance","Box","React","style","_sstyled","insert","ScoreDonutUtils","DonutRoot","_Component","_classCallCheck","_callSuper","arguments","_inherits","_createClass","key","value","render","_ref","asProps","_ref2","SDonutContainer","_this$asProps","styles","_this$asProps$baseBgC","baseBgColor","_this$asProps$color","color","resolveColor","isSemiDonut","loading","animate","duration","scoreDonut","_extractAriaProps","__excludeProps","extractedAriaProps","createElement","cn","_objectSpread","_assignProps","viewBox","radius","strokeWidth","undefined","concat","baseLength","fullLength","baseOffset","Fragment","animatedBaseLengthFrom","animatedBaseLengthTo","startMargin","valueLength","_defineProperty","variable","fallback","map","v","Number","parseInt","toString","prop","ScoreDonut","displayName","ScoreSemiDonut","enhancements","wrapperProps","props"],"sources":["../../../../src/component/score/Donut.tsx"],"sourcesContent":["import { createComponent, Component, Root, sstyled, type ComponentType } from '@semcore/core';\nimport { assignProps } from '@semcore/core';\nimport { extractAriaProps } from '@semcore/core/lib/utils/ariaProps';\nimport resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';\nimport { cssVariableEnhance } from '@semcore/core/lib/utils/useCssVariable';\nimport { Box, type BoxProps } from '@semcore/flex-box';\nimport React from 'react';\n\nimport style from './donut.shadow.css';\nimport type { CommonScoreProps } from './Score';\nimport { ScoreDonutUtils } from '../../utils/ScoreDonutUtils';\n\nexport type ScoreDonutProps = BoxProps & CommonScoreProps;\n\ntype Enhances = {\n resolveColor: ReturnType<typeof resolveColorEnhance>;\n duration: ReturnType<typeof cssVariableEnhance>;\n isSemiDonut?: true;\n};\n\nclass DonutRoot extends Component<ScoreDonutProps, {}, {}, typeof DonutRoot.enhance> {\n static enhance = [\n cssVariableEnhance({\n variable: '--intergalactic-duration-extra-slow',\n fallback: '500',\n map: (v: string) => Number.parseInt(v, 10).toString(),\n prop: 'duration',\n }),\n resolveColorEnhance(),\n ] as const;\n\n static style = style;\n\n static defaultProps = {\n animate: true,\n };\n\n render() {\n const SDonutContainer = Root;\n const {\n value,\n styles,\n baseBgColor = 'chart-grid-bar-chart-base-bg',\n color = 'chart-palette-order-1',\n resolveColor,\n isSemiDonut,\n loading,\n animate,\n duration,\n } = this.asProps;\n\n const scoreDonut = new ScoreDonutUtils(value, isSemiDonut);\n const { __excludeProps, extractedAriaProps } = extractAriaProps(this.asProps);\n\n return sstyled(styles)(\n <SDonutContainer render={Box} semi={isSemiDonut} __excludeProps={__excludeProps}>\n <svg\n width='100%'\n height='100%'\n viewBox={scoreDonut.viewBox}\n fill='none'\n role='img'\n {...extractedAriaProps}\n >\n <g>\n <circle\n cx='12'\n cy='12'\n r={scoreDonut.radius}\n strokeWidth={scoreDonut.strokeWidth}\n stroke={resolveColor(baseBgColor)}\n strokeDasharray={\n loading\n ? undefined\n : `${scoreDonut.baseLength} ${scoreDonut.fullLength}`\n }\n strokeDashoffset={scoreDonut.baseOffset}\n >\n {animate && value > 0 && (\n <>\n <animate\n attributeName='stroke-dasharray'\n from={`${scoreDonut.animatedBaseLengthFrom} ${scoreDonut.fullLength}`}\n to={`${scoreDonut.animatedBaseLengthTo} ${scoreDonut.fullLength}`}\n dur={duration + 'ms'}\n />\n <animate\n attributeName='stroke-dashoffset'\n from={-1 * scoreDonut.startMargin}\n to={scoreDonut.baseOffset}\n dur={duration + 'ms'}\n />\n </>\n )}\n </circle>\n {!loading && value > 0 && (\n <>\n <circle\n cx='12'\n cy='12'\n r={scoreDonut.radius}\n strokeWidth={scoreDonut.strokeWidth}\n stroke={resolveColor(color)}\n strokeDasharray={`${scoreDonut.valueLength} ${scoreDonut.fullLength}`}\n >\n {animate && (\n <animate\n attributeName='stroke-dasharray'\n from={`0 ${scoreDonut.fullLength}`}\n to={`${scoreDonut.valueLength} ${scoreDonut.fullLength}`}\n dur={duration + 'ms'}\n />\n )}\n </circle>\n </>\n )}\n </g>\n </svg>\n </SDonutContainer>,\n );\n }\n}\n\nexport const ScoreDonut: ComponentType<ScoreDonutProps, {}, {}, Enhances> =\n createComponent(DonutRoot);\n\nScoreDonut.displayName = 'MiniChart.ScoreDonut';\n\nexport const ScoreSemiDonut: ComponentType<ScoreDonutProps, {}, {}, Enhances> = createComponent(\n DonutRoot,\n {},\n {\n enhancements: [\n () => {\n return {\n wrapperProps: (props: ScoreDonutProps) => {\n return assignProps(props, { isSemiDonut: true });\n },\n };\n },\n ],\n },\n);\n\nScoreSemiDonut.displayName = 'MiniChart.ScoreSemiDonut';\n"],"mappings":";;;;;;;;AAAA,SAASA,eAAe,EAAEC,SAAS,EAAEC,IAAI,EAAEC,OAAO,QAA4B,eAAe;AAC7F,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,gBAAgB,QAAQ,mCAAmC;AACpE,OAAOC,mBAAmB,MAAM,sDAAsD;AACtF,SAASC,kBAAkB,QAAQ,wCAAwC;AAC3E,SAASC,GAAG,QAAuB,mBAAmB;AACtD,OAAOC,KAAK,MAAM,OAAO;AAAC;AAAA,IAAAC,KAAA,8BAAAC,QAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAI1B,SAASC,eAAe,QAAQ,6BAA6B;AAAC,IAUxDC,SAAS,0BAAAC,UAAA;EAAA,SAAAD,UAAA;IAAAE,eAAA,OAAAF,SAAA;IAAA,OAAAG,UAAA,OAAAH,SAAA,EAAAI,SAAA;EAAA;EAAAC,SAAA,CAAAL,SAAA,EAAAC,UAAA;EAAA,OAAAK,YAAA,CAAAN,SAAA;IAAAO,GAAA;IAAAC,KAAA,EAiBb,SAAAC,MAAMA,CAAA,EAAG;MAAA,IAAAC,IAAA,QAAAC,OAAA;QAAAC,KAAA;MACP,IAAMC,eAAe,GAiBMnB,GAAG;MAhB9B,IAAAoB,aAAA,GAUI,IAAI,CAACH,OAAO;QATdH,KAAK,GAAAM,aAAA,CAALN,KAAK;QACLO,MAAM,GAAAD,aAAA,CAANC,MAAM;QAAAC,qBAAA,GAAAF,aAAA,CACNG,WAAW;QAAXA,WAAW,GAAAD,qBAAA,cAAG,8BAA8B,GAAAA,qBAAA;QAAAE,mBAAA,GAAAJ,aAAA,CAC5CK,KAAK;QA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U,CAACoB,WAAW,OAAAR,MAAA,CAAIZ,UAAU,CAACc,UAAU;QAAA,OACjDf,QAAQ,GAAG;MAAI,EACrB,CAEG,CACR,CAEH,CACA,CACU,CAAC;IAEtB;EAAC;AAAA,EApGqBrC,SAAS;AAAA2D,eAAA,CAA3B9C,SAAS,aACI,CACfP,kBAAkB,CAAC;EACjBsD,QAAQ,EAAE,qCAAqC;EAC/CC,QAAQ,EAAE,KAAK;EACfC,GAAG,EAAE,SAALA,GAAGA,CAAGC,CAAS;IAAA,OAAKC,MAAM,CAACC,QAAQ,CAACF,CAAC,EAAE,EAAE,CAAC,CAACG,QAAQ,CAAC,CAAC;EAAA;EACrDC,IAAI,EAAE;AACR,CAAC,CAAC,EACF9D,mBAAmB,CAAC,CAAC,CACtB;AAAAsD,eAAA,CATG9C,SAAS,WAWEJ,KAAK;AAAAkD,eAAA,CAXhB9C,SAAS,kBAaS;EACpBuB,OAAO,EAAE;AACX,CAAC;AAwFH,OAAO,IAAMgC,UAA4D,GACvErE,eAAe,CAACc,SAAS,CAAC;AAE5BuD,UAAU,CAACC,WAAW,GAAG,sBAAsB;AAE/C,OAAO,IAAMC,cAAgE,GAAGvE,eAAe,CAC7Fc,SAAS,EACT,CAAC,CAAC,EACF;EACE0D,YAAY,EAAE,CACZ,YAAM;IACJ,OAAO;MACLC,YAAY,EAAE,SAAdA,YAAYA,CAAGC,KAAsB,EAAK;QACxC,OAAOtE,WAAW,CAACsE,KAAK,EAAE;UAAEvC,WAAW,EAAE;QAAK,CAAC,CAAC;MAClD;IACF,CAAC;EACH,CAAC;AAEL,CACF,CAAC;AAEDoC,cAAc,CAACD,WAAW,GAAG,0BAA0B","ignoreList":[]}
1
+ {"version":3,"file":"Donut.js","names":["Box","createComponent","Component","Root","sstyled","assignProps","extractAriaProps","resolveColorEnhance","cssVariableEnhance","React","style","_sstyled","insert","ScoreDonutUtils","DonutRoot","render","_ref","asProps","_ref2","SDonutContainer","value","styles","baseBgColor","color","resolveColor","isSemiDonut","loading","animate","duration","scoreDonut","__excludeProps","extractedAriaProps","createElement","cn","_assignProps","viewBox","radius","strokeWidth","undefined","baseLength","fullLength","baseOffset","Fragment","animatedBaseLengthFrom","animatedBaseLengthTo","startMargin","valueLength","_defineProperty","variable","fallback","map","v","Number","parseInt","toString","prop","ScoreDonut","displayName","ScoreSemiDonut","enhancements","wrapperProps","props"],"sources":["../../../../src/component/score/Donut.tsx"],"sourcesContent":["import { Box, type BoxProps } from '@semcore/base-components';\nimport { createComponent, Component, Root, sstyled, assignProps } from '@semcore/core';\nimport { extractAriaProps } from '@semcore/core/lib/utils/ariaProps';\nimport resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';\nimport { cssVariableEnhance } from '@semcore/core/lib/utils/useCssVariable';\nimport React from 'react';\n\nimport style from './donut.shadow.css';\nimport type { CommonScoreProps } from './Score';\nimport { ScoreDonutUtils } from '../../utils/ScoreDonutUtils';\n\nexport type ScoreDonutProps = BoxProps & CommonScoreProps;\n\nclass DonutRoot extends Component<ScoreDonutProps, typeof DonutRoot.enhance> {\n static enhance = [\n cssVariableEnhance({\n variable: '--intergalactic-duration-extra-slow',\n fallback: '500',\n map: (v: string) => Number.parseInt(v, 10).toString(),\n prop: 'duration',\n }),\n resolveColorEnhance(),\n ] as const;\n\n static style = style;\n\n static defaultProps = {\n animate: true,\n };\n\n render() {\n const SDonutContainer = Root;\n const {\n value,\n styles,\n baseBgColor = 'chart-grid-bar-chart-base-bg',\n color = 'chart-palette-order-1',\n resolveColor,\n isSemiDonut,\n loading,\n animate,\n duration,\n } = this.asProps;\n\n const scoreDonut = new ScoreDonutUtils(value, isSemiDonut);\n const { __excludeProps, extractedAriaProps } = extractAriaProps(this.asProps);\n\n return sstyled(styles)(\n <SDonutContainer render={Box} semi={isSemiDonut} __excludeProps={__excludeProps}>\n <svg\n width='100%'\n height='100%'\n viewBox={scoreDonut.viewBox}\n fill='none'\n role='img'\n {...extractedAriaProps}\n >\n <g>\n <circle\n cx='12'\n cy='12'\n r={scoreDonut.radius}\n strokeWidth={scoreDonut.strokeWidth}\n stroke={resolveColor(baseBgColor)}\n strokeDasharray={\n loading\n ? undefined\n : `${scoreDonut.baseLength} ${scoreDonut.fullLength}`\n }\n strokeDashoffset={scoreDonut.baseOffset}\n >\n {animate && value > 0 && (\n <>\n <animate\n attributeName='stroke-dasharray'\n from={`${scoreDonut.animatedBaseLengthFrom} ${scoreDonut.fullLength}`}\n to={`${scoreDonut.animatedBaseLengthTo} ${scoreDonut.fullLength}`}\n dur={duration + 'ms'}\n />\n <animate\n attributeName='stroke-dashoffset'\n from={-1 * scoreDonut.startMargin}\n to={scoreDonut.baseOffset}\n dur={duration + 'ms'}\n />\n </>\n )}\n </circle>\n {!loading && value > 0 && (\n <>\n <circle\n cx='12'\n cy='12'\n r={scoreDonut.radius}\n strokeWidth={scoreDonut.strokeWidth}\n stroke={resolveColor(color)}\n strokeDasharray={`${scoreDonut.valueLength} ${scoreDonut.fullLength}`}\n >\n {animate && (\n <animate\n attributeName='stroke-dasharray'\n from={`0 ${scoreDonut.fullLength}`}\n to={`${scoreDonut.valueLength} ${scoreDonut.fullLength}`}\n dur={duration + 'ms'}\n />\n )}\n </circle>\n </>\n )}\n </g>\n </svg>\n </SDonutContainer>,\n );\n }\n}\n\nexport const ScoreDonut = createComponent<'svg', ScoreDonutProps, {}, typeof DonutRoot.enhance>(DonutRoot);\n\nScoreDonut.displayName = 'MiniChart.ScoreDonut';\n\nexport const ScoreSemiDonut = createComponent<'svg', ScoreDonutProps, {}, typeof DonutRoot.enhance>(\n DonutRoot,\n {},\n {\n enhancements: [\n () => {\n return {\n wrapperProps: (props: ScoreDonutProps) => {\n return assignProps(props, { isSemiDonut: true });\n },\n };\n },\n ],\n },\n);\n\nScoreSemiDonut.displayName = 'MiniChart.ScoreSemiDonut';\n"],"mappings":";;;AAAA,SAASA,GAAG,QAAuB,0BAA0B;AAC7D,SAASC,eAAe,EAAEC,SAAS,EAAEC,IAAI,EAAEC,O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