@semcore/mini-chart 16.0.9 → 16.1.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.
@@ -16,26 +16,26 @@ import resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEn
16
16
  import { Box, Flex } from '@semcore/flex-box';
17
17
  import React from 'react';
18
18
  /*!__reshadow-styles__:"./line.shadow.css"*/
19
- var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/"@keyframes pulse_57xz9{0%,to{opacity:1}50%{opacity:.4}}@keyframes move-line_57xz9{0%{transform:translateX(0)}to{transform:translateX(100%)}}.___SDonutContainer_57xz9_gg_.__loading_57xz9_gg_,.___SLineGauge_57xz9_gg_.__loading_57xz9_gg_,.___STrendBar_57xz9_gg_.__loading_57xz9_gg_,.___STrendLine_57xz9_gg_.__loading_57xz9_gg_{animation-name:pulse_57xz9;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SLineGauge_57xz9_gg_{height:8px;background-color:var(--base-bg-color_57xz9, var(--intergalactic-chart-grid-bar-chart-base-bg, #e0e1e9));border-radius:var(--intergalactic-chart-rounded, 2px);overflow:hidden;position:relative}.___SLineValue_57xz9_gg_{height:8px;border-radius:var(--intergalactic-chart-rounded, 2px)0 0 var(--intergalactic-chart-rounded, 2px)}.___SLineValue_57xz9_gg_.__percent_57xz9_gg_{width:var(--percent_57xz9)}.___SLineSegmentItem_57xz9_gg_.__color_57xz9_gg_,.___SLineValue_57xz9_gg_.__color_57xz9_gg_{background-color:var(--color_57xz9, var(--intergalactic-chart-palette-order-1, #2bb3ff))}.___SLineGauge_57xz9_gg_.__segments_57xz9_gg_{border-radius:var(--intergalactic-progress-bar-rounded, 6px)}.___SAnimationLine_57xz9_gg_,.___SLineGaugeSegment_57xz9_gg_{position:absolute;top:0;left:0;right:0;bottom:0}.___SLineSegmentItem_57xz9_gg_:last-child{margin-right:0;border-right:none}.___SLineSegmentItem_57xz9_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_57xz9_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_57xz9;animation-duration:.5s;animation-timing-function:ease-in-out;animation-fill-mode:forwards}", /*__inner_css_end__*/"57xz9_gg_"),
19
+ var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/"@keyframes pulse_1tspb{0%,to{opacity:1}50%{opacity:.4}}@keyframes move-line_1tspb{0%{transform:translateX(0)}to{transform:translateX(100%)}}.___SDonutContainer_1tspb_gg_.__loading_1tspb_gg_,.___SLineGauge_1tspb_gg_.__loading_1tspb_gg_,.___STrendBar_1tspb_gg_.__loading_1tspb_gg_,.___STrendLine_1tspb_gg_.__loading_1tspb_gg_{animation-name:pulse_1tspb;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SLineGauge_1tspb_gg_{height:8px;background-color:var(--base-bg-color_1tspb, var(--intergalactic-chart-grid-bar-chart-base-bg, #e0e1e9));border-radius:var(--intergalactic-chart-rounded, 2px);overflow:hidden;position:relative}.___SLineValue_1tspb_gg_{height:8px;border-radius:var(--intergalactic-chart-rounded, 2px)0 0 var(--intergalactic-chart-rounded, 2px)}.___SLineValue_1tspb_gg_.__percent_1tspb_gg_{width:var(--percent_1tspb)}.___SLineSegmentItem_1tspb_gg_.__color_1tspb_gg_,.___SLineValue_1tspb_gg_.__color_1tspb_gg_{background-color:var(--color_1tspb, var(--intergalactic-chart-palette-order-1, #2bb3ff))}.___SLineGauge_1tspb_gg_.__segments_1tspb_gg_{border-radius:var(--intergalactic-progress-bar-rounded, 6px)}.___SAnimationLine_1tspb_gg_,.___SLineGaugeSegment_1tspb_gg_{position:absolute;top:0;left:0;right:0;bottom:0}.___SLineSegmentItem_1tspb_gg_:last-child{margin-right:0;border-right:none}.___SLineSegmentItem_1tspb_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_1tspb_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_1tspb;animation-duration:.5s;animation-timing-function:ease-in-out;animation-fill-mode:forwards}", /*__inner_css_end__*/"1tspb_gg_"),
20
20
  /*__reshadow_css_end__*/
21
21
  {
22
- "__SLineGauge": "___SLineGauge_57xz9_gg_",
23
- "_loading": "__loading_57xz9_gg_",
24
- "__SDonutContainer": "___SDonutContainer_57xz9_gg_",
25
- "__STrendLine": "___STrendLine_57xz9_gg_",
26
- "__STrendBar": "___STrendBar_57xz9_gg_",
27
- "@pulse": "pulse_57xz9",
28
- "--base-bg-color": "--base-bg-color_57xz9",
29
- "__SLineValue": "___SLineValue_57xz9_gg_",
30
- "_percent": "__percent_57xz9_gg_",
31
- "--percent": "--percent_57xz9",
32
- "_color": "__color_57xz9_gg_",
33
- "__SLineSegmentItem": "___SLineSegmentItem_57xz9_gg_",
34
- "--color": "--color_57xz9",
35
- "_segments": "__segments_57xz9_gg_",
36
- "__SLineGaugeSegment": "___SLineGaugeSegment_57xz9_gg_",
37
- "__SAnimationLine": "___SAnimationLine_57xz9_gg_",
38
- "@move-line": "move-line_57xz9"
22
+ "__SLineGauge": "___SLineGauge_1tspb_gg_",
23
+ "_loading": "__loading_1tspb_gg_",
24
+ "__SDonutContainer": "___SDonutContainer_1tspb_gg_",
25
+ "__STrendLine": "___STrendLine_1tspb_gg_",
26
+ "__STrendBar": "___STrendBar_1tspb_gg_",
27
+ "@pulse": "pulse_1tspb",
28
+ "--base-bg-color": "--base-bg-color_1tspb",
29
+ "__SLineValue": "___SLineValue_1tspb_gg_",
30
+ "_percent": "__percent_1tspb_gg_",
31
+ "--percent": "--percent_1tspb",
32
+ "_color": "__color_1tspb_gg_",
33
+ "__SLineSegmentItem": "___SLineSegmentItem_1tspb_gg_",
34
+ "--color": "--color_1tspb",
35
+ "_segments": "__segments_1tspb_gg_",
36
+ "__SLineGaugeSegment": "___SLineGaugeSegment_1tspb_gg_",
37
+ "__SAnimationLine": "___SAnimationLine_1tspb_gg_",
38
+ "@move-line": "move-line_1tspb"
39
39
  });
40
40
  var LineRoot = /*#__PURE__*/function (_Component) {
41
41
  function LineRoot() {
@@ -17,15 +17,15 @@ import { Box } from '@semcore/flex-box';
17
17
  import React from 'react';
18
18
  import { Trend } from './Trend';
19
19
  /*!__reshadow-styles__:"../skeleton/skeleton.shadow.css"*/
20
- var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/"@keyframes pulse_1d47w{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_1d47w_gg_.__loading_1d47w_gg_,.___SLineGauge_1d47w_gg_.__loading_1d47w_gg_,.___STrendBar_1d47w_gg_.__loading_1d47w_gg_,.___STrendLine_1d47w_gg_.__loading_1d47w_gg_{animation-name:pulse_1d47w;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}", /*__inner_css_end__*/"1d47w_gg_"),
20
+ var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/"@keyframes pulse_1rcp7{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_1rcp7_gg_.__loading_1rcp7_gg_,.___SLineGauge_1rcp7_gg_.__loading_1rcp7_gg_,.___STrendBar_1rcp7_gg_.__loading_1rcp7_gg_,.___STrendLine_1rcp7_gg_.__loading_1rcp7_gg_{animation-name:pulse_1rcp7;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}", /*__inner_css_end__*/"1rcp7_gg_"),
21
21
  /*__reshadow_css_end__*/
22
22
  {
23
- "__SLineGauge": "___SLineGauge_1d47w_gg_",
24
- "_loading": "__loading_1d47w_gg_",
25
- "__SDonutContainer": "___SDonutContainer_1d47w_gg_",
26
- "__STrendLine": "___STrendLine_1d47w_gg_",
27
- "__STrendBar": "___STrendBar_1d47w_gg_",
28
- "@pulse": "pulse_1d47w"
23
+ "__SLineGauge": "___SLineGauge_1rcp7_gg_",
24
+ "_loading": "__loading_1rcp7_gg_",
25
+ "__SDonutContainer": "___SDonutContainer_1rcp7_gg_",
26
+ "__STrendLine": "___STrendLine_1rcp7_gg_",
27
+ "__STrendBar": "___STrendBar_1rcp7_gg_",
28
+ "@pulse": "pulse_1rcp7"
29
29
  });
30
30
  var TrendBarRoot = /*#__PURE__*/function (_Trend) {
31
31
  function TrendBarRoot() {
@@ -18,15 +18,15 @@ import { Box } from '@semcore/flex-box';
18
18
  import React from 'react';
19
19
  import { Trend } from './Trend';
20
20
  /*!__reshadow-styles__:"../skeleton/skeleton.shadow.css"*/
21
- var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/"@keyframes pulse_1d47w{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_1d47w_gg_.__loading_1d47w_gg_,.___SLineGauge_1d47w_gg_.__loading_1d47w_gg_,.___STrendBar_1d47w_gg_.__loading_1d47w_gg_,.___STrendLine_1d47w_gg_.__loading_1d47w_gg_{animation-name:pulse_1d47w;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}", /*__inner_css_end__*/"1d47w_gg_"),
21
+ var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/"@keyframes pulse_1rcp7{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_1rcp7_gg_.__loading_1rcp7_gg_,.___SLineGauge_1rcp7_gg_.__loading_1rcp7_gg_,.___STrendBar_1rcp7_gg_.__loading_1rcp7_gg_,.___STrendLine_1rcp7_gg_.__loading_1rcp7_gg_{animation-name:pulse_1rcp7;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}", /*__inner_css_end__*/"1rcp7_gg_"),
22
22
  /*__reshadow_css_end__*/
23
23
  {
24
- "__SLineGauge": "___SLineGauge_1d47w_gg_",
25
- "_loading": "__loading_1d47w_gg_",
26
- "__SDonutContainer": "___SDonutContainer_1d47w_gg_",
27
- "__STrendLine": "___STrendLine_1d47w_gg_",
28
- "__STrendBar": "___STrendBar_1d47w_gg_",
29
- "@pulse": "pulse_1d47w"
24
+ "__SLineGauge": "___SLineGauge_1rcp7_gg_",
25
+ "_loading": "__loading_1rcp7_gg_",
26
+ "__SDonutContainer": "___SDonutContainer_1rcp7_gg_",
27
+ "__STrendLine": "___STrendLine_1rcp7_gg_",
28
+ "__STrendBar": "___STrendBar_1rcp7_gg_",
29
+ "@pulse": "pulse_1rcp7"
30
30
  });
31
31
  var TrendLineRoot = /*#__PURE__*/function (_Trend) {
32
32
  function TrendLineRoot() {
@@ -9,14 +9,9 @@ export var ScoreDonutUtils = /*#__PURE__*/function () {
9
9
  _defineProperty(this, "radius", void 0);
10
10
  this.isSemiDonut = isSemiDonut;
11
11
  this.radius = isSemiDonut ? 9 : 10;
12
- this.value = value;
12
+ this.value = Math.max(Math.min(value, 100), 0);
13
13
  }
14
14
  return _createClass(ScoreDonutUtils, [{
15
- key: "hasDivider",
16
- get: function get() {
17
- return ![0, 100].includes(this.value);
18
- }
19
- }, {
20
15
  key: "viewBox",
21
16
  get: function get() {
22
17
  return this.isSemiDonut ? '0 0 24 12' : '0 0 24 24';
@@ -27,45 +22,58 @@ export var ScoreDonutUtils = /*#__PURE__*/function () {
27
22
  return this.isSemiDonut ? 6 : 4;
28
23
  }
29
24
  }, {
30
- key: "baseStrokeDashArray",
25
+ key: "fullLength",
31
26
  get: function get() {
32
27
  return this.isSemiDonut ? Math.PI * this.radius : 2 * Math.PI * this.radius;
33
28
  }
34
29
  }, {
35
- key: "valueStrokeDashArray",
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",
36
53
  get: function get() {
37
- return this.baseStrokeDashArray * (this.value / 100);
54
+ var margin = 0;
55
+ if (!this.isSemiDonut && this.value > 0) margin = this.point;
56
+ return margin;
38
57
  }
39
58
  }, {
40
- key: "greyStrokeDashArray",
59
+ key: "baseOffset",
41
60
  get: function get() {
42
- return this.baseStrokeDashArray - this.valueStrokeDashArray;
61
+ return -1 * (this.valueLength + this.startMargin);
43
62
  }
44
63
  }, {
45
- key: "offsetPoint",
64
+ key: "baseLength",
46
65
  get: function get() {
47
- return this.isSemiDonut ? this.baseStrokeDashArray / (100 / 3) : this.baseStrokeDashArray / 100;
66
+ return Math.max(this.fullLength - this.valueLength - this.startMargin - this.endMargin, 0);
48
67
  }
49
68
  }, {
50
- key: "strokeDashArrayParts",
69
+ key: "animatedBaseLengthFrom",
51
70
  get: function get() {
52
- var greyStroke = this.greyStrokeDashArray;
53
- var offsetPoint = this.offsetPoint;
54
- var greyStrokeDash = greyStroke - 2 * offsetPoint;
55
- var strokeDashArrayBetweenSpaces = "".concat(greyStrokeDash, " ").concat(offsetPoint);
56
- if (this.isSemiDonut) {
57
- return "".concat(offsetPoint, " ").concat(this.value < 95 ? strokeDashArrayBetweenSpaces : '', " ").concat(this.baseStrokeDashArray);
58
- }
59
- return "".concat(offsetPoint, " ").concat(greyStrokeDash >= 0 ? strokeDashArrayBetweenSpaces : '', " ").concat(this.baseStrokeDashArray);
71
+ return this.fullLength - this.startMargin - this.endMargin;
60
72
  }
61
73
  }, {
62
- key: "strokeDashOffsetBase",
74
+ key: "animatedBaseLengthTo",
63
75
  get: function get() {
64
- var hasDivider = this.hasDivider;
65
- if (!hasDivider) return 0;
66
- var valueStroke = this.valueStrokeDashArray;
67
- var offsetPoint = this.offsetPoint;
68
- return -1 * (valueStroke + (this.isSemiDonut ? offsetPoint : 0));
76
+ return this.fullLength - this.valueLength - this.startMargin - this.endMargin;
69
77
  }
70
78
  }]);
71
79
  }();
@@ -1 +1 @@
1
- {"version":3,"file":"ScoreDonutUtils.js","names":["ScoreDonutUtils","value","isSemiDonut","_classCallCheck","_defineProperty","radius","_createClass","key","get","includes","Math","PI","baseStrokeDashArray","valueStrokeDashArray","greyStroke","greyStrokeDashArray","offsetPoint","greyStrokeDash","strokeDashArrayBetweenSpaces","concat","hasDivider","valueStroke"],"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 = value;\n }\n\n public get hasDivider() {\n return ![0, 100].includes(this.value);\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 baseStrokeDashArray() {\n return this.isSemiDonut ? Math.PI * this.radius : 2 * Math.PI * this.radius;\n }\n\n public get valueStrokeDashArray() {\n return this.baseStrokeDashArray * (this.value / 100);\n }\n\n public get greyStrokeDashArray() {\n return this.baseStrokeDashArray - this.valueStrokeDashArray;\n }\n\n public get offsetPoint() {\n return this.isSemiDonut ? this.baseStrokeDashArray / (100 / 3) : this.baseStrokeDashArray / 100;\n }\n\n public get strokeDashArrayParts() {\n const greyStroke = this.greyStrokeDashArray;\n const offsetPoint = this.offsetPoint;\n\n const greyStrokeDash = greyStroke - 2 * offsetPoint;\n const strokeDashArrayBetweenSpaces = `${greyStrokeDash} ${offsetPoint}`;\n\n if (this.isSemiDonut) {\n return `${offsetPoint} ${this.value < 95 ? strokeDashArrayBetweenSpaces : ''} ${this.baseStrokeDashArray}`;\n }\n\n return `${offsetPoint} ${greyStrokeDash >= 0 ? strokeDashArrayBetweenSpaces : ''} ${this.baseStrokeDashArray}`;\n }\n\n public get strokeDashOffsetBase() {\n const hasDivider = this.hasDivider;\n\n if (!hasDivider) return 0;\n\n const valueStroke = this.valueStrokeDashArray;\n const offsetPoint = this.offsetPoint;\n\n return -1 * (valueStroke + (this.isSemiDonut ? offsetPoint : 0));\n };\n}\n"],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"file":"ScoreDonutUtils.js","names":["ScoreDonutUtils","value","isSemiDonut","_classCallCheck","_defineProperty","radius","Math","max","min","_createClass","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":"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","ignoreList":[]}
@@ -9,6 +9,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
9
  import { createComponent, sstyled, assignProps, Component } from "@semcore/core";
10
10
  import { extractAriaProps } from "@semcore/core/lib/utils/ariaProps";
11
11
  import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
12
+ import { cssVariableEnhance } from "@semcore/core/lib/utils/useCssVariable";
12
13
  import { Box } from "@semcore/flex-box";
13
14
  import React from "react";
14
15
  import { ScoreDonutUtils } from "../../utils/ScoreDonutUtils.mjs";
@@ -20,19 +21,19 @@ var style = (
20
21
  /*__reshadow_css_start__*/
21
22
  (sstyled.insert(
22
23
  /*__inner_css_start__*/
23
- "@keyframes pulse_14jjd{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_14jjd_gg_.__loading_14jjd_gg_,.___SLineGauge_14jjd_gg_.__loading_14jjd_gg_,.___STrendBar_14jjd_gg_.__loading_14jjd_gg_,.___STrendLine_14jjd_gg_.__loading_14jjd_gg_{animation-name:pulse_14jjd;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SDonutContainer_14jjd_gg_.__semi_14jjd_gg_ g{transform:rotate(180deg) translate(-24px,-24px)}.___SDonutContainer_14jjd_gg_ g{transform:rotate(-90deg) translate(-24px)}.___SDonutContainer_14jjd_gg_.__animate_14jjd_gg_ circle{transition:all var(--intergalactic-duration-extra-slow, 500) ease-in-out}",
24
+ "@keyframes pulse_19y2a{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_19y2a_gg_.__loading_19y2a_gg_,.___SLineGauge_19y2a_gg_.__loading_19y2a_gg_,.___STrendBar_19y2a_gg_.__loading_19y2a_gg_,.___STrendLine_19y2a_gg_.__loading_19y2a_gg_{animation-name:pulse_19y2a;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SDonutContainer_19y2a_gg_.__semi_19y2a_gg_ g{transform:rotate(180deg) translate(-24px,-24px)}.___SDonutContainer_19y2a_gg_ g{transform:rotate(-90deg) translate(-24px)}.___SDonutContainer_19y2a_gg_.__animate_19y2a_gg_ circle{transition:all var(--intergalactic-duration-extra-slow, 500) ease-in-out}",
24
25
  /*__inner_css_end__*/
25
- "14jjd_gg_"
26
+ "19y2a_gg_"
26
27
  ), /*__reshadow_css_end__*/
27
28
  {
28
- "__SLineGauge": "___SLineGauge_14jjd_gg_",
29
- "_loading": "__loading_14jjd_gg_",
30
- "__SDonutContainer": "___SDonutContainer_14jjd_gg_",
31
- "__STrendLine": "___STrendLine_14jjd_gg_",
32
- "__STrendBar": "___STrendBar_14jjd_gg_",
33
- "@pulse": "pulse_14jjd",
34
- "_animate": "__animate_14jjd_gg_",
35
- "_semi": "__semi_14jjd_gg_"
29
+ "__SLineGauge": "___SLineGauge_19y2a_gg_",
30
+ "_loading": "__loading_19y2a_gg_",
31
+ "__SDonutContainer": "___SDonutContainer_19y2a_gg_",
32
+ "__STrendLine": "___STrendLine_19y2a_gg_",
33
+ "__STrendBar": "___STrendBar_19y2a_gg_",
34
+ "@pulse": "pulse_19y2a",
35
+ "_animate": "__animate_19y2a_gg_",
36
+ "_semi": "__semi_19y2a_gg_"
36
37
  })
37
38
  );
38
39
  var DonutRoot = /* @__PURE__ */ function(_Component) {
@@ -46,7 +47,7 @@ var DonutRoot = /* @__PURE__ */ function(_Component) {
46
47
  value: function render() {
47
48
  var _ref = this.asProps, _ref2;
48
49
  var SDonutContainer = Box;
49
- 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;
50
+ 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, animate = _this$asProps.animate, duration = _this$asProps.duration;
50
51
  var scoreDonut = new ScoreDonutUtils(value, isSemiDonut);
51
52
  var _extractAriaProps = extractAriaProps(this.asProps), __excludeProps = _extractAriaProps.__excludeProps, extractedAriaProps = _extractAriaProps.extractedAriaProps;
52
53
  return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(SDonutContainer, _ref2.cn("SDonutContainer", _objectSpread({}, assignProps({
@@ -64,32 +65,42 @@ var DonutRoot = /* @__PURE__ */ function(_Component) {
64
65
  "r": scoreDonut.radius,
65
66
  "strokeWidth": scoreDonut.strokeWidth,
66
67
  "stroke": resolveColor(baseBgColor),
67
- "strokeDasharray": loading ? void 0 : "".concat(scoreDonut.greyStrokeDashArray, " ").concat(scoreDonut.baseStrokeDashArray),
68
- "strokeDashoffset": scoreDonut.strokeDashOffsetBase
69
- })), !loading && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("circle", _ref2.cn("circle", {
70
- "cx": "12",
71
- "cy": "12",
72
- "r": scoreDonut.radius,
73
- "strokeWidth": scoreDonut.strokeWidth,
74
- "stroke": resolveColor(color),
75
- "strokeDasharray": "".concat(scoreDonut.valueStrokeDashArray, " ").concat(scoreDonut.baseStrokeDashArray),
76
- "strokeDashoffset": scoreDonut.valueStrokeDashArray
77
- }), /* @__PURE__ */ React.createElement("animate", _ref2.cn("animate", {
68
+ "strokeDasharray": loading ? void 0 : "".concat(scoreDonut.baseLength, " ").concat(scoreDonut.fullLength),
69
+ "strokeDashoffset": scoreDonut.baseOffset
70
+ }), animate && value > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("animate", _ref2.cn("animate", {
71
+ "attributeName": "stroke-dasharray",
72
+ "from": "".concat(scoreDonut.animatedBaseLengthFrom, " ").concat(scoreDonut.fullLength),
73
+ "to": "".concat(scoreDonut.animatedBaseLengthTo, " ").concat(scoreDonut.fullLength),
74
+ "dur": duration + "ms"
75
+ })), /* @__PURE__ */ React.createElement("animate", _ref2.cn("animate", {
78
76
  "attributeName": "stroke-dashoffset",
79
- "values": "0;".concat(scoreDonut.valueStrokeDashArray)
80
- }))), scoreDonut.hasDivider && !isSemiDonut && /* @__PURE__ */ React.createElement("circle", _ref2.cn("circle", {
77
+ "from": -1 * scoreDonut.startMargin,
78
+ "to": scoreDonut.baseOffset,
79
+ "dur": duration + "ms"
80
+ })))), !loading && value > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("circle", _ref2.cn("circle", {
81
81
  "cx": "12",
82
82
  "cy": "12",
83
83
  "r": scoreDonut.radius,
84
84
  "strokeWidth": scoreDonut.strokeWidth,
85
- "stroke": resolveColor("chart-grid-border"),
86
- "strokeDasharray": scoreDonut.strokeDashArrayParts,
87
- "strokeDashoffset": -1 * scoreDonut.valueStrokeDashArray
88
- }))))));
85
+ "stroke": resolveColor(color),
86
+ "strokeDasharray": "".concat(scoreDonut.valueLength, " ").concat(scoreDonut.fullLength)
87
+ }), animate && /* @__PURE__ */ React.createElement("animate", _ref2.cn("animate", {
88
+ "attributeName": "stroke-dasharray",
89
+ "from": "0 ".concat(scoreDonut.fullLength),
90
+ "to": "".concat(scoreDonut.valueLength, " ").concat(scoreDonut.fullLength),
91
+ "dur": duration + "ms"
92
+ })))))));
89
93
  }
90
94
  }]);
91
95
  }(Component);
92
- _defineProperty(DonutRoot, "enhance", [resolveColorEnhance()]);
96
+ _defineProperty(DonutRoot, "enhance", [cssVariableEnhance({
97
+ variable: "--intergalactic-duration-extra-slow",
98
+ fallback: "500",
99
+ map: function map(v) {
100
+ return Number.parseInt(v, 10).toString();
101
+ },
102
+ prop: "duration"
103
+ }), resolveColorEnhance()]);
93
104
  _defineProperty(DonutRoot, "style", style);
94
105
  _defineProperty(DonutRoot, "defaultProps", {
95
106
  animate: true
@@ -18,28 +18,28 @@ var style = (
18
18
  /*__reshadow_css_start__*/
19
19
  (sstyled.insert(
20
20
  /*__inner_css_start__*/
21
- "@keyframes pulse_57xz9{0%,to{opacity:1}50%{opacity:.4}}@keyframes move-line_57xz9{0%{transform:translateX(0)}to{transform:translateX(100%)}}.___SDonutContainer_57xz9_gg_.__loading_57xz9_gg_,.___SLineGauge_57xz9_gg_.__loading_57xz9_gg_,.___STrendBar_57xz9_gg_.__loading_57xz9_gg_,.___STrendLine_57xz9_gg_.__loading_57xz9_gg_{animation-name:pulse_57xz9;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SLineGauge_57xz9_gg_{height:8px;background-color:var(--base-bg-color_57xz9, var(--intergalactic-chart-grid-bar-chart-base-bg, #e0e1e9));border-radius:var(--intergalactic-chart-rounded, 2px);overflow:hidden;position:relative}.___SLineValue_57xz9_gg_{height:8px;border-radius:var(--intergalactic-chart-rounded, 2px)0 0 var(--intergalactic-chart-rounded, 2px)}.___SLineValue_57xz9_gg_.__percent_57xz9_gg_{width:var(--percent_57xz9)}.___SLineSegmentItem_57xz9_gg_.__color_57xz9_gg_,.___SLineValue_57xz9_gg_.__color_57xz9_gg_{background-color:var(--color_57xz9, var(--intergalactic-chart-palette-order-1, #2bb3ff))}.___SLineGauge_57xz9_gg_.__segments_57xz9_gg_{border-radius:var(--intergalactic-progress-bar-rounded, 6px)}.___SAnimationLine_57xz9_gg_,.___SLineGaugeSegment_57xz9_gg_{position:absolute;top:0;left:0;right:0;bottom:0}.___SLineSegmentItem_57xz9_gg_:last-child{margin-right:0;border-right:none}.___SLineSegmentItem_57xz9_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_57xz9_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_57xz9;animation-duration:.5s;animation-timing-function:ease-in-out;animation-fill-mode:forwards}",
21
+ "@keyframes pulse_1tspb{0%,to{opacity:1}50%{opacity:.4}}@keyframes move-line_1tspb{0%{transform:translateX(0)}to{transform:translateX(100%)}}.___SDonutContainer_1tspb_gg_.__loading_1tspb_gg_,.___SLineGauge_1tspb_gg_.__loading_1tspb_gg_,.___STrendBar_1tspb_gg_.__loading_1tspb_gg_,.___STrendLine_1tspb_gg_.__loading_1tspb_gg_{animation-name:pulse_1tspb;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SLineGauge_1tspb_gg_{height:8px;background-color:var(--base-bg-color_1tspb, var(--intergalactic-chart-grid-bar-chart-base-bg, #e0e1e9));border-radius:var(--intergalactic-chart-rounded, 2px);overflow:hidden;position:relative}.___SLineValue_1tspb_gg_{height:8px;border-radius:var(--intergalactic-chart-rounded, 2px)0 0 var(--intergalactic-chart-rounded, 2px)}.___SLineValue_1tspb_gg_.__percent_1tspb_gg_{width:var(--percent_1tspb)}.___SLineSegmentItem_1tspb_gg_.__color_1tspb_gg_,.___SLineValue_1tspb_gg_.__color_1tspb_gg_{background-color:var(--color_1tspb, var(--intergalactic-chart-palette-order-1, #2bb3ff))}.___SLineGauge_1tspb_gg_.__segments_1tspb_gg_{border-radius:var(--intergalactic-progress-bar-rounded, 6px)}.___SAnimationLine_1tspb_gg_,.___SLineGaugeSegment_1tspb_gg_{position:absolute;top:0;left:0;right:0;bottom:0}.___SLineSegmentItem_1tspb_gg_:last-child{margin-right:0;border-right:none}.___SLineSegmentItem_1tspb_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_1tspb_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_1tspb;animation-duration:.5s;animation-timing-function:ease-in-out;animation-fill-mode:forwards}",
22
22
  /*__inner_css_end__*/
23
- "57xz9_gg_"
23
+ "1tspb_gg_"
24
24
  ), /*__reshadow_css_end__*/
25
25
  {
26
- "__SLineGauge": "___SLineGauge_57xz9_gg_",
27
- "_loading": "__loading_57xz9_gg_",
28
- "__SDonutContainer": "___SDonutContainer_57xz9_gg_",
29
- "__STrendLine": "___STrendLine_57xz9_gg_",
30
- "__STrendBar": "___STrendBar_57xz9_gg_",
31
- "@pulse": "pulse_57xz9",
32
- "--base-bg-color": "--base-bg-color_57xz9",
33
- "__SLineValue": "___SLineValue_57xz9_gg_",
34
- "_percent": "__percent_57xz9_gg_",
35
- "--percent": "--percent_57xz9",
36
- "_color": "__color_57xz9_gg_",
37
- "__SLineSegmentItem": "___SLineSegmentItem_57xz9_gg_",
38
- "--color": "--color_57xz9",
39
- "_segments": "__segments_57xz9_gg_",
40
- "__SLineGaugeSegment": "___SLineGaugeSegment_57xz9_gg_",
41
- "__SAnimationLine": "___SAnimationLine_57xz9_gg_",
42
- "@move-line": "move-line_57xz9"
26
+ "__SLineGauge": "___SLineGauge_1tspb_gg_",
27
+ "_loading": "__loading_1tspb_gg_",
28
+ "__SDonutContainer": "___SDonutContainer_1tspb_gg_",
29
+ "__STrendLine": "___STrendLine_1tspb_gg_",
30
+ "__STrendBar": "___STrendBar_1tspb_gg_",
31
+ "@pulse": "pulse_1tspb",
32
+ "--base-bg-color": "--base-bg-color_1tspb",
33
+ "__SLineValue": "___SLineValue_1tspb_gg_",
34
+ "_percent": "__percent_1tspb_gg_",
35
+ "--percent": "--percent_1tspb",
36
+ "_color": "__color_1tspb_gg_",
37
+ "__SLineSegmentItem": "___SLineSegmentItem_1tspb_gg_",
38
+ "--color": "--color_1tspb",
39
+ "_segments": "__segments_1tspb_gg_",
40
+ "__SLineGaugeSegment": "___SLineGaugeSegment_1tspb_gg_",
41
+ "__SAnimationLine": "___SAnimationLine_1tspb_gg_",
42
+ "@move-line": "move-line_1tspb"
43
43
  })
44
44
  );
45
45
  var LineRoot = /* @__PURE__ */ function(_Component) {
@@ -21,17 +21,17 @@ var style = (
21
21
  /*__reshadow_css_start__*/
22
22
  (sstyled.insert(
23
23
  /*__inner_css_start__*/
24
- "@keyframes pulse_1d47w{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_1d47w_gg_.__loading_1d47w_gg_,.___SLineGauge_1d47w_gg_.__loading_1d47w_gg_,.___STrendBar_1d47w_gg_.__loading_1d47w_gg_,.___STrendLine_1d47w_gg_.__loading_1d47w_gg_{animation-name:pulse_1d47w;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}",
24
+ "@keyframes pulse_1rcp7{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_1rcp7_gg_.__loading_1rcp7_gg_,.___SLineGauge_1rcp7_gg_.__loading_1rcp7_gg_,.___STrendBar_1rcp7_gg_.__loading_1rcp7_gg_,.___STrendLine_1rcp7_gg_.__loading_1rcp7_gg_{animation-name:pulse_1rcp7;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}",
25
25
  /*__inner_css_end__*/
26
- "1d47w_gg_"
26
+ "1rcp7_gg_"
27
27
  ), /*__reshadow_css_end__*/
28
28
  {
29
- "__SLineGauge": "___SLineGauge_1d47w_gg_",
30
- "_loading": "__loading_1d47w_gg_",
31
- "__SDonutContainer": "___SDonutContainer_1d47w_gg_",
32
- "__STrendLine": "___STrendLine_1d47w_gg_",
33
- "__STrendBar": "___STrendBar_1d47w_gg_",
34
- "@pulse": "pulse_1d47w"
29
+ "__SLineGauge": "___SLineGauge_1rcp7_gg_",
30
+ "_loading": "__loading_1rcp7_gg_",
31
+ "__SDonutContainer": "___SDonutContainer_1rcp7_gg_",
32
+ "__STrendLine": "___STrendLine_1rcp7_gg_",
33
+ "__STrendBar": "___STrendBar_1rcp7_gg_",
34
+ "@pulse": "pulse_1rcp7"
35
35
  })
36
36
  );
37
37
  var TrendBarRoot = /* @__PURE__ */ function(_Trend) {
@@ -22,17 +22,17 @@ var style = (
22
22
  /*__reshadow_css_start__*/
23
23
  (sstyled.insert(
24
24
  /*__inner_css_start__*/
25
- "@keyframes pulse_1d47w{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_1d47w_gg_.__loading_1d47w_gg_,.___SLineGauge_1d47w_gg_.__loading_1d47w_gg_,.___STrendBar_1d47w_gg_.__loading_1d47w_gg_,.___STrendLine_1d47w_gg_.__loading_1d47w_gg_{animation-name:pulse_1d47w;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}",
25
+ "@keyframes pulse_1rcp7{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_1rcp7_gg_.__loading_1rcp7_gg_,.___SLineGauge_1rcp7_gg_.__loading_1rcp7_gg_,.___STrendBar_1rcp7_gg_.__loading_1rcp7_gg_,.___STrendLine_1rcp7_gg_.__loading_1rcp7_gg_{animation-name:pulse_1rcp7;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}",
26
26
  /*__inner_css_end__*/
27
- "1d47w_gg_"
27
+ "1rcp7_gg_"
28
28
  ), /*__reshadow_css_end__*/
29
29
  {
30
- "__SLineGauge": "___SLineGauge_1d47w_gg_",
31
- "_loading": "__loading_1d47w_gg_",
32
- "__SDonutContainer": "___SDonutContainer_1d47w_gg_",
33
- "__STrendLine": "___STrendLine_1d47w_gg_",
34
- "__STrendBar": "___STrendBar_1d47w_gg_",
35
- "@pulse": "pulse_1d47w"
30
+ "__SLineGauge": "___SLineGauge_1rcp7_gg_",
31
+ "_loading": "__loading_1rcp7_gg_",
32
+ "__SDonutContainer": "___SDonutContainer_1rcp7_gg_",
33
+ "__STrendLine": "___STrendLine_1rcp7_gg_",
34
+ "__STrendBar": "___STrendBar_1rcp7_gg_",
35
+ "@pulse": "pulse_1rcp7"
36
36
  })
37
37
  );
38
38
  var TrendLineRoot = /* @__PURE__ */ function(_Trend) {
@@ -9,14 +9,9 @@ var ScoreDonutUtils = /* @__PURE__ */ function() {
9
9
  _defineProperty(this, "radius", void 0);
10
10
  this.isSemiDonut = isSemiDonut;
11
11
  this.radius = isSemiDonut ? 9 : 10;
12
- this.value = value;
12
+ this.value = Math.max(Math.min(value, 100), 0);
13
13
  }
14
14
  return _createClass(ScoreDonutUtils2, [{
15
- key: "hasDivider",
16
- get: function get() {
17
- return ![0, 100].includes(this.value);
18
- }
19
- }, {
20
15
  key: "viewBox",
21
16
  get: function get() {
22
17
  return this.isSemiDonut ? "0 0 24 12" : "0 0 24 24";
@@ -27,45 +22,58 @@ var ScoreDonutUtils = /* @__PURE__ */ function() {
27
22
  return this.isSemiDonut ? 6 : 4;
28
23
  }
29
24
  }, {
30
- key: "baseStrokeDashArray",
25
+ key: "fullLength",
31
26
  get: function get() {
32
27
  return this.isSemiDonut ? Math.PI * this.radius : 2 * Math.PI * this.radius;
33
28
  }
34
29
  }, {
35
- key: "valueStrokeDashArray",
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",
36
53
  get: function get() {
37
- return this.baseStrokeDashArray * (this.value / 100);
54
+ var margin = 0;
55
+ if (!this.isSemiDonut && this.value > 0) margin = this.point;
56
+ return margin;
38
57
  }
39
58
  }, {
40
- key: "greyStrokeDashArray",
59
+ key: "baseOffset",
41
60
  get: function get() {
42
- return this.baseStrokeDashArray - this.valueStrokeDashArray;
61
+ return -1 * (this.valueLength + this.startMargin);
43
62
  }
44
63
  }, {
45
- key: "offsetPoint",
64
+ key: "baseLength",
46
65
  get: function get() {
47
- return this.isSemiDonut ? this.baseStrokeDashArray / (100 / 3) : this.baseStrokeDashArray / 100;
66
+ return Math.max(this.fullLength - this.valueLength - this.startMargin - this.endMargin, 0);
48
67
  }
49
68
  }, {
50
- key: "strokeDashArrayParts",
69
+ key: "animatedBaseLengthFrom",
51
70
  get: function get() {
52
- var greyStroke = this.greyStrokeDashArray;
53
- var offsetPoint = this.offsetPoint;
54
- var greyStrokeDash = greyStroke - 2 * offsetPoint;
55
- var strokeDashArrayBetweenSpaces = "".concat(greyStrokeDash, " ").concat(offsetPoint);
56
- if (this.isSemiDonut) {
57
- return "".concat(offsetPoint, " ").concat(this.value < 95 ? strokeDashArrayBetweenSpaces : "", " ").concat(this.baseStrokeDashArray);
58
- }
59
- return "".concat(offsetPoint, " ").concat(greyStrokeDash >= 0 ? strokeDashArrayBetweenSpaces : "", " ").concat(this.baseStrokeDashArray);
71
+ return this.fullLength - this.startMargin - this.endMargin;
60
72
  }
61
73
  }, {
62
- key: "strokeDashOffsetBase",
74
+ key: "animatedBaseLengthTo",
63
75
  get: function get() {
64
- var hasDivider = this.hasDivider;
65
- if (!hasDivider) return 0;
66
- var valueStroke = this.valueStrokeDashArray;
67
- var offsetPoint = this.offsetPoint;
68
- return -1 * (valueStroke + (this.isSemiDonut ? offsetPoint : 0));
76
+ return this.fullLength - this.valueLength - this.startMargin - this.endMargin;
69
77
  }
70
78
  }]);
71
79
  }();
@@ -1,10 +1,12 @@
1
1
  import { type ComponentType } from '@semcore/core';
2
2
  import resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';
3
+ import { cssVariableEnhance } from '@semcore/core/lib/utils/useCssVariable';
3
4
  import { type BoxProps } from '@semcore/flex-box';
4
5
  import type { CommonScoreProps } from './Score';
5
6
  export type ScoreDonutProps = BoxProps & CommonScoreProps;
6
7
  type Enhances = {
7
8
  resolveColor: ReturnType<typeof resolveColorEnhance>;
9
+ duration: ReturnType<typeof cssVariableEnhance>;
8
10
  isSemiDonut?: true;
9
11
  };
10
12
  export declare const ScoreDonut: ComponentType<ScoreDonutProps, {}, {}, Enhances>;
@@ -3,13 +3,16 @@ export declare class ScoreDonutUtils {
3
3
  private readonly value;
4
4
  readonly radius: number;
5
5
  constructor(value: number, isSemiDonut: boolean);
6
- get hasDivider(): boolean;
7
6
  get viewBox(): "0 0 24 12" | "0 0 24 24";
8
7
  get strokeWidth(): 6 | 4;
9
- get baseStrokeDashArray(): number;
10
- get valueStrokeDashArray(): number;
11
- get greyStrokeDashArray(): number;
12
- get offsetPoint(): number;
13
- get strokeDashArrayParts(): string;
14
- get strokeDashOffsetBase(): number;
8
+ get fullLength(): number;
9
+ get point(): number;
10
+ get valueLength(): number;
11
+ get animatedValueLength(): number;
12
+ get startMargin(): number;
13
+ get endMargin(): number;
14
+ get baseOffset(): number;
15
+ get baseLength(): number;
16
+ get animatedBaseLengthFrom(): number;
17
+ get animatedBaseLengthTo(): number;
15
18
  }