@semcore/mini-chart 0.17.2 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/lib/cjs/component/score/Donut.js +10 -10
- package/lib/cjs/component/score/Donut.js.map +1 -1
- package/lib/cjs/component/score/Line.js +70 -31
- package/lib/cjs/component/score/Line.js.map +1 -1
- package/lib/cjs/component/score/Line.types.js +2 -0
- package/lib/cjs/component/score/Line.types.js.map +1 -0
- package/lib/cjs/component/score/line.shadow.css +14 -18
- package/lib/cjs/component/trend/Bar.js +8 -8
- package/lib/cjs/component/trend/Bar.js.map +1 -1
- package/lib/cjs/component/trend/Line.js +7 -7
- package/lib/es6/component/score/Donut.js +10 -10
- package/lib/es6/component/score/Donut.js.map +1 -1
- package/lib/es6/component/score/Line.js +72 -31
- package/lib/es6/component/score/Line.js.map +1 -1
- package/lib/es6/component/score/Line.types.js +2 -0
- package/lib/es6/component/score/Line.types.js.map +1 -0
- package/lib/es6/component/score/line.shadow.css +14 -18
- package/lib/es6/component/trend/Bar.js +8 -8
- package/lib/es6/component/trend/Bar.js.map +1 -1
- package/lib/es6/component/trend/Line.js +7 -7
- package/lib/types/component/score/Line.d.ts +2 -15
- package/lib/types/component/score/Line.types.d.ts +48 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
+
## [0.18.0] - 2024-08-21
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- API to render custom segments in Score.Line.
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Styles for Bar and Donut mini charts.
|
|
14
|
+
|
|
5
15
|
## [0.17.2] - 2024-08-05
|
|
6
16
|
|
|
7
17
|
### Changed
|
|
@@ -18,15 +18,15 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
18
18
|
var _flexBox = require("@semcore/flex-box");
|
|
19
19
|
var _resolveColorEnhance = _interopRequireDefault(require("@semcore/utils/lib/enhances/resolveColorEnhance"));
|
|
20
20
|
/*__reshadow-styles__:"./donut.shadow.css"*/
|
|
21
|
-
var style = ( /*__reshadow_css_start__*/_index.sstyled.insert( /*__inner_css_start__*/"@keyframes
|
|
22
|
-
"__SLineGauge": "
|
|
23
|
-
"_loading": "
|
|
24
|
-
"__SDonutContainer": "
|
|
25
|
-
"__STrendLine": "
|
|
26
|
-
"__STrendBar": "
|
|
27
|
-
"@pulse": "
|
|
28
|
-
"_animate": "
|
|
29
|
-
"_semi": "
|
|
21
|
+
var style = ( /*__reshadow_css_start__*/_index.sstyled.insert( /*__inner_css_start__*/"@keyframes pulse_hc6bn{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_hc6bn_gg_.__loading_hc6bn_gg_,.___SLineGauge_hc6bn_gg_.__loading_hc6bn_gg_,.___STrendBar_hc6bn_gg_.__loading_hc6bn_gg_,.___STrendLine_hc6bn_gg_.__loading_hc6bn_gg_{animation-name:pulse_hc6bn;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SDonutContainer_hc6bn_gg_.__semi_hc6bn_gg_ g{transform:rotate(180deg) translate(-24px,-24px)}.___SDonutContainer_hc6bn_gg_ g{transform:rotate(-90deg) translate(-24px)}.___SDonutContainer_hc6bn_gg_.__animate_hc6bn_gg_ circle{transition:all var(--intergalactic-duration-extra-slow, 500) ease-in-out}" /*__inner_css_end__*/, "hc6bn_gg_") /*__reshadow_css_end__*/, {
|
|
22
|
+
"__SLineGauge": "___SLineGauge_hc6bn_gg_",
|
|
23
|
+
"_loading": "__loading_hc6bn_gg_",
|
|
24
|
+
"__SDonutContainer": "___SDonutContainer_hc6bn_gg_",
|
|
25
|
+
"__STrendLine": "___STrendLine_hc6bn_gg_",
|
|
26
|
+
"__STrendBar": "___STrendBar_hc6bn_gg_",
|
|
27
|
+
"@pulse": "pulse_hc6bn",
|
|
28
|
+
"_animate": "__animate_hc6bn_gg_",
|
|
29
|
+
"_semi": "__semi_hc6bn_gg_"
|
|
30
30
|
});
|
|
31
31
|
var DonutRoot = /*#__PURE__*/function (_Component) {
|
|
32
32
|
(0, _inherits2["default"])(DonutRoot, _Component);
|
|
@@ -73,7 +73,7 @@ var DonutRoot = /*#__PURE__*/function (_Component) {
|
|
|
73
73
|
"cy": '12',
|
|
74
74
|
"r": radius,
|
|
75
75
|
"strokeWidth": strokeWidth,
|
|
76
|
-
"stroke": resolveColor('
|
|
76
|
+
"stroke": resolveColor('chart-grid-bar-chart-base-bg'),
|
|
77
77
|
"strokeDasharray": loading ? undefined : "".concat(greyStrokeDasharray, " ").concat(baseStrokeDasharray),
|
|
78
78
|
"strokeDashoffset": -1 * valueStrokeDasharray
|
|
79
79
|
})), !loading && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("circle", _ref2.cn("circle", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Donut.js","names":["_core","_interopRequireWildcard","require","_react","_interopRequireDefault","_flexBox","_resolveColorEnhance","style","_index","sstyled","insert","DonutRoot","_Component","_inherits2","_super","_createSuper2","_classCallCheck2","apply","arguments","_createClass2","key","value","render","_ref","asProps","_ref2","SDonutContainer","Box","_this$asProps","styles","_this$asProps$color","color","resolveColor","isSemiDonut","loading","strokeWidth","radius","baseStrokeDasharray","Math","PI","valueStrokeDasharray","greyStrokeDasharray","offsetPoint","strokeDasharrayBetweenSpaces","concat","spaceStrokeDasharray","viewBox","createElement","cn","_objectSpread2","assignProps","undefined","Fragment","Component","_defineProperty2","resolveColorEnhance","animate","ScoreDonut","createComponent","exports","displayName","ScoreSemiDonut","enhancements","wrapperProps","props"],"sources":["../../../../src/component/score/Donut.tsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, Root, sstyled, ComponentType } from '@semcore/core';\nimport { Box, BoxProps } from '@semcore/flex-box';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\nimport { assignProps } from '@semcore/core';\nimport { CommonScoreProps } from './Score';\n\nimport style from './donut.shadow.css';\n\nexport type ScoreDonutProps = BoxProps & CommonScoreProps;\n\ntype Enhances = {\n resolveColor: ReturnType<typeof resolveColorEnhance>;\n isSemiDonut?: true;\n};\n\nclass DonutRoot extends Component<ScoreDonutProps, {}, {}, Enhances> {\n static enhance = [resolveColorEnhance()];\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 color = 'chart-palette-order-1',\n resolveColor,\n isSemiDonut,\n loading,\n } = this.asProps;\n\n const strokeWidth = isSemiDonut ? 6 : 4;\n const radius = isSemiDonut ? 9 : 10;\n const baseStrokeDasharray = isSemiDonut ? Math.PI * radius : Math.PI * 2 * radius;\n const valueStrokeDasharray = baseStrokeDasharray * (value / 100);\n const greyStrokeDasharray = baseStrokeDasharray * ((100 - value) / 100);\n const offsetPoint = isSemiDonut ? baseStrokeDasharray / (100 / 3) : baseStrokeDasharray / 100;\n\n const strokeDasharrayBetweenSpaces = `${greyStrokeDasharray - 2 * offsetPoint} ${offsetPoint}`;\n\n let spaceStrokeDasharray = `${offsetPoint} ${\n value < 99 ? `${strokeDasharrayBetweenSpaces}` : ''\n } ${baseStrokeDasharray}`;\n\n if (isSemiDonut) {\n spaceStrokeDasharray = `${offsetPoint} ${\n value < 95 ? `${strokeDasharrayBetweenSpaces}` : ''\n } ${baseStrokeDasharray}`;\n }\n\n const viewBox = isSemiDonut ? '0 0 24 12' : '0 0 24 24';\n\n return sstyled(styles)(\n <SDonutContainer render={Box} semi={isSemiDonut}>\n <svg width='100%' height='100%' viewBox={viewBox} fill='none'>\n <g>\n <circle\n cx='12'\n cy='12'\n r={radius}\n strokeWidth={strokeWidth}\n stroke={resolveColor('
|
|
1
|
+
{"version":3,"file":"Donut.js","names":["_core","_interopRequireWildcard","require","_react","_interopRequireDefault","_flexBox","_resolveColorEnhance","style","_index","sstyled","insert","DonutRoot","_Component","_inherits2","_super","_createSuper2","_classCallCheck2","apply","arguments","_createClass2","key","value","render","_ref","asProps","_ref2","SDonutContainer","Box","_this$asProps","styles","_this$asProps$color","color","resolveColor","isSemiDonut","loading","strokeWidth","radius","baseStrokeDasharray","Math","PI","valueStrokeDasharray","greyStrokeDasharray","offsetPoint","strokeDasharrayBetweenSpaces","concat","spaceStrokeDasharray","viewBox","createElement","cn","_objectSpread2","assignProps","undefined","Fragment","Component","_defineProperty2","resolveColorEnhance","animate","ScoreDonut","createComponent","exports","displayName","ScoreSemiDonut","enhancements","wrapperProps","props"],"sources":["../../../../src/component/score/Donut.tsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, Root, sstyled, ComponentType } from '@semcore/core';\nimport { Box, BoxProps } from '@semcore/flex-box';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\nimport { assignProps } from '@semcore/core';\nimport { CommonScoreProps } from './Score';\n\nimport style from './donut.shadow.css';\n\nexport type ScoreDonutProps = BoxProps & CommonScoreProps;\n\ntype Enhances = {\n resolveColor: ReturnType<typeof resolveColorEnhance>;\n isSemiDonut?: true;\n};\n\nclass DonutRoot extends Component<ScoreDonutProps, {}, {}, Enhances> {\n static enhance = [resolveColorEnhance()];\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 color = 'chart-palette-order-1',\n resolveColor,\n isSemiDonut,\n loading,\n } = this.asProps;\n\n const strokeWidth = isSemiDonut ? 6 : 4;\n const radius = isSemiDonut ? 9 : 10;\n const baseStrokeDasharray = isSemiDonut ? Math.PI * radius : Math.PI * 2 * radius;\n const valueStrokeDasharray = baseStrokeDasharray * (value / 100);\n const greyStrokeDasharray = baseStrokeDasharray * ((100 - value) / 100);\n const offsetPoint = isSemiDonut ? baseStrokeDasharray / (100 / 3) : baseStrokeDasharray / 100;\n\n const strokeDasharrayBetweenSpaces = `${greyStrokeDasharray - 2 * offsetPoint} ${offsetPoint}`;\n\n let spaceStrokeDasharray = `${offsetPoint} ${\n value < 99 ? `${strokeDasharrayBetweenSpaces}` : ''\n } ${baseStrokeDasharray}`;\n\n if (isSemiDonut) {\n spaceStrokeDasharray = `${offsetPoint} ${\n value < 95 ? `${strokeDasharrayBetweenSpaces}` : ''\n } ${baseStrokeDasharray}`;\n }\n\n const viewBox = isSemiDonut ? '0 0 24 12' : '0 0 24 24';\n\n return sstyled(styles)(\n <SDonutContainer render={Box} semi={isSemiDonut}>\n <svg width='100%' height='100%' viewBox={viewBox} fill='none'>\n <g>\n <circle\n cx='12'\n cy='12'\n r={radius}\n strokeWidth={strokeWidth}\n stroke={resolveColor('chart-grid-bar-chart-base-bg')}\n strokeDasharray={\n loading ? undefined : `${greyStrokeDasharray} ${baseStrokeDasharray}`\n }\n strokeDashoffset={-1 * valueStrokeDasharray}\n />\n {!loading && (\n <>\n <circle\n cx='12'\n cy='12'\n r={radius}\n strokeWidth={strokeWidth}\n stroke={resolveColor(color)}\n strokeDasharray={`${valueStrokeDasharray} ${baseStrokeDasharray}`}\n strokeDashoffset={valueStrokeDasharray}\n >\n <animate\n attributeName={'stroke-dashoffset'}\n values={`0;${valueStrokeDasharray}`}\n />\n </circle>\n {value !== 100 && (\n <circle\n cx='12'\n cy='12'\n r={radius}\n strokeWidth={strokeWidth}\n stroke={resolveColor('chart-grid-border')}\n strokeDasharray={spaceStrokeDasharray}\n strokeDashoffset={-1 * valueStrokeDasharray}\n />\n )}\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":";;;;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AADA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,oBAAA,GAAAF,sBAAA,CAAAF,OAAA;AAAkF;AAAA,IAAAK,KAAA,+BAAAC,MAAA,CAAAC,OAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,IAa5EC,SAAS,0BAAAC,UAAA;EAAA,IAAAC,UAAA,aAAAF,SAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,OAAAC,aAAA,aAAAJ,SAAA;EAAA,SAAAA,UAAA;IAAA,IAAAK,gBAAA,mBAAAL,SAAA;IAAA,OAAAG,MAAA,CAAAG,KAAA,OAAAC,SAAA;EAAA;EAAA,IAAAC,aAAA,aAAAR,SAAA;IAAAS,GAAA;IAAAC,KAAA,EASb,SAAAC,OAAA,EAAS;MAAA,IAAAC,IAAA,QAAAC,OAAA;QAAAC,KAAA;MACP,IAAMC,eAAe,GAgCMC,YAAG;MA/B9B,IAAAC,aAAA,GAOI,IAAI,CAACJ,OAAO;QANdH,KAAK,GAAAO,aAAA,CAALP,KAAK;QACLQ,MAAM,GAAAD,aAAA,CAANC,MAAM;QAAAC,mBAAA,GAAAF,aAAA,CACNG,KAAK;QAALA,KAAK,GAAAD,mBAAA,cAAG,uBAAuB,GAAAA,mBAAA;QAC/BE,YAAY,GAAAJ,aAAA,CAAZI,YAAY;QACZC,WAAW,GAAAL,aAAA,CAAXK,WAAW;QACXC,OAAO,GAAAN,aAAA,CAAPM,OAAO;MAGT,IAAMC,WAAW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,CACC,CACA,CACU;IAEtB;EAAC;EAAA,OAAA7B,SAAA;AAAA,EAzFqB0C,eAAS;AAAA,IAAAC,gBAAA,aAA3B3C,SAAS,aACI,CAAC,IAAA4C,+BAAmB,GAAE,CAAC;AAAA,IAAAD,gBAAA,aADpC3C,SAAS,WAGEJ,KAAK;AAAA,IAAA+C,gBAAA,aAHhB3C,SAAS,kBAKS;EACpB6C,OAAO,EAAE;AACX,CAAC;AAqFI,IAAMC,UAA4D,GACvE,IAAAC,gBAAe,EAAC/C,SAAS,CAAC;AAACgD,OAAA,CAAAF,UAAA,GAAAA,UAAA;AAE7BA,UAAU,CAACG,WAAW,GAAG,sBAAsB;AAExC,IAAMC,cAAgE,GAAG,IAAAH,gBAAe,EAC7F/C,SAAS,EACT,CAAC,CAAC,EACF;EACEmD,YAAY,EAAE,CACZ,YAAM;IACJ,OAAO;MACLC,YAAY,EAAE,SAAAA,aAACC,KAAsB,EAAK;QACxC,OAAO,IAAAd,iBAAW,EAACc,KAAK,EAAE;UAAE/B,WAAW,EAAE;QAAK,CAAC,CAAC;MAClD;IACF,CAAC;EACH,CAAC;AAEL,CAAC,CACF;AAAC0B,OAAA,CAAAE,cAAA,GAAAA,cAAA;AAEFA,cAAc,CAACD,WAAW,GAAG,0BAA0B"}
|
|
@@ -18,23 +18,23 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
18
18
|
var _flexBox = require("@semcore/flex-box");
|
|
19
19
|
var _resolveColorEnhance = _interopRequireDefault(require("@semcore/utils/lib/enhances/resolveColorEnhance"));
|
|
20
20
|
/*__reshadow-styles__:"./line.shadow.css"*/
|
|
21
|
-
var style = ( /*__reshadow_css_start__*/_index.sstyled.insert( /*__inner_css_start__*/"@keyframes
|
|
22
|
-
"__SLineGauge": "
|
|
23
|
-
"_loading": "
|
|
24
|
-
"__SDonutContainer": "
|
|
25
|
-
"__STrendLine": "
|
|
26
|
-
"__STrendBar": "
|
|
27
|
-
"@pulse": "
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"--color": "--
|
|
34
|
-
"_segments": "
|
|
35
|
-
"__SLineGaugeSegment": "
|
|
36
|
-
"
|
|
37
|
-
"@move-line": "move-
|
|
21
|
+
var style = ( /*__reshadow_css_start__*/_index.sstyled.insert( /*__inner_css_start__*/"@keyframes pulse_1bky2{0%,to{opacity:1}50%{opacity:.4}}@keyframes move-line_1bky2{0%{transform:translateX(0)}to{transform:translateX(100%)}}.___SDonutContainer_1bky2_gg_.__loading_1bky2_gg_,.___SLineGauge_1bky2_gg_.__loading_1bky2_gg_,.___STrendBar_1bky2_gg_.__loading_1bky2_gg_,.___STrendLine_1bky2_gg_.__loading_1bky2_gg_{animation-name:pulse_1bky2;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SLineGauge_1bky2_gg_{height:8px;background-color:var(--intergalactic-chart-grid-bar-chart-base-bg, #e0e1e9);border-radius:var(--intergalactic-chart-rounded, 2px);overflow:hidden;position:relative}.___SLineValue_1bky2_gg_{height:8px;border-radius:var(--intergalactic-chart-rounded, 2px)0 0 var(--intergalactic-chart-rounded, 2px)}.___SLineValue_1bky2_gg_.__percent_1bky2_gg_{width:var(--percent_1bky2)}.___SLineSegmentItem_1bky2_gg_.__color_1bky2_gg_,.___SLineValue_1bky2_gg_.__color_1bky2_gg_{background-color:var(--color_1bky2, var(--intergalactic-chart-palette-order-1, #2bb3ff))}.___SLineGauge_1bky2_gg_.__segments_1bky2_gg_{border-radius:var(--intergalactic-progress-bar-rounded, 6px)}.___SAnimationLine_1bky2_gg_,.___SLineGaugeSegment_1bky2_gg_{position:absolute;top:0;left:0;right:0;bottom:0}.___SLineSegmentItem_1bky2_gg_:last-child{margin-right:0;border-right:none}.___SLineSegmentItem_1bky2_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_1bky2_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_1bky2;animation-duration:.5s;animation-timing-function:ease-in-out;animation-fill-mode:forwards}" /*__inner_css_end__*/, "1bky2_gg_") /*__reshadow_css_end__*/, {
|
|
22
|
+
"__SLineGauge": "___SLineGauge_1bky2_gg_",
|
|
23
|
+
"_loading": "__loading_1bky2_gg_",
|
|
24
|
+
"__SDonutContainer": "___SDonutContainer_1bky2_gg_",
|
|
25
|
+
"__STrendLine": "___STrendLine_1bky2_gg_",
|
|
26
|
+
"__STrendBar": "___STrendBar_1bky2_gg_",
|
|
27
|
+
"@pulse": "pulse_1bky2",
|
|
28
|
+
"__SLineValue": "___SLineValue_1bky2_gg_",
|
|
29
|
+
"_percent": "__percent_1bky2_gg_",
|
|
30
|
+
"--percent": "--percent_1bky2",
|
|
31
|
+
"_color": "__color_1bky2_gg_",
|
|
32
|
+
"__SLineSegmentItem": "___SLineSegmentItem_1bky2_gg_",
|
|
33
|
+
"--color": "--color_1bky2",
|
|
34
|
+
"_segments": "__segments_1bky2_gg_",
|
|
35
|
+
"__SLineGaugeSegment": "___SLineGaugeSegment_1bky2_gg_",
|
|
36
|
+
"__SAnimationLine": "___SAnimationLine_1bky2_gg_",
|
|
37
|
+
"@move-line": "move-line_1bky2"
|
|
38
38
|
});
|
|
39
39
|
var LineRoot = /*#__PURE__*/function (_Component) {
|
|
40
40
|
(0, _inherits2["default"])(LineRoot, _Component);
|
|
@@ -44,28 +44,56 @@ var LineRoot = /*#__PURE__*/function (_Component) {
|
|
|
44
44
|
return _super.apply(this, arguments);
|
|
45
45
|
}
|
|
46
46
|
(0, _createClass2["default"])(LineRoot, [{
|
|
47
|
+
key: "getSegmentProps",
|
|
48
|
+
value: function getSegmentProps(segmentProps) {
|
|
49
|
+
var _this$asProps = this.asProps,
|
|
50
|
+
children = _this$asProps.children,
|
|
51
|
+
resolveColor = _this$asProps.resolveColor;
|
|
52
|
+
var sum = 0;
|
|
53
|
+
_react["default"].Children.forEach(children, function (child) {
|
|
54
|
+
if ( /*#__PURE__*/_react["default"].isValidElement(child)) {
|
|
55
|
+
sum = sum + child.props.value;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
var width = sum > 0 ? 100 * segmentProps.value / sum : 0;
|
|
59
|
+
return {
|
|
60
|
+
w: "".concat(width, "%"),
|
|
61
|
+
'use:color': resolveColor(segmentProps.color)
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}, {
|
|
47
65
|
key: "render",
|
|
48
66
|
value: function render() {
|
|
49
67
|
var _ref = this.asProps,
|
|
50
|
-
|
|
68
|
+
_ref5;
|
|
51
69
|
var SLineGauge = _flexBox.Box;
|
|
52
70
|
var SLineValue = _flexBox.Box;
|
|
71
|
+
var SAnimationLine = _flexBox.Box;
|
|
53
72
|
var SLineGaugeSegment = _flexBox.Flex;
|
|
54
73
|
var SLineSegmentItem = _flexBox.Box;
|
|
55
|
-
var _this$
|
|
56
|
-
value = _this$
|
|
57
|
-
styles = _this$
|
|
58
|
-
_this$
|
|
59
|
-
color = _this$
|
|
60
|
-
resolveColor = _this$
|
|
61
|
-
|
|
62
|
-
|
|
74
|
+
var _this$asProps2 = this.asProps,
|
|
75
|
+
value = _this$asProps2.value,
|
|
76
|
+
styles = _this$asProps2.styles,
|
|
77
|
+
_this$asProps2$color = _this$asProps2.color,
|
|
78
|
+
color = _this$asProps2$color === void 0 ? 'chart-palette-order-1' : _this$asProps2$color,
|
|
79
|
+
resolveColor = _this$asProps2.resolveColor,
|
|
80
|
+
loading = _this$asProps2.loading,
|
|
81
|
+
children = _this$asProps2.children,
|
|
82
|
+
Children = _this$asProps2.Children,
|
|
83
|
+
animate = _this$asProps2.animate;
|
|
84
|
+
if (children !== undefined) {
|
|
85
|
+
var _ref3;
|
|
86
|
+
return _ref3 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SLineGauge, _ref3.cn("SLineGauge", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
|
|
87
|
+
"segments": true
|
|
88
|
+
}, _ref))), /*#__PURE__*/_react["default"].createElement(SLineGaugeSegment, _ref3.cn("SLineGaugeSegment", {}), /*#__PURE__*/_react["default"].createElement(Children, _ref3.cn("Children", {}))), animate && /*#__PURE__*/_react["default"].createElement(SAnimationLine, _ref3.cn("SAnimationLine", {})));
|
|
89
|
+
}
|
|
90
|
+
var segments = this.asProps.segments;
|
|
63
91
|
var SegmentItems = [];
|
|
64
92
|
if (segments) {
|
|
65
93
|
for (var i = 0; i < segments; i++) {
|
|
66
|
-
var
|
|
94
|
+
var _ref4;
|
|
67
95
|
var width = "calc((100% - ".concat(segments - 1, "px) / ").concat(segments, ")");
|
|
68
|
-
SegmentItems.push((
|
|
96
|
+
SegmentItems.push((_ref4 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SLineSegmentItem, _ref4.cn("SLineSegmentItem", {
|
|
69
97
|
"key": i,
|
|
70
98
|
"color": i < value ? resolveColor(color) : undefined,
|
|
71
99
|
"w": width
|
|
@@ -76,20 +104,31 @@ var LineRoot = /*#__PURE__*/function (_Component) {
|
|
|
76
104
|
if (segments) {
|
|
77
105
|
percent = "".concat(value / segments * 100, "%");
|
|
78
106
|
}
|
|
79
|
-
return
|
|
107
|
+
return _ref5 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SLineGauge, _ref5.cn("SLineGauge", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({}, _ref))), !loading && /*#__PURE__*/_react["default"].createElement(SLineValue, _ref5.cn("SLineValue", {
|
|
80
108
|
"w": percent,
|
|
81
109
|
"color": resolveColor(color)
|
|
82
|
-
})), Boolean(SegmentItems.length) && /*#__PURE__*/_react["default"].createElement(SLineGaugeSegment,
|
|
110
|
+
})), Boolean(SegmentItems.length) && /*#__PURE__*/_react["default"].createElement(SLineGaugeSegment, _ref5.cn("SLineGaugeSegment", {}), SegmentItems), animate && /*#__PURE__*/_react["default"].createElement(SAnimationLine, _ref5.cn("SAnimationLine", {})));
|
|
83
111
|
}
|
|
84
112
|
}]);
|
|
85
113
|
return LineRoot;
|
|
86
114
|
}(_core.Component);
|
|
87
115
|
(0, _defineProperty2["default"])(LineRoot, "enhance", [(0, _resolveColorEnhance["default"])()]);
|
|
116
|
+
(0, _defineProperty2["default"])(LineRoot, "displayName", 'ScoreLine');
|
|
88
117
|
(0, _defineProperty2["default"])(LineRoot, "style", style);
|
|
89
118
|
(0, _defineProperty2["default"])(LineRoot, "defaultProps", {
|
|
90
119
|
animate: true
|
|
91
120
|
});
|
|
92
|
-
|
|
121
|
+
function Segment(props) {
|
|
122
|
+
var _ref2 = arguments[0],
|
|
123
|
+
_ref6;
|
|
124
|
+
var styles = props.styles;
|
|
125
|
+
var SLineSegmentItem = _flexBox.Box;
|
|
126
|
+
return _ref6 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SLineSegmentItem, _ref6.cn("SLineSegmentItem", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({}, _ref2))));
|
|
127
|
+
}
|
|
128
|
+
Segment.displayName = 'Segment';
|
|
129
|
+
var ScoreLine = (0, _core["default"])(LineRoot, {
|
|
130
|
+
Segment: Segment
|
|
131
|
+
});
|
|
93
132
|
exports.ScoreLine = ScoreLine;
|
|
94
133
|
ScoreLine.displayName = 'MiniChart.ScoreLine';
|
|
95
134
|
//# sourceMappingURL=Line.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Line.js","names":["_core","_interopRequireWildcard","require","_react","_interopRequireDefault","_flexBox","_resolveColorEnhance","style","_index","sstyled","insert","LineRoot","_Component","_inherits2","_super","_createSuper2","_classCallCheck2","apply","arguments","_createClass2","key","value","
|
|
1
|
+
{"version":3,"file":"Line.js","names":["_core","_interopRequireWildcard","require","_react","_interopRequireDefault","_flexBox","_resolveColorEnhance","style","_index","sstyled","insert","LineRoot","_Component","_inherits2","_super","_createSuper2","_classCallCheck2","apply","arguments","_createClass2","key","value","getSegmentProps","segmentProps","_this$asProps","asProps","children","resolveColor","sum","React","Children","forEach","child","isValidElement","props","width","w","concat","color","render","_ref","_ref5","SLineGauge","Box","SLineValue","SAnimationLine","SLineGaugeSegment","Flex","SLineSegmentItem","_this$asProps2","styles","_this$asProps2$color","loading","animate","undefined","_ref3","createElement","cn","_objectSpread2","assignProps","segments","SegmentItems","i","_ref4","push","percent","Boolean","length","Component","_defineProperty2","resolveColorEnhance","Segment","_ref2","arguments[0]","_ref6","displayName","ScoreLine","createComponent","exports"],"sources":["../../../../src/component/score/Line.tsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, Root, sstyled } from '@semcore/core';\nimport { Box, Flex } from '@semcore/flex-box';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\n\nimport style from './line.shadow.css';\nimport {\n Enhances,\n ScoreLineComponent,\n ScoreLineGaugeProps,\n SegmentProps,\n InnerSegmentProps,\n} from './Line.types';\n\nclass LineRoot extends Component<ScoreLineGaugeProps, {}, {}, Enhances> {\n static enhance = [resolveColorEnhance()];\n static displayName = 'ScoreLine';\n\n static style = style;\n\n static defaultProps = {\n animate: true,\n };\n\n getSegmentProps(segmentProps: SegmentProps) {\n const { children, resolveColor } = this.asProps;\n\n let sum = 0;\n React.Children.forEach(children, (child) => {\n if (React.isValidElement<SegmentProps>(child)) {\n sum = sum + child.props.value;\n }\n });\n\n const width = sum > 0 ? (100 * segmentProps.value) / sum : 0;\n\n return {\n w: `${width}%`,\n 'use:color': resolveColor(segmentProps.color),\n };\n }\n\n render() {\n const SLineGauge = Root;\n const SLineValue = Box;\n const SAnimationLine = Box;\n const SLineGaugeSegment = Flex;\n const SLineSegmentItem = Box;\n const {\n value,\n styles,\n color = 'chart-palette-order-1',\n resolveColor,\n loading,\n children,\n Children,\n animate,\n } = this.asProps;\n\n if (children !== undefined) {\n return sstyled(styles)(\n <SLineGauge render={Box} segments>\n <SLineGaugeSegment>\n <Children />\n </SLineGaugeSegment>\n {animate && <SAnimationLine />}\n </SLineGauge>,\n );\n }\n\n const { segments } = this.asProps;\n\n const SegmentItems = [];\n\n if (segments) {\n for (let i = 0; i < segments; i++) {\n const width = `calc((100% - ${segments - 1}px) / ${segments})`;\n\n SegmentItems.push(\n sstyled(styles)(\n <SLineSegmentItem\n key={i}\n color={i < value ? resolveColor(color) : undefined}\n w={width}\n />,\n ),\n );\n }\n }\n\n let percent = `${value}%`;\n\n if (segments) {\n percent = `${(value / segments) * 100}%`;\n }\n\n return sstyled(styles)(\n <SLineGauge render={Box}>\n {!loading && <SLineValue w={percent} color={resolveColor(color)} />}\n {Boolean(SegmentItems.length) && <SLineGaugeSegment>{SegmentItems}</SLineGaugeSegment>}\n {animate && <SAnimationLine />}\n </SLineGauge>,\n );\n }\n}\n\nfunction Segment(props: InnerSegmentProps) {\n const { styles } = props;\n const SLineSegmentItem = Root;\n\n return sstyled(styles)(<SLineSegmentItem render={Box} />);\n}\nSegment.displayName = 'Segment';\n\nexport const ScoreLine: ScoreLineComponent = createComponent(LineRoot, {\n Segment,\n});\n\nScoreLine.displayName = 'MiniChart.ScoreLine';\n"],"mappings":";;;;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AADA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,oBAAA,GAAAF,sBAAA,CAAAF,OAAA;AAAkF;AAAA,IAAAK,KAAA,+BAAAC,MAAA,CAAAC,OAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,IAW5EC,QAAQ,0BAAAC,UAAA;EAAA,IAAAC,UAAA,aAAAF,QAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,OAAAC,aAAA,aAAAJ,QAAA;EAA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;AACX,CAAC;AAoFH,SAASkB,OAAOA,CAACrC,KAAwB,EAAE;EAAA,IAAAsC,KAAA,GAAAC,YAAA;IAAAC,KAAA;EACzC,IAAQxB,MAAM,GAAKhB,KAAK,CAAhBgB,MAAM;EACd,IAAMF,gBAAgB,GAE2BL,YAAG;EAApD,OAAA+B,KAAA,GAAO,IAAAjE,aAAO,EAACyC,MAAM,CAAC,eAAC/C,MAAA,YAAAqD,aAAA,CAACR,gBAAgB,EAAA0B,KAAA,CAAAjB,EAAA,yBAAAC,cAAA,qBAAA1D,KAAA,CAAA2D,WAAA,MAAAa,KAAA,IAAgB;AAC1D;AACAD,OAAO,CAACI,WAAW,GAAG,SAAS;AAExB,IAAMC,SAA6B,GAAG,IAAAC,gBAAe,EAAClE,QAAQ,EAAE;EACrE4D,OAAO,EAAPA;AACF,CAAC,CAAC;AAACO,OAAA,CAAAF,SAAA,GAAAA,SAAA;AAEHA,SAAS,CAACD,WAAW,GAAG,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Line.types.js","names":[],"sources":["../../../../src/component/score/Line.types.ts"],"sourcesContent":["import { Intergalactic, ComponentType } from '@semcore/utils/lib/core';\nimport { CommonScoreProps } from './Score';\nimport React from 'react';\nimport { BoxProps, Box } from '@semcore/flex-box';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\n\ntype Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N\n ? Acc[number]\n : Enumerate<N, [...Acc, Acc['length']]>;\n\ntype Range<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;\n\nexport type SegmentColor = `chart-palette-order-${Range<1, 24>}`;\n\nexport type SegmentProps = {\n value: number;\n /**\n * Color of value\n */\n color: SegmentColor;\n};\n\ntype SegmentComponent = React.FC<SegmentProps>;\n\nexport type InnerSegmentProps = SegmentProps & {\n styles: React.DetailedHTMLProps<React.StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement>;\n};\n\ntype ValuedScoreProps = {\n /**\n * Value of score (in percents from 0 to 100) or count of selected segments (for Line with segments)\n */\n value: number;\n /**\n * Color of value\n */\n color?: SegmentColor;\n /**\n * Count of line segments\n */\n segments?: number;\n /**\n * We don't accept children in this way\n */\n children?: never;\n};\n\ntype CustomRenderScoreProps = {\n children: SegmentComponent[];\n};\n\nexport type ScoreLineGaugeProps = BoxProps &\n Intergalactic.InternalTypings.EfficientOmit<CommonScoreProps, 'value' | 'color'> &\n (ValuedScoreProps | CustomRenderScoreProps);\n\nexport type Enhances = {\n resolveColor: ReturnType<typeof resolveColorEnhance>;\n};\n\nexport type ScoreLineComponent = ComponentType<ScoreLineGaugeProps, {}, {}, Enhances> & {\n Segment: Intergalactic.Component<typeof Box, SegmentProps>;\n};\n"],"mappings":""}
|
|
@@ -2,22 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
SLineGauge {
|
|
4
4
|
height: 8px;
|
|
5
|
-
background-color: var(--intergalactic-
|
|
5
|
+
background-color: var(--intergalactic-chart-grid-bar-chart-base-bg, #e0e1e9);
|
|
6
6
|
border-radius: var(--intergalactic-chart-rounded, 2px);
|
|
7
7
|
overflow: hidden;
|
|
8
8
|
position: relative;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
SLineGauge[animate] SLineValue {
|
|
12
|
-
transition: all var(--intergalactic-duration-extra-slow, 500) ease-in-out;
|
|
13
|
-
animation-name: move-line;
|
|
14
|
-
animation-duration: 0.5s;
|
|
15
|
-
animation-timing-function: ease-in-out;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
11
|
SLineValue {
|
|
19
12
|
height: 8px;
|
|
20
|
-
background-color: var(--intergalactic-chart-palette-order-1, #2bb3ff);
|
|
21
13
|
border-radius: var(--intergalactic-chart-rounded, 2px) 0 0 var(--intergalactic-chart-rounded, 2px);
|
|
22
14
|
}
|
|
23
15
|
|
|
@@ -25,7 +17,7 @@ SLineValue[percent] {
|
|
|
25
17
|
width: var(--percent);
|
|
26
18
|
}
|
|
27
19
|
|
|
28
|
-
SLineValue[color] {
|
|
20
|
+
SLineValue[color], SLineSegmentItem[color] {
|
|
29
21
|
background-color: var(--color, var(--intergalactic-chart-palette-order-1, #2bb3ff));
|
|
30
22
|
}
|
|
31
23
|
|
|
@@ -33,11 +25,7 @@ SLineGauge[segments] {
|
|
|
33
25
|
border-radius: var(--intergalactic-progress-bar-rounded, 6px);
|
|
34
26
|
}
|
|
35
27
|
|
|
36
|
-
|
|
37
|
-
border-radius: var(--intergalactic-progress-bar-rounded, 6px) 0 0 var(--intergalactic-progress-bar-rounded, 6px);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
SLineGaugeSegment {
|
|
28
|
+
SLineGaugeSegment, SAnimationLine {
|
|
41
29
|
position: absolute;
|
|
42
30
|
top: 0;
|
|
43
31
|
left: 0;
|
|
@@ -53,14 +41,22 @@ SLineSegmentItem:last-child {
|
|
|
53
41
|
SLineSegmentItem {
|
|
54
42
|
height: 8px;
|
|
55
43
|
background: transparent;
|
|
56
|
-
margin-right: 1px;
|
|
57
44
|
border-right-color: var(--intergalactic-chart-grid-border, #ffffff);
|
|
58
45
|
border-right-style: solid;
|
|
59
46
|
border-right-width: 1px;
|
|
60
47
|
box-sizing: content-box;
|
|
61
48
|
}
|
|
62
49
|
|
|
50
|
+
SAnimationLine {
|
|
51
|
+
background-color: var(--intergalactic-chart-grid-bar-chart-base-bg, #e0e1e9);
|
|
52
|
+
transition: all var(--intergalactic-duration-extra-slow, 500) ease-in-out;
|
|
53
|
+
animation-name: move-line;
|
|
54
|
+
animation-duration: 0.5s;
|
|
55
|
+
animation-timing-function: ease-in-out;
|
|
56
|
+
animation-fill-mode: forwards;
|
|
57
|
+
}
|
|
58
|
+
|
|
63
59
|
@keyframes move-line {
|
|
64
|
-
0% {transform: translateX(
|
|
65
|
-
100% {transform: translateX(
|
|
60
|
+
0% {transform: translateX(0);}
|
|
61
|
+
100% {transform: translateX(100%);}
|
|
66
62
|
}
|
|
@@ -19,13 +19,13 @@ var _resolveColorEnhance = _interopRequireDefault(require("@semcore/utils/lib/en
|
|
|
19
19
|
var _Trend2 = require("./Trend");
|
|
20
20
|
var _flexBox = require("@semcore/flex-box");
|
|
21
21
|
/*__reshadow-styles__:"../skeleton/skeleton.shadow.css"*/
|
|
22
|
-
var style = ( /*__reshadow_css_start__*/_index.sstyled.insert( /*__inner_css_start__*/"@keyframes
|
|
23
|
-
"__SLineGauge": "
|
|
24
|
-
"_loading": "
|
|
25
|
-
"__SDonutContainer": "
|
|
26
|
-
"__STrendLine": "
|
|
27
|
-
"__STrendBar": "
|
|
28
|
-
"@pulse": "
|
|
22
|
+
var style = ( /*__reshadow_css_start__*/_index.sstyled.insert( /*__inner_css_start__*/"@keyframes pulse_dovxk{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_dovxk_gg_.__loading_dovxk_gg_,.___SLineGauge_dovxk_gg_.__loading_dovxk_gg_,.___STrendBar_dovxk_gg_.__loading_dovxk_gg_,.___STrendLine_dovxk_gg_.__loading_dovxk_gg_{animation-name:pulse_dovxk;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}" /*__inner_css_end__*/, "dovxk_gg_") /*__reshadow_css_end__*/, {
|
|
23
|
+
"__SLineGauge": "___SLineGauge_dovxk_gg_",
|
|
24
|
+
"_loading": "__loading_dovxk_gg_",
|
|
25
|
+
"__SDonutContainer": "___SDonutContainer_dovxk_gg_",
|
|
26
|
+
"__STrendLine": "___STrendLine_dovxk_gg_",
|
|
27
|
+
"__STrendBar": "___STrendBar_dovxk_gg_",
|
|
28
|
+
"@pulse": "pulse_dovxk"
|
|
29
29
|
});
|
|
30
30
|
var TrendBarRoot = /*#__PURE__*/function (_Trend) {
|
|
31
31
|
(0, _inherits2["default"])(TrendBarRoot, _Trend);
|
|
@@ -80,7 +80,7 @@ var TrendBarRoot = /*#__PURE__*/function (_Trend) {
|
|
|
80
80
|
"height": '100%',
|
|
81
81
|
"viewBox": "0 0 ".concat(this.svgWidth, " ").concat(this.svgHeight)
|
|
82
82
|
}), this.data.map(function (barItem, index) {
|
|
83
|
-
var color = resolveColor('
|
|
83
|
+
var color = resolveColor('chart-palette-order-other-data');
|
|
84
84
|
if (barItem.color) {
|
|
85
85
|
color = resolveColor(barItem.color);
|
|
86
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Bar.js","names":["_core","_interopRequireWildcard","require","_react","_interopRequireDefault","_resolveColorEnhance","_Trend2","_flexBox","style","_index","sstyled","insert","TrendBarRoot","_Trend","_inherits2","_super","_createSuper2","_classCallCheck2","apply","arguments","_createClass2","key","get","value","_this$asProps","asProps","data","loading","defaultData","render","_ref","_ref2","_this","STrendBar","Box","_this$asProps2","styles","resolveColor","isHistogram","animate","step","defaultWidth","length","createElement","cn","_objectSpread2","assignProps","containerRef","concat","svgWidth","svgHeight","map","barItem","index","color","x","y","defaultHeight","width","height","fill","attributeName","values","dur","Trend","_defineProperty2","resolveColorEnhance","TrendBar","createComponent","exports","displayName","TrendHistogram","enhancements","wrapperProps","props"],"sources":["../../../../src/component/trend/Bar.tsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { ComponentType, assignProps, Root, sstyled } from '@semcore/core';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\nimport { Trend, CommonTrendProps } from './Trend';\nimport { Box } from '@semcore/flex-box';\n\nimport style from '../skeleton/skeleton.shadow.css';\n\ntype BarItem = {\n /**\n * Value\n */\n value: number;\n /**\n * Color of value\n */\n color?: string;\n};\n\nexport type TrendBarProps = CommonTrendProps & {\n /**\n * Data to bar chart\n */\n data: BarItem[];\n};\n\ntype Enhances = {\n resolveColor: ReturnType<typeof resolveColorEnhance>;\n isHistogram?: true;\n};\n\nclass TrendBarRoot extends Trend<TrendBarProps, Enhances> {\n static enhance = [resolveColorEnhance()];\n\n static style = style;\n\n static defaultProps = {\n animate: true,\n };\n\n get defaultData(): BarItem[] {\n return [{ value: 20 }, { value: 80 }, { value: 45 }, { value: 10 }];\n }\n\n get data(): BarItem[] {\n const { data, loading } = this.asProps;\n\n if (loading) {\n return this.defaultData;\n }\n\n return data;\n }\n\n render() {\n const STrendBar = Root;\n const { styles, resolveColor, isHistogram, animate, loading } = this.asProps;\n const step = this.defaultWidth / this.data.length;\n\n return sstyled(styles)(\n <STrendBar render={Box} ref={this.containerRef} __excludeProps={['data']}>\n <svg width='100%' height='100%' viewBox={`0 0 ${this.svgWidth} ${this.svgHeight}`}>\n {this.data.map((barItem, index) => {\n let color = resolveColor('
|
|
1
|
+
{"version":3,"file":"Bar.js","names":["_core","_interopRequireWildcard","require","_react","_interopRequireDefault","_resolveColorEnhance","_Trend2","_flexBox","style","_index","sstyled","insert","TrendBarRoot","_Trend","_inherits2","_super","_createSuper2","_classCallCheck2","apply","arguments","_createClass2","key","get","value","_this$asProps","asProps","data","loading","defaultData","render","_ref","_ref2","_this","STrendBar","Box","_this$asProps2","styles","resolveColor","isHistogram","animate","step","defaultWidth","length","createElement","cn","_objectSpread2","assignProps","containerRef","concat","svgWidth","svgHeight","map","barItem","index","color","x","y","defaultHeight","width","height","fill","attributeName","values","dur","Trend","_defineProperty2","resolveColorEnhance","TrendBar","createComponent","exports","displayName","TrendHistogram","enhancements","wrapperProps","props"],"sources":["../../../../src/component/trend/Bar.tsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { ComponentType, assignProps, Root, sstyled } from '@semcore/core';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\nimport { Trend, CommonTrendProps } from './Trend';\nimport { Box } from '@semcore/flex-box';\n\nimport style from '../skeleton/skeleton.shadow.css';\n\ntype BarItem = {\n /**\n * Value\n */\n value: number;\n /**\n * Color of value\n */\n color?: string;\n};\n\nexport type TrendBarProps = CommonTrendProps & {\n /**\n * Data to bar chart\n */\n data: BarItem[];\n};\n\ntype Enhances = {\n resolveColor: ReturnType<typeof resolveColorEnhance>;\n isHistogram?: true;\n};\n\nclass TrendBarRoot extends Trend<TrendBarProps, Enhances> {\n static enhance = [resolveColorEnhance()];\n\n static style = style;\n\n static defaultProps = {\n animate: true,\n };\n\n get defaultData(): BarItem[] {\n return [{ value: 20 }, { value: 80 }, { value: 45 }, { value: 10 }];\n }\n\n get data(): BarItem[] {\n const { data, loading } = this.asProps;\n\n if (loading) {\n return this.defaultData;\n }\n\n return data;\n }\n\n render() {\n const STrendBar = Root;\n const { styles, resolveColor, isHistogram, animate, loading } = this.asProps;\n const step = this.defaultWidth / this.data.length;\n\n return sstyled(styles)(\n <STrendBar render={Box} ref={this.containerRef} __excludeProps={['data']}>\n <svg width='100%' height='100%' viewBox={`0 0 ${this.svgWidth} ${this.svgHeight}`}>\n {this.data.map((barItem, index) => {\n let color = resolveColor('chart-palette-order-other-data');\n\n if (barItem.color) {\n color = resolveColor(barItem.color);\n }\n\n return (\n <rect\n key={index}\n x={step * index}\n y={this.defaultHeight - barItem.value}\n width={isHistogram ? step : step * 0.8}\n height={barItem.value}\n fill={color}\n >\n {animate && !loading && (\n <animate\n attributeName={'y'}\n values={`${this.defaultHeight};${this.defaultHeight - barItem.value}`}\n dur={'500ms'}\n />\n )}\n </rect>\n );\n })}\n </svg>\n </STrendBar>,\n );\n }\n}\n\nexport const TrendBar: ComponentType<TrendBarProps, {}, {}, Enhances> =\n createComponent(TrendBarRoot);\n\nTrendBar.displayName = 'MiniChart.TrendBar';\n\nexport const TrendHistogram: ComponentType<TrendBarProps, {}, {}, Enhances> = createComponent(\n TrendBarRoot,\n {},\n {\n enhancements: [\n () => {\n return {\n wrapperProps: (props: TrendBarProps) => {\n return assignProps(props, { isHistogram: true });\n },\n };\n },\n ],\n },\n);\n\nTrendBar.displayName = 'MiniChart.TrendHistogram';\n"],"mappings":";;;;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AADA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,oBAAA,GAAAD,sBAAA,C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B,aAAa,EAAE,GAAI;UACnBC,MAAM,KAAAd,MAAA,CAAKhB,KAAI,CAACyB,aAAa,OAAAT,MAAA,CAAIhB,KAAI,CAACyB,aAAa,GAAGL,OAAO,CAAC7B,KAAK,CAAG;UACtEwC,GAAG,EAAE;QAAQ,EAEhB,CACI;MAEX,CAAC,CAAC,CACE,CACI;IAEhB;EAAC;EAAA,OAAAnD,YAAA;AAAA,EA5DwBoD,aAAK;AAAA,IAAAC,gBAAA,aAA1BrD,YAAY,aACC,CAAC,IAAAsD,+BAAmB,GAAE,CAAC;AAAA,IAAAD,gBAAA,aADpCrD,YAAY,WAGDJ,KAAK;AAAA,IAAAyD,gBAAA,aAHhBrD,YAAY,kBAKM;EACpB2B,OAAO,EAAE;AACX,CAAC;AAwDI,IAAM4B,QAAwD,GACnE,IAAAC,gBAAe,EAACxD,YAAY,CAAC;AAACyD,OAAA,CAAAF,QAAA,GAAAA,QAAA;AAEhCA,QAAQ,CAACG,WAAW,GAAG,oBAAoB;AAEpC,IAAMC,cAA8D,GAAG,IAAAH,gBAAe,EAC3FxD,YAAY,EACZ,CAAC,CAAC,EACF;EACE4D,YAAY,EAAE,CACZ,YAAM;IACJ,OAAO;MACLC,YAAY,EAAE,SAAAA,aAACC,KAAoB,EAAK;QACtC,OAAO,IAAA5B,iBAAW,EAAC4B,KAAK,EAAE;UAAEpC,WAAW,EAAE;QAAK,CAAC,CAAC;MAClD;IACF,CAAC;EACH,CAAC;AAEL,CAAC,CACF;AAAC+B,OAAA,CAAAE,cAAA,GAAAA,cAAA;AAEFJ,QAAQ,CAACG,WAAW,GAAG,0BAA0B"}
|
|
@@ -20,13 +20,13 @@ var _uniqueID = _interopRequireDefault(require("@semcore/utils/lib/uniqueID"));
|
|
|
20
20
|
var _Trend2 = require("./Trend");
|
|
21
21
|
var _flexBox = require("@semcore/flex-box");
|
|
22
22
|
/*__reshadow-styles__:"../skeleton/skeleton.shadow.css"*/
|
|
23
|
-
var style = ( /*__reshadow_css_start__*/_index.sstyled.insert( /*__inner_css_start__*/"@keyframes
|
|
24
|
-
"__SLineGauge": "
|
|
25
|
-
"_loading": "
|
|
26
|
-
"__SDonutContainer": "
|
|
27
|
-
"__STrendLine": "
|
|
28
|
-
"__STrendBar": "
|
|
29
|
-
"@pulse": "
|
|
23
|
+
var style = ( /*__reshadow_css_start__*/_index.sstyled.insert( /*__inner_css_start__*/"@keyframes pulse_dovxk{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_dovxk_gg_.__loading_dovxk_gg_,.___SLineGauge_dovxk_gg_.__loading_dovxk_gg_,.___STrendBar_dovxk_gg_.__loading_dovxk_gg_,.___STrendLine_dovxk_gg_.__loading_dovxk_gg_{animation-name:pulse_dovxk;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}" /*__inner_css_end__*/, "dovxk_gg_") /*__reshadow_css_end__*/, {
|
|
24
|
+
"__SLineGauge": "___SLineGauge_dovxk_gg_",
|
|
25
|
+
"_loading": "__loading_dovxk_gg_",
|
|
26
|
+
"__SDonutContainer": "___SDonutContainer_dovxk_gg_",
|
|
27
|
+
"__STrendLine": "___STrendLine_dovxk_gg_",
|
|
28
|
+
"__STrendBar": "___STrendBar_dovxk_gg_",
|
|
29
|
+
"@pulse": "pulse_dovxk"
|
|
30
30
|
});
|
|
31
31
|
var TrendLineRoot = /*#__PURE__*/function (_Trend) {
|
|
32
32
|
(0, _inherits2["default"])(TrendLineRoot, _Trend);
|
|
@@ -12,15 +12,15 @@ import { Box } from '@semcore/flex-box';
|
|
|
12
12
|
import resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';
|
|
13
13
|
import { assignProps } from '@semcore/core';
|
|
14
14
|
/*__reshadow-styles__:"./donut.shadow.css"*/
|
|
15
|
-
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/"@keyframes
|
|
16
|
-
"__SLineGauge": "
|
|
17
|
-
"_loading": "
|
|
18
|
-
"__SDonutContainer": "
|
|
19
|
-
"__STrendLine": "
|
|
20
|
-
"__STrendBar": "
|
|
21
|
-
"@pulse": "
|
|
22
|
-
"_animate": "
|
|
23
|
-
"_semi": "
|
|
15
|
+
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/"@keyframes pulse_hc6bn{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_hc6bn_gg_.__loading_hc6bn_gg_,.___SLineGauge_hc6bn_gg_.__loading_hc6bn_gg_,.___STrendBar_hc6bn_gg_.__loading_hc6bn_gg_,.___STrendLine_hc6bn_gg_.__loading_hc6bn_gg_{animation-name:pulse_hc6bn;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SDonutContainer_hc6bn_gg_.__semi_hc6bn_gg_ g{transform:rotate(180deg) translate(-24px,-24px)}.___SDonutContainer_hc6bn_gg_ g{transform:rotate(-90deg) translate(-24px)}.___SDonutContainer_hc6bn_gg_.__animate_hc6bn_gg_ circle{transition:all var(--intergalactic-duration-extra-slow, 500) ease-in-out}" /*__inner_css_end__*/, "hc6bn_gg_") /*__reshadow_css_end__*/, {
|
|
16
|
+
"__SLineGauge": "___SLineGauge_hc6bn_gg_",
|
|
17
|
+
"_loading": "__loading_hc6bn_gg_",
|
|
18
|
+
"__SDonutContainer": "___SDonutContainer_hc6bn_gg_",
|
|
19
|
+
"__STrendLine": "___STrendLine_hc6bn_gg_",
|
|
20
|
+
"__STrendBar": "___STrendBar_hc6bn_gg_",
|
|
21
|
+
"@pulse": "pulse_hc6bn",
|
|
22
|
+
"_animate": "__animate_hc6bn_gg_",
|
|
23
|
+
"_semi": "__semi_hc6bn_gg_"
|
|
24
24
|
});
|
|
25
25
|
var DonutRoot = /*#__PURE__*/function (_Component) {
|
|
26
26
|
_inherits(DonutRoot, _Component);
|
|
@@ -67,7 +67,7 @@ var DonutRoot = /*#__PURE__*/function (_Component) {
|
|
|
67
67
|
"cy": '12',
|
|
68
68
|
"r": radius,
|
|
69
69
|
"strokeWidth": strokeWidth,
|
|
70
|
-
"stroke": resolveColor('
|
|
70
|
+
"stroke": resolveColor('chart-grid-bar-chart-base-bg'),
|
|
71
71
|
"strokeDasharray": loading ? undefined : "".concat(greyStrokeDasharray, " ").concat(baseStrokeDasharray),
|
|
72
72
|
"strokeDashoffset": -1 * valueStrokeDasharray
|
|
73
73
|
})), !loading && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("circle", _ref2.cn("circle", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Donut.js","names":["React","createComponent","Component","Root","sstyled","Box","resolveColorEnhance","assignProps","style","_sstyled","insert","DonutRoot","_Component","_inherits","_super","_createSuper","_classCallCheck","apply","arguments","_createClass","key","value","render","_ref","asProps","_ref2","SDonutContainer","_this$asProps","styles","_this$asProps$color","color","resolveColor","isSemiDonut","loading","strokeWidth","radius","baseStrokeDasharray","Math","PI","valueStrokeDasharray","greyStrokeDasharray","offsetPoint","strokeDasharrayBetweenSpaces","concat","spaceStrokeDasharray","viewBox","createElement","cn","_objectSpread","_assignProps","undefined","Fragment","_defineProperty","animate","ScoreDonut","displayName","ScoreSemiDonut","enhancements","wrapperProps","props"],"sources":["../../../../src/component/score/Donut.tsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, Root, sstyled, ComponentType } from '@semcore/core';\nimport { Box, BoxProps } from '@semcore/flex-box';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\nimport { assignProps } from '@semcore/core';\nimport { CommonScoreProps } from './Score';\n\nimport style from './donut.shadow.css';\n\nexport type ScoreDonutProps = BoxProps & CommonScoreProps;\n\ntype Enhances = {\n resolveColor: ReturnType<typeof resolveColorEnhance>;\n isSemiDonut?: true;\n};\n\nclass DonutRoot extends Component<ScoreDonutProps, {}, {}, Enhances> {\n static enhance = [resolveColorEnhance()];\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 color = 'chart-palette-order-1',\n resolveColor,\n isSemiDonut,\n loading,\n } = this.asProps;\n\n const strokeWidth = isSemiDonut ? 6 : 4;\n const radius = isSemiDonut ? 9 : 10;\n const baseStrokeDasharray = isSemiDonut ? Math.PI * radius : Math.PI * 2 * radius;\n const valueStrokeDasharray = baseStrokeDasharray * (value / 100);\n const greyStrokeDasharray = baseStrokeDasharray * ((100 - value) / 100);\n const offsetPoint = isSemiDonut ? baseStrokeDasharray / (100 / 3) : baseStrokeDasharray / 100;\n\n const strokeDasharrayBetweenSpaces = `${greyStrokeDasharray - 2 * offsetPoint} ${offsetPoint}`;\n\n let spaceStrokeDasharray = `${offsetPoint} ${\n value < 99 ? `${strokeDasharrayBetweenSpaces}` : ''\n } ${baseStrokeDasharray}`;\n\n if (isSemiDonut) {\n spaceStrokeDasharray = `${offsetPoint} ${\n value < 95 ? `${strokeDasharrayBetweenSpaces}` : ''\n } ${baseStrokeDasharray}`;\n }\n\n const viewBox = isSemiDonut ? '0 0 24 12' : '0 0 24 24';\n\n return sstyled(styles)(\n <SDonutContainer render={Box} semi={isSemiDonut}>\n <svg width='100%' height='100%' viewBox={viewBox} fill='none'>\n <g>\n <circle\n cx='12'\n cy='12'\n r={radius}\n strokeWidth={strokeWidth}\n stroke={resolveColor('
|
|
1
|
+
{"version":3,"file":"Donut.js","names":["React","createComponent","Component","Root","sstyled","Box","resolveColorEnhance","assignProps","style","_sstyled","insert","DonutRoot","_Component","_inherits","_super","_createSuper","_classCallCheck","apply","arguments","_createClass","key","value","render","_ref","asProps","_ref2","SDonutContainer","_this$asProps","styles","_this$asProps$color","color","resolveColor","isSemiDonut","loading","strokeWidth","radius","baseStrokeDasharray","Math","PI","valueStrokeDasharray","greyStrokeDasharray","offsetPoint","strokeDasharrayBetweenSpaces","concat","spaceStrokeDasharray","viewBox","createElement","cn","_objectSpread","_assignProps","undefined","Fragment","_defineProperty","animate","ScoreDonut","displayName","ScoreSemiDonut","enhancements","wrapperProps","props"],"sources":["../../../../src/component/score/Donut.tsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, Root, sstyled, ComponentType } from '@semcore/core';\nimport { Box, BoxProps } from '@semcore/flex-box';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\nimport { assignProps } from '@semcore/core';\nimport { CommonScoreProps } from './Score';\n\nimport style from './donut.shadow.css';\n\nexport type ScoreDonutProps = BoxProps & CommonScoreProps;\n\ntype Enhances = {\n resolveColor: ReturnType<typeof resolveColorEnhance>;\n isSemiDonut?: true;\n};\n\nclass DonutRoot extends Component<ScoreDonutProps, {}, {}, Enhances> {\n static enhance = [resolveColorEnhance()];\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 color = 'chart-palette-order-1',\n resolveColor,\n isSemiDonut,\n loading,\n } = this.asProps;\n\n const strokeWidth = isSemiDonut ? 6 : 4;\n const radius = isSemiDonut ? 9 : 10;\n const baseStrokeDasharray = isSemiDonut ? Math.PI * radius : Math.PI * 2 * radius;\n const valueStrokeDasharray = baseStrokeDasharray * (value / 100);\n const greyStrokeDasharray = baseStrokeDasharray * ((100 - value) / 100);\n const offsetPoint = isSemiDonut ? baseStrokeDasharray / (100 / 3) : baseStrokeDasharray / 100;\n\n const strokeDasharrayBetweenSpaces = `${greyStrokeDasharray - 2 * offsetPoint} ${offsetPoint}`;\n\n let spaceStrokeDasharray = `${offsetPoint} ${\n value < 99 ? `${strokeDasharrayBetweenSpaces}` : ''\n } ${baseStrokeDasharray}`;\n\n if (isSemiDonut) {\n spaceStrokeDasharray = `${offsetPoint} ${\n value < 95 ? `${strokeDasharrayBetweenSpaces}` : ''\n } ${baseStrokeDasharray}`;\n }\n\n const viewBox = isSemiDonut ? '0 0 24 12' : '0 0 24 24';\n\n return sstyled(styles)(\n <SDonutContainer render={Box} semi={isSemiDonut}>\n <svg width='100%' height='100%' viewBox={viewBox} fill='none'>\n <g>\n <circle\n cx='12'\n cy='12'\n r={radius}\n strokeWidth={strokeWidth}\n stroke={resolveColor('chart-grid-bar-chart-base-bg')}\n strokeDasharray={\n loading ? undefined : `${greyStrokeDasharray} ${baseStrokeDasharray}`\n }\n strokeDashoffset={-1 * valueStrokeDasharray}\n />\n {!loading && (\n <>\n <circle\n cx='12'\n cy='12'\n r={radius}\n strokeWidth={strokeWidth}\n stroke={resolveColor(color)}\n strokeDasharray={`${valueStrokeDasharray} ${baseStrokeDasharray}`}\n strokeDashoffset={valueStrokeDasharray}\n >\n <animate\n attributeName={'stroke-dashoffset'}\n values={`0;${valueStrokeDasharray}`}\n />\n </circle>\n {value !== 100 && (\n <circle\n cx='12'\n cy='12'\n r={radius}\n strokeWidth={strokeWidth}\n stroke={resolveColor('chart-grid-border')}\n strokeDasharray={spaceStrokeDasharray}\n strokeDashoffset={-1 * valueStrokeDasharray}\n />\n )}\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,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,eAAe,IAAIC,SAAS,EAAEC,IAAI,EAAEC,OAAO,QAAuB,eAAe;AACxF,SAASC,GAAG,QAAkB,mBAAmB;AACjD,OAAOC,mBAAmB,MAAM,iDAAiD;AACjF,SAASC,WAAW,QAAQ,eAAe;AAAC;AAAA,IAAAC,KAAA,+BAAAC,QAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;EAAA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EAAK;QACxC,OAAOpD,WAAW,CAACoD,KAAK,EAAE;UAAE3B,WAAW,EAAE;QAAK,CAAC,CAAC;MAClD;IACF,CAAC;EACH,CAAC;AAEL,CAAC,CACF;AAEDwB,cAAc,CAACD,WAAW,GAAG,0BAA0B"}
|
|
@@ -5,29 +5,31 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
5
5
|
import _createSuper from "@babel/runtime/helpers/createSuper";
|
|
6
6
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
7
|
import { sstyled as _sstyled } from "@semcore/utils/lib/core/index";
|
|
8
|
+
import { assignProps as _assignProps3 } from "@semcore/core";
|
|
9
|
+
import { assignProps as _assignProps2 } from "@semcore/core";
|
|
8
10
|
import { assignProps as _assignProps } from "@semcore/core";
|
|
9
11
|
import React from 'react';
|
|
10
12
|
import createComponent, { Component, Root, sstyled } from '@semcore/core';
|
|
11
13
|
import { Box, Flex } from '@semcore/flex-box';
|
|
12
14
|
import resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';
|
|
13
15
|
/*__reshadow-styles__:"./line.shadow.css"*/
|
|
14
|
-
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/"@keyframes
|
|
15
|
-
"__SLineGauge": "
|
|
16
|
-
"_loading": "
|
|
17
|
-
"__SDonutContainer": "
|
|
18
|
-
"__STrendLine": "
|
|
19
|
-
"__STrendBar": "
|
|
20
|
-
"@pulse": "
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"--color": "--
|
|
27
|
-
"_segments": "
|
|
28
|
-
"__SLineGaugeSegment": "
|
|
29
|
-
"
|
|
30
|
-
"@move-line": "move-
|
|
16
|
+
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/"@keyframes pulse_1bky2{0%,to{opacity:1}50%{opacity:.4}}@keyframes move-line_1bky2{0%{transform:translateX(0)}to{transform:translateX(100%)}}.___SDonutContainer_1bky2_gg_.__loading_1bky2_gg_,.___SLineGauge_1bky2_gg_.__loading_1bky2_gg_,.___STrendBar_1bky2_gg_.__loading_1bky2_gg_,.___STrendLine_1bky2_gg_.__loading_1bky2_gg_{animation-name:pulse_1bky2;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SLineGauge_1bky2_gg_{height:8px;background-color:var(--intergalactic-chart-grid-bar-chart-base-bg, #e0e1e9);border-radius:var(--intergalactic-chart-rounded, 2px);overflow:hidden;position:relative}.___SLineValue_1bky2_gg_{height:8px;border-radius:var(--intergalactic-chart-rounded, 2px)0 0 var(--intergalactic-chart-rounded, 2px)}.___SLineValue_1bky2_gg_.__percent_1bky2_gg_{width:var(--percent_1bky2)}.___SLineSegmentItem_1bky2_gg_.__color_1bky2_gg_,.___SLineValue_1bky2_gg_.__color_1bky2_gg_{background-color:var(--color_1bky2, var(--intergalactic-chart-palette-order-1, #2bb3ff))}.___SLineGauge_1bky2_gg_.__segments_1bky2_gg_{border-radius:var(--intergalactic-progress-bar-rounded, 6px)}.___SAnimationLine_1bky2_gg_,.___SLineGaugeSegment_1bky2_gg_{position:absolute;top:0;left:0;right:0;bottom:0}.___SLineSegmentItem_1bky2_gg_:last-child{margin-right:0;border-right:none}.___SLineSegmentItem_1bky2_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_1bky2_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_1bky2;animation-duration:.5s;animation-timing-function:ease-in-out;animation-fill-mode:forwards}" /*__inner_css_end__*/, "1bky2_gg_") /*__reshadow_css_end__*/, {
|
|
17
|
+
"__SLineGauge": "___SLineGauge_1bky2_gg_",
|
|
18
|
+
"_loading": "__loading_1bky2_gg_",
|
|
19
|
+
"__SDonutContainer": "___SDonutContainer_1bky2_gg_",
|
|
20
|
+
"__STrendLine": "___STrendLine_1bky2_gg_",
|
|
21
|
+
"__STrendBar": "___STrendBar_1bky2_gg_",
|
|
22
|
+
"@pulse": "pulse_1bky2",
|
|
23
|
+
"__SLineValue": "___SLineValue_1bky2_gg_",
|
|
24
|
+
"_percent": "__percent_1bky2_gg_",
|
|
25
|
+
"--percent": "--percent_1bky2",
|
|
26
|
+
"_color": "__color_1bky2_gg_",
|
|
27
|
+
"__SLineSegmentItem": "___SLineSegmentItem_1bky2_gg_",
|
|
28
|
+
"--color": "--color_1bky2",
|
|
29
|
+
"_segments": "__segments_1bky2_gg_",
|
|
30
|
+
"__SLineGaugeSegment": "___SLineGaugeSegment_1bky2_gg_",
|
|
31
|
+
"__SAnimationLine": "___SAnimationLine_1bky2_gg_",
|
|
32
|
+
"@move-line": "move-line_1bky2"
|
|
31
33
|
});
|
|
32
34
|
var LineRoot = /*#__PURE__*/function (_Component) {
|
|
33
35
|
_inherits(LineRoot, _Component);
|
|
@@ -37,28 +39,56 @@ var LineRoot = /*#__PURE__*/function (_Component) {
|
|
|
37
39
|
return _super.apply(this, arguments);
|
|
38
40
|
}
|
|
39
41
|
_createClass(LineRoot, [{
|
|
42
|
+
key: "getSegmentProps",
|
|
43
|
+
value: function getSegmentProps(segmentProps) {
|
|
44
|
+
var _this$asProps = this.asProps,
|
|
45
|
+
children = _this$asProps.children,
|
|
46
|
+
resolveColor = _this$asProps.resolveColor;
|
|
47
|
+
var sum = 0;
|
|
48
|
+
React.Children.forEach(children, function (child) {
|
|
49
|
+
if ( /*#__PURE__*/React.isValidElement(child)) {
|
|
50
|
+
sum = sum + child.props.value;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
var width = sum > 0 ? 100 * segmentProps.value / sum : 0;
|
|
54
|
+
return {
|
|
55
|
+
w: "".concat(width, "%"),
|
|
56
|
+
'use:color': resolveColor(segmentProps.color)
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}, {
|
|
40
60
|
key: "render",
|
|
41
61
|
value: function render() {
|
|
42
62
|
var _ref = this.asProps,
|
|
43
|
-
|
|
63
|
+
_ref5;
|
|
44
64
|
var SLineGauge = Box;
|
|
45
65
|
var SLineValue = Box;
|
|
66
|
+
var SAnimationLine = Box;
|
|
46
67
|
var SLineGaugeSegment = Flex;
|
|
47
68
|
var SLineSegmentItem = Box;
|
|
48
|
-
var _this$
|
|
49
|
-
value = _this$
|
|
50
|
-
styles = _this$
|
|
51
|
-
_this$
|
|
52
|
-
color = _this$
|
|
53
|
-
resolveColor = _this$
|
|
54
|
-
|
|
55
|
-
|
|
69
|
+
var _this$asProps2 = this.asProps,
|
|
70
|
+
value = _this$asProps2.value,
|
|
71
|
+
styles = _this$asProps2.styles,
|
|
72
|
+
_this$asProps2$color = _this$asProps2.color,
|
|
73
|
+
color = _this$asProps2$color === void 0 ? 'chart-palette-order-1' : _this$asProps2$color,
|
|
74
|
+
resolveColor = _this$asProps2.resolveColor,
|
|
75
|
+
loading = _this$asProps2.loading,
|
|
76
|
+
children = _this$asProps2.children,
|
|
77
|
+
Children = _this$asProps2.Children,
|
|
78
|
+
animate = _this$asProps2.animate;
|
|
79
|
+
if (children !== undefined) {
|
|
80
|
+
var _ref3;
|
|
81
|
+
return _ref3 = sstyled(styles), /*#__PURE__*/React.createElement(SLineGauge, _ref3.cn("SLineGauge", _objectSpread({}, _assignProps({
|
|
82
|
+
"segments": true
|
|
83
|
+
}, _ref))), /*#__PURE__*/React.createElement(SLineGaugeSegment, _ref3.cn("SLineGaugeSegment", {}), /*#__PURE__*/React.createElement(Children, _ref3.cn("Children", {}))), animate && /*#__PURE__*/React.createElement(SAnimationLine, _ref3.cn("SAnimationLine", {})));
|
|
84
|
+
}
|
|
85
|
+
var segments = this.asProps.segments;
|
|
56
86
|
var SegmentItems = [];
|
|
57
87
|
if (segments) {
|
|
58
88
|
for (var i = 0; i < segments; i++) {
|
|
59
|
-
var
|
|
89
|
+
var _ref4;
|
|
60
90
|
var width = "calc((100% - ".concat(segments - 1, "px) / ").concat(segments, ")");
|
|
61
|
-
SegmentItems.push((
|
|
91
|
+
SegmentItems.push((_ref4 = sstyled(styles), /*#__PURE__*/React.createElement(SLineSegmentItem, _ref4.cn("SLineSegmentItem", {
|
|
62
92
|
"key": i,
|
|
63
93
|
"color": i < value ? resolveColor(color) : undefined,
|
|
64
94
|
"w": width
|
|
@@ -69,19 +99,30 @@ var LineRoot = /*#__PURE__*/function (_Component) {
|
|
|
69
99
|
if (segments) {
|
|
70
100
|
percent = "".concat(value / segments * 100, "%");
|
|
71
101
|
}
|
|
72
|
-
return
|
|
102
|
+
return _ref5 = sstyled(styles), /*#__PURE__*/React.createElement(SLineGauge, _ref5.cn("SLineGauge", _objectSpread({}, _assignProps2({}, _ref))), !loading && /*#__PURE__*/React.createElement(SLineValue, _ref5.cn("SLineValue", {
|
|
73
103
|
"w": percent,
|
|
74
104
|
"color": resolveColor(color)
|
|
75
|
-
})), Boolean(SegmentItems.length) && /*#__PURE__*/React.createElement(SLineGaugeSegment,
|
|
105
|
+
})), Boolean(SegmentItems.length) && /*#__PURE__*/React.createElement(SLineGaugeSegment, _ref5.cn("SLineGaugeSegment", {}), SegmentItems), animate && /*#__PURE__*/React.createElement(SAnimationLine, _ref5.cn("SAnimationLine", {})));
|
|
76
106
|
}
|
|
77
107
|
}]);
|
|
78
108
|
return LineRoot;
|
|
79
109
|
}(Component);
|
|
80
110
|
_defineProperty(LineRoot, "enhance", [resolveColorEnhance()]);
|
|
111
|
+
_defineProperty(LineRoot, "displayName", 'ScoreLine');
|
|
81
112
|
_defineProperty(LineRoot, "style", style);
|
|
82
113
|
_defineProperty(LineRoot, "defaultProps", {
|
|
83
114
|
animate: true
|
|
84
115
|
});
|
|
85
|
-
|
|
116
|
+
function Segment(props) {
|
|
117
|
+
var _ref2 = arguments[0],
|
|
118
|
+
_ref6;
|
|
119
|
+
var styles = props.styles;
|
|
120
|
+
var SLineSegmentItem = Box;
|
|
121
|
+
return _ref6 = sstyled(styles), /*#__PURE__*/React.createElement(SLineSegmentItem, _ref6.cn("SLineSegmentItem", _objectSpread({}, _assignProps3({}, _ref2))));
|
|
122
|
+
}
|
|
123
|
+
Segment.displayName = 'Segment';
|
|
124
|
+
export var ScoreLine = createComponent(LineRoot, {
|
|
125
|
+
Segment: Segment
|
|
126
|
+
});
|
|
86
127
|
ScoreLine.displayName = 'MiniChart.ScoreLine';
|
|
87
128
|
//# sourceMappingURL=Line.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Line.js","names":["React","createComponent","Component","Root","sstyled","Box","Flex","resolveColorEnhance","style","_sstyled","insert","LineRoot","_Component","_inherits","_super","_createSuper","_classCallCheck","apply","arguments","_createClass","key","value","
|
|
1
|
+
{"version":3,"file":"Line.js","names":["React","createComponent","Component","Root","sstyled","Box","Flex","resolveColorEnhance","style","_sstyled","insert","LineRoot","_Component","_inherits","_super","_createSuper","_classCallCheck","apply","arguments","_createClass","key","value","getSegmentProps","segmentProps","_this$asProps","asProps","children","resolveColor","sum","Children","forEach","child","isValidElement","props","width","w","concat","color","render","_ref","_ref5","SLineGauge","SLineValue","SAnimationLine","SLineGaugeSegment","SLineSegmentItem","_this$asProps2","styles","_this$asProps2$color","loading","animate","undefined","_ref3","createElement","cn","_objectSpread","_assignProps","segments","SegmentItems","i","_ref4","push","percent","_assignProps2","Boolean","length","_defineProperty","Segment","_ref2","arguments[0]","_ref6","_assignProps3","displayName","ScoreLine"],"sources":["../../../../src/component/score/Line.tsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, Root, sstyled } from '@semcore/core';\nimport { Box, Flex } from '@semcore/flex-box';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\n\nimport style from './line.shadow.css';\nimport {\n Enhances,\n ScoreLineComponent,\n ScoreLineGaugeProps,\n SegmentProps,\n InnerSegmentProps,\n} from './Line.types';\n\nclass LineRoot extends Component<ScoreLineGaugeProps, {}, {}, Enhances> {\n static enhance = [resolveColorEnhance()];\n static displayName = 'ScoreLine';\n\n static style = style;\n\n static defaultProps = {\n animate: true,\n };\n\n getSegmentProps(segmentProps: SegmentProps) {\n const { children, resolveColor } = this.asProps;\n\n let sum = 0;\n React.Children.forEach(children, (child) => {\n if (React.isValidElement<SegmentProps>(child)) {\n sum = sum + child.props.value;\n }\n });\n\n const width = sum > 0 ? (100 * segmentProps.value) / sum : 0;\n\n return {\n w: `${width}%`,\n 'use:color': resolveColor(segmentProps.color),\n };\n }\n\n render() {\n const SLineGauge = Root;\n const SLineValue = Box;\n const SAnimationLine = Box;\n const SLineGaugeSegment = Flex;\n const SLineSegmentItem = Box;\n const {\n value,\n styles,\n color = 'chart-palette-order-1',\n resolveColor,\n loading,\n children,\n Children,\n animate,\n } = this.asProps;\n\n if (children !== undefined) {\n return sstyled(styles)(\n <SLineGauge render={Box} segments>\n <SLineGaugeSegment>\n <Children />\n </SLineGaugeSegment>\n {animate && <SAnimationLine />}\n </SLineGauge>,\n );\n }\n\n const { segments } = this.asProps;\n\n const SegmentItems = [];\n\n if (segments) {\n for (let i = 0; i < segments; i++) {\n const width = `calc((100% - ${segments - 1}px) / ${segments})`;\n\n SegmentItems.push(\n sstyled(styles)(\n <SLineSegmentItem\n key={i}\n color={i < value ? resolveColor(color) : undefined}\n w={width}\n />,\n ),\n );\n }\n }\n\n let percent = `${value}%`;\n\n if (segments) {\n percent = `${(value / segments) * 100}%`;\n }\n\n return sstyled(styles)(\n <SLineGauge render={Box}>\n {!loading && <SLineValue w={percent} color={resolveColor(color)} />}\n {Boolean(SegmentItems.length) && <SLineGaugeSegment>{SegmentItems}</SLineGaugeSegment>}\n {animate && <SAnimationLine />}\n </SLineGauge>,\n );\n }\n}\n\nfunction Segment(props: InnerSegmentProps) {\n const { styles } = props;\n const SLineSegmentItem = Root;\n\n return sstyled(styles)(<SLineSegmentItem render={Box} />);\n}\nSegment.displayName = 'Segment';\n\nexport const ScoreLine: Score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ACO,MAAM,CAAC,iBAAIjE,KAAA,CAAAqD,aAAA,CAACT,iBAAiB,EAAAJ,KAAA,CAAAc,EAAA,2BAAEI,YAAY,CAAqB,EACrFR,OAAO,iBAAIlD,KAAA,CAAAqD,aAAA,CAACV,cAAc,EAAAH,KAAA,CAAAc,EAAA,uBAAG,CACnB;IAEjB;EAAC;EAAA,OAAA3C,QAAA;AAAA,EAzFoBT,SAAS;AAAAgE,eAAA,CAA1BvD,QAAQ,aACK,CAACJ,mBAAmB,EAAE,CAAC;AAAA2D,eAAA,CADpCvD,QAAQ,iBAES,WAAW;AAAAuD,eAAA,CAF5BvD,QAAQ,WAIGH,KAAK;AAAA0D,eAAA,CAJhBvD,QAAQ,kBAMU;EACpBuC,OAAO,EAAE;AACX,CAAC;AAoFH,SAASiB,OAAOA,CAAClC,KAAwB,EAAE;EAAA,IAAAmC,KAAA,GAAAC,YAAA;IAAAC,KAAA;EACzC,IAAQvB,MAAM,GAAKd,KAAK,CAAhBc,MAAM;EACd,IAAMF,gBAAgB,GAE2BxC,GAAG;EAApD,OAAAiE,KAAA,GAAOlE,OAAO,CAAC2C,MAAM,CAAC,eAAC/C,KAAA,CAAAqD,aAAA,CAACR,gBAAgB,EAAAyB,KAAA,CAAAhB,EAAA,qBAAAC,aAAA,KAAAgB,aAAA,KAAAH,KAAA,IAAgB;AAC1D;AACAD,OAAO,CAACK,WAAW,GAAG,SAAS;AAE/B,OAAO,IAAMC,SAA6B,GAAGxE,eAAe,CAACU,QAAQ,EAAE;EACrEwD,OAAO,EAAPA;AACF,CAAC,CAAC;AAEFM,SAAS,CAACD,WAAW,GAAG,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Line.types.js","names":[],"sources":["../../../../src/component/score/Line.types.ts"],"sourcesContent":["import { Intergalactic, ComponentType } from '@semcore/utils/lib/core';\nimport { CommonScoreProps } from './Score';\nimport React from 'react';\nimport { BoxProps, Box } from '@semcore/flex-box';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\n\ntype Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N\n ? Acc[number]\n : Enumerate<N, [...Acc, Acc['length']]>;\n\ntype Range<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;\n\nexport type SegmentColor = `chart-palette-order-${Range<1, 24>}`;\n\nexport type SegmentProps = {\n value: number;\n /**\n * Color of value\n */\n color: SegmentColor;\n};\n\ntype SegmentComponent = React.FC<SegmentProps>;\n\nexport type InnerSegmentProps = SegmentProps & {\n styles: React.DetailedHTMLProps<React.StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement>;\n};\n\ntype ValuedScoreProps = {\n /**\n * Value of score (in percents from 0 to 100) or count of selected segments (for Line with segments)\n */\n value: number;\n /**\n * Color of value\n */\n color?: SegmentColor;\n /**\n * Count of line segments\n */\n segments?: number;\n /**\n * We don't accept children in this way\n */\n children?: never;\n};\n\ntype CustomRenderScoreProps = {\n children: SegmentComponent[];\n};\n\nexport type ScoreLineGaugeProps = BoxProps &\n Intergalactic.InternalTypings.EfficientOmit<CommonScoreProps, 'value' | 'color'> &\n (ValuedScoreProps | CustomRenderScoreProps);\n\nexport type Enhances = {\n resolveColor: ReturnType<typeof resolveColorEnhance>;\n};\n\nexport type ScoreLineComponent = ComponentType<ScoreLineGaugeProps, {}, {}, Enhances> & {\n Segment: Intergalactic.Component<typeof Box, SegmentProps>;\n};\n"],"mappings":""}
|
|
@@ -2,22 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
SLineGauge {
|
|
4
4
|
height: 8px;
|
|
5
|
-
background-color: var(--intergalactic-
|
|
5
|
+
background-color: var(--intergalactic-chart-grid-bar-chart-base-bg, #e0e1e9);
|
|
6
6
|
border-radius: var(--intergalactic-chart-rounded, 2px);
|
|
7
7
|
overflow: hidden;
|
|
8
8
|
position: relative;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
SLineGauge[animate] SLineValue {
|
|
12
|
-
transition: all var(--intergalactic-duration-extra-slow, 500) ease-in-out;
|
|
13
|
-
animation-name: move-line;
|
|
14
|
-
animation-duration: 0.5s;
|
|
15
|
-
animation-timing-function: ease-in-out;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
11
|
SLineValue {
|
|
19
12
|
height: 8px;
|
|
20
|
-
background-color: var(--intergalactic-chart-palette-order-1, #2bb3ff);
|
|
21
13
|
border-radius: var(--intergalactic-chart-rounded, 2px) 0 0 var(--intergalactic-chart-rounded, 2px);
|
|
22
14
|
}
|
|
23
15
|
|
|
@@ -25,7 +17,7 @@ SLineValue[percent] {
|
|
|
25
17
|
width: var(--percent);
|
|
26
18
|
}
|
|
27
19
|
|
|
28
|
-
SLineValue[color] {
|
|
20
|
+
SLineValue[color], SLineSegmentItem[color] {
|
|
29
21
|
background-color: var(--color, var(--intergalactic-chart-palette-order-1, #2bb3ff));
|
|
30
22
|
}
|
|
31
23
|
|
|
@@ -33,11 +25,7 @@ SLineGauge[segments] {
|
|
|
33
25
|
border-radius: var(--intergalactic-progress-bar-rounded, 6px);
|
|
34
26
|
}
|
|
35
27
|
|
|
36
|
-
|
|
37
|
-
border-radius: var(--intergalactic-progress-bar-rounded, 6px) 0 0 var(--intergalactic-progress-bar-rounded, 6px);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
SLineGaugeSegment {
|
|
28
|
+
SLineGaugeSegment, SAnimationLine {
|
|
41
29
|
position: absolute;
|
|
42
30
|
top: 0;
|
|
43
31
|
left: 0;
|
|
@@ -53,14 +41,22 @@ SLineSegmentItem:last-child {
|
|
|
53
41
|
SLineSegmentItem {
|
|
54
42
|
height: 8px;
|
|
55
43
|
background: transparent;
|
|
56
|
-
margin-right: 1px;
|
|
57
44
|
border-right-color: var(--intergalactic-chart-grid-border, #ffffff);
|
|
58
45
|
border-right-style: solid;
|
|
59
46
|
border-right-width: 1px;
|
|
60
47
|
box-sizing: content-box;
|
|
61
48
|
}
|
|
62
49
|
|
|
50
|
+
SAnimationLine {
|
|
51
|
+
background-color: var(--intergalactic-chart-grid-bar-chart-base-bg, #e0e1e9);
|
|
52
|
+
transition: all var(--intergalactic-duration-extra-slow, 500) ease-in-out;
|
|
53
|
+
animation-name: move-line;
|
|
54
|
+
animation-duration: 0.5s;
|
|
55
|
+
animation-timing-function: ease-in-out;
|
|
56
|
+
animation-fill-mode: forwards;
|
|
57
|
+
}
|
|
58
|
+
|
|
63
59
|
@keyframes move-line {
|
|
64
|
-
0% {transform: translateX(
|
|
65
|
-
100% {transform: translateX(
|
|
60
|
+
0% {transform: translateX(0);}
|
|
61
|
+
100% {transform: translateX(100%);}
|
|
66
62
|
}
|
|
@@ -12,13 +12,13 @@ import resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance
|
|
|
12
12
|
import { Trend } from './Trend';
|
|
13
13
|
import { Box } from '@semcore/flex-box';
|
|
14
14
|
/*__reshadow-styles__:"../skeleton/skeleton.shadow.css"*/
|
|
15
|
-
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/"@keyframes
|
|
16
|
-
"__SLineGauge": "
|
|
17
|
-
"_loading": "
|
|
18
|
-
"__SDonutContainer": "
|
|
19
|
-
"__STrendLine": "
|
|
20
|
-
"__STrendBar": "
|
|
21
|
-
"@pulse": "
|
|
15
|
+
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/"@keyframes pulse_dovxk{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_dovxk_gg_.__loading_dovxk_gg_,.___SLineGauge_dovxk_gg_.__loading_dovxk_gg_,.___STrendBar_dovxk_gg_.__loading_dovxk_gg_,.___STrendLine_dovxk_gg_.__loading_dovxk_gg_{animation-name:pulse_dovxk;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}" /*__inner_css_end__*/, "dovxk_gg_") /*__reshadow_css_end__*/, {
|
|
16
|
+
"__SLineGauge": "___SLineGauge_dovxk_gg_",
|
|
17
|
+
"_loading": "__loading_dovxk_gg_",
|
|
18
|
+
"__SDonutContainer": "___SDonutContainer_dovxk_gg_",
|
|
19
|
+
"__STrendLine": "___STrendLine_dovxk_gg_",
|
|
20
|
+
"__STrendBar": "___STrendBar_dovxk_gg_",
|
|
21
|
+
"@pulse": "pulse_dovxk"
|
|
22
22
|
});
|
|
23
23
|
var TrendBarRoot = /*#__PURE__*/function (_Trend) {
|
|
24
24
|
_inherits(TrendBarRoot, _Trend);
|
|
@@ -73,7 +73,7 @@ var TrendBarRoot = /*#__PURE__*/function (_Trend) {
|
|
|
73
73
|
"height": '100%',
|
|
74
74
|
"viewBox": "0 0 ".concat(this.svgWidth, " ").concat(this.svgHeight)
|
|
75
75
|
}), this.data.map(function (barItem, index) {
|
|
76
|
-
var color = resolveColor('
|
|
76
|
+
var color = resolveColor('chart-palette-order-other-data');
|
|
77
77
|
if (barItem.color) {
|
|
78
78
|
color = resolveColor(barItem.color);
|
|
79
79
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Bar.js","names":["React","createComponent","assignProps","Root","sstyled","resolveColorEnhance","Trend","Box","style","_sstyled","insert","TrendBarRoot","_Trend","_inherits","_super","_createSuper","_classCallCheck","apply","arguments","_createClass","key","get","value","_this$asProps","asProps","data","loading","defaultData","render","_ref","_ref2","_this","STrendBar","_this$asProps2","styles","resolveColor","isHistogram","animate","step","defaultWidth","length","createElement","cn","_objectSpread","_assignProps","containerRef","concat","svgWidth","svgHeight","map","barItem","index","color","x","y","defaultHeight","width","height","fill","attributeName","values","dur","_defineProperty","TrendBar","displayName","TrendHistogram","enhancements","wrapperProps","props"],"sources":["../../../../src/component/trend/Bar.tsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { ComponentType, assignProps, Root, sstyled } from '@semcore/core';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\nimport { Trend, CommonTrendProps } from './Trend';\nimport { Box } from '@semcore/flex-box';\n\nimport style from '../skeleton/skeleton.shadow.css';\n\ntype BarItem = {\n /**\n * Value\n */\n value: number;\n /**\n * Color of value\n */\n color?: string;\n};\n\nexport type TrendBarProps = CommonTrendProps & {\n /**\n * Data to bar chart\n */\n data: BarItem[];\n};\n\ntype Enhances = {\n resolveColor: ReturnType<typeof resolveColorEnhance>;\n isHistogram?: true;\n};\n\nclass TrendBarRoot extends Trend<TrendBarProps, Enhances> {\n static enhance = [resolveColorEnhance()];\n\n static style = style;\n\n static defaultProps = {\n animate: true,\n };\n\n get defaultData(): BarItem[] {\n return [{ value: 20 }, { value: 80 }, { value: 45 }, { value: 10 }];\n }\n\n get data(): BarItem[] {\n const { data, loading } = this.asProps;\n\n if (loading) {\n return this.defaultData;\n }\n\n return data;\n }\n\n render() {\n const STrendBar = Root;\n const { styles, resolveColor, isHistogram, animate, loading } = this.asProps;\n const step = this.defaultWidth / this.data.length;\n\n return sstyled(styles)(\n <STrendBar render={Box} ref={this.containerRef} __excludeProps={['data']}>\n <svg width='100%' height='100%' viewBox={`0 0 ${this.svgWidth} ${this.svgHeight}`}>\n {this.data.map((barItem, index) => {\n let color = resolveColor('
|
|
1
|
+
{"version":3,"file":"Bar.js","names":["React","createComponent","assignProps","Root","sstyled","resolveColorEnhance","Trend","Box","style","_sstyled","insert","TrendBarRoot","_Trend","_inherits","_super","_createSuper","_classCallCheck","apply","arguments","_createClass","key","get","value","_this$asProps","asProps","data","loading","defaultData","render","_ref","_ref2","_this","STrendBar","_this$asProps2","styles","resolveColor","isHistogram","animate","step","defaultWidth","length","createElement","cn","_objectSpread","_assignProps","containerRef","concat","svgWidth","svgHeight","map","barItem","index","color","x","y","defaultHeight","width","height","fill","attributeName","values","dur","_defineProperty","TrendBar","displayName","TrendHistogram","enhancements","wrapperProps","props"],"sources":["../../../../src/component/trend/Bar.tsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { ComponentType, assignProps, Root, sstyled } from '@semcore/core';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\nimport { Trend, CommonTrendProps } from './Trend';\nimport { Box } from '@semcore/flex-box';\n\nimport style from '../skeleton/skeleton.shadow.css';\n\ntype BarItem = {\n /**\n * Value\n */\n value: number;\n /**\n * Color of value\n */\n color?: string;\n};\n\nexport type TrendBarProps = CommonTrendProps & {\n /**\n * Data to bar chart\n */\n data: BarItem[];\n};\n\ntype Enhances = {\n resolveColor: ReturnType<typeof resolveColorEnhance>;\n isHistogram?: true;\n};\n\nclass TrendBarRoot extends Trend<TrendBarProps, Enhances> {\n static enhance = [resolveColorEnhance()];\n\n static style = style;\n\n static defaultProps = {\n animate: true,\n };\n\n get defaultData(): BarItem[] {\n return [{ value: 20 }, { value: 80 }, { value: 45 }, { value: 10 }];\n }\n\n get data(): BarItem[] {\n const { data, loading } = this.asProps;\n\n if (loading) {\n return this.defaultData;\n }\n\n return data;\n }\n\n render() {\n const STrendBar = Root;\n const { styles, resolveColor, isHistogram, animate, loading } = this.asProps;\n const step = this.defaultWidth / this.data.length;\n\n return sstyled(styles)(\n <STrendBar render={Box} ref={this.containerRef} __excludeProps={['data']}>\n <svg width='100%' height='100%' viewBox={`0 0 ${this.svgWidth} ${this.svgHeight}`}>\n {this.data.map((barItem, index) => {\n let color = resolveColor('chart-palette-order-other-data');\n\n if (barItem.color) {\n color = resolveColor(barItem.color);\n }\n\n return (\n <rect\n key={index}\n x={step * index}\n y={this.defaultHeight - barItem.value}\n width={isHistogram ? step : step * 0.8}\n height={barItem.value}\n fill={color}\n >\n {animate && !loading && (\n <animate\n attributeName={'y'}\n values={`${this.defaultHeight};${this.defaultHeight - barItem.value}`}\n dur={'500ms'}\n />\n )}\n </rect>\n );\n })}\n </svg>\n </STrendBar>,\n );\n }\n}\n\nexport const TrendBar: ComponentType<TrendBarProps, {}, {}, Enhances> =\n createComponent(TrendBarRoot);\n\nTrendBar.displayName = 'MiniChart.TrendBar';\n\nexport const TrendHistogram: ComponentType<TrendBarProps, {}, {}, Enhances> = createComponent(\n TrendBarRoot,\n {},\n {\n enhancements: [\n () => {\n return {\n wrapperProps: (props: TrendBarProps) => {\n return assignProps(props, { isHistogram: true });\n },\n };\n },\n ],\n },\n);\n\nTrendBar.displayName = 'MiniChart.TrendHistogram';\n"],"mappings":";;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,eAAe,IAAmBC,WAAW,EAAEC,IAAI,EAAEC,OAAO,QAAQ,eAAe;AAC1F,OAAOC,mBAAmB,MAAM,iDAAiD;AACjF,SAASC,KAAK,QAA0B,SAAS;AACjD,SAASC,GAAG,QAAQ,mBAAmB;AAAC;AAAA,IAAAC,KAAA,+BAAAC,QAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,IA2BlCC,YAAY,0BAAAC,MAAA;EAAAC,SAAA,CAAAF,YAAA,EAAAC,MAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,YAAA;EAAA,SAAAA,aAAA;IAAAK,eAAA,OAAAL,YAAA;IAAA,OAAAG,MAAA,CAAAG,KAAA,OAAAC,SAAA;EAAA;EAAAC,YAAA,CAAAR,YAAA;IAAAS,GAAA;IAAAC,GAAA,EAShB,SAAAA,IAAA,EAA6B;MAC3B,OAAO,CAAC;QAAEC,KAAK,EAAE;MAAG,CAAC,EAAE;QAAEA,KAAK,EAAE;MAAG,CAAC,EAAE;QAAEA,KAAK,EAAE;MAAG,CAAC,EAAE;QAAEA,KAAK,EAAE;MAAG,CAAC,CAAC;IACrE;EAAC;IAAAF,GAAA;IAAAC,GAAA,EAED,SAAAA,IAAA,EAAsB;MACpB,IAAAE,aAAA,GAA0B,IAAI,CAACC,OAAO;QAA9BC,IAAI,GAAAF,aAAA,CAAJE,IAAI;QAAEC,OAAO,GAAAH,aAAA,CAAPG,OAAO;MAErB,IAAIA,OAAO,EAAE;QACX,OAAO,IAAI,CAACC,WAAW;MACzB;MAEA,OAAOF,IAAI;IACb;EAAC;IAAAL,GAAA;IAAAE,KAAA,EAED,SAAAM,OAAA,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AAM;UACtCkC,KAAK,EAAEpB,WAAW,GAAGE,IAAI,GAAGA,IAAI,GAAG,GAAI;UACvCmB,MAAM,EAAEP,OAAO,CAAC5B,KAAM;UACtBoC,IAAI,EAAEN;QAAM,GAEXf,OAAO,IAAI,CAACX,OAAO,iBAClB1B,KAAA,CAAAyC,aAAA;UACEkB,aAAa,EAAE,GAAI;UACnBC,MAAM,KAAAd,MAAA,CAAKf,KAAI,CAACwB,aAAa,OAAAT,MAAA,CAAIf,KAAI,CAACwB,aAAa,GAAGL,OAAO,CAAC5B,KAAK,CAAG;UACtEuC,GAAG,EAAE;QAAQ,EAEhB,CACI;MAEX,CAAC,CAAC,CACE,CACI;IAEhB;EAAC;EAAA,OAAAlD,YAAA;AAAA,EA5DwBL,KAAK;AAAAwD,eAAA,CAA1BnD,YAAY,aACC,CAACN,mBAAmB,EAAE,CAAC;AAAAyD,eAAA,CADpCnD,YAAY,WAGDH,KAAK;AAAAsD,eAAA,CAHhBnD,YAAY,kBAKM;EACpB0B,OAAO,EAAE;AACX,CAAC;AAwDH,OAAO,IAAM0B,QAAwD,GACnE9D,eAAe,CAACU,YAAY,CAAC;AAE/BoD,QAAQ,CAACC,WAAW,GAAG,oBAAoB;AAE3C,OAAO,IAAMC,cAA8D,GAAGhE,eAAe,CAC3FU,YAAY,EACZ,CAAC,CAAC,EACF;EACEuD,YAAY,EAAE,CACZ,YAAM;IACJ,OAAO;MACLC,YAAY,EAAE,SAAAA,aAACC,KAAoB,EAAK;QACtC,OAAOlE,WAAW,CAACkE,KAAK,EAAE;UAAEhC,WAAW,EAAE;QAAK,CAAC,CAAC;MAClD;IACF,CAAC;EACH,CAAC;AAEL,CAAC,CACF;AAED2B,QAAQ,CAACC,WAAW,GAAG,0BAA0B"}
|
|
@@ -13,13 +13,13 @@ import uniqueIDEnhancement from '@semcore/utils/lib/uniqueID';
|
|
|
13
13
|
import { Trend } from './Trend';
|
|
14
14
|
import { Box } from '@semcore/flex-box';
|
|
15
15
|
/*__reshadow-styles__:"../skeleton/skeleton.shadow.css"*/
|
|
16
|
-
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/"@keyframes
|
|
17
|
-
"__SLineGauge": "
|
|
18
|
-
"_loading": "
|
|
19
|
-
"__SDonutContainer": "
|
|
20
|
-
"__STrendLine": "
|
|
21
|
-
"__STrendBar": "
|
|
22
|
-
"@pulse": "
|
|
16
|
+
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/"@keyframes pulse_dovxk{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_dovxk_gg_.__loading_dovxk_gg_,.___SLineGauge_dovxk_gg_.__loading_dovxk_gg_,.___STrendBar_dovxk_gg_.__loading_dovxk_gg_,.___STrendLine_dovxk_gg_.__loading_dovxk_gg_{animation-name:pulse_dovxk;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}" /*__inner_css_end__*/, "dovxk_gg_") /*__reshadow_css_end__*/, {
|
|
17
|
+
"__SLineGauge": "___SLineGauge_dovxk_gg_",
|
|
18
|
+
"_loading": "__loading_dovxk_gg_",
|
|
19
|
+
"__SDonutContainer": "___SDonutContainer_dovxk_gg_",
|
|
20
|
+
"__STrendLine": "___STrendLine_dovxk_gg_",
|
|
21
|
+
"__STrendBar": "___STrendBar_dovxk_gg_",
|
|
22
|
+
"@pulse": "pulse_dovxk"
|
|
23
23
|
});
|
|
24
24
|
var TrendLineRoot = /*#__PURE__*/function (_Trend) {
|
|
25
25
|
_inherits(TrendLineRoot, _Trend);
|
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';
|
|
4
|
-
import { CommonScoreProps } from './Score';
|
|
5
|
-
export type ScoreLineGaugeProps = BoxProps & CommonScoreProps & {
|
|
6
|
-
/**
|
|
7
|
-
* Count of line segments
|
|
8
|
-
*/
|
|
9
|
-
segments?: number;
|
|
10
|
-
};
|
|
11
|
-
type Enhances = {
|
|
12
|
-
resolveColor: ReturnType<typeof resolveColorEnhance>;
|
|
13
|
-
};
|
|
14
|
-
export declare const ScoreLine: ComponentType<ScoreLineGaugeProps, {}, {}, Enhances>;
|
|
15
|
-
export {};
|
|
1
|
+
import { ScoreLineComponent } from './Line.types';
|
|
2
|
+
export declare const ScoreLine: ScoreLineComponent;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Intergalactic, ComponentType } from '@semcore/utils/lib/core';
|
|
2
|
+
import { CommonScoreProps } from './Score';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { BoxProps, Box } from '@semcore/flex-box';
|
|
5
|
+
import resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';
|
|
6
|
+
type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N ? Acc[number] : Enumerate<N, [...Acc, Acc['length']]>;
|
|
7
|
+
type Range<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;
|
|
8
|
+
export type SegmentColor = `chart-palette-order-${Range<1, 24>}`;
|
|
9
|
+
export type SegmentProps = {
|
|
10
|
+
value: number;
|
|
11
|
+
/**
|
|
12
|
+
* Color of value
|
|
13
|
+
*/
|
|
14
|
+
color: SegmentColor;
|
|
15
|
+
};
|
|
16
|
+
type SegmentComponent = React.FC<SegmentProps>;
|
|
17
|
+
export type InnerSegmentProps = SegmentProps & {
|
|
18
|
+
styles: React.DetailedHTMLProps<React.StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement>;
|
|
19
|
+
};
|
|
20
|
+
type ValuedScoreProps = {
|
|
21
|
+
/**
|
|
22
|
+
* Value of score (in percents from 0 to 100) or count of selected segments (for Line with segments)
|
|
23
|
+
*/
|
|
24
|
+
value: number;
|
|
25
|
+
/**
|
|
26
|
+
* Color of value
|
|
27
|
+
*/
|
|
28
|
+
color?: SegmentColor;
|
|
29
|
+
/**
|
|
30
|
+
* Count of line segments
|
|
31
|
+
*/
|
|
32
|
+
segments?: number;
|
|
33
|
+
/**
|
|
34
|
+
* We don't accept children in this way
|
|
35
|
+
*/
|
|
36
|
+
children?: never;
|
|
37
|
+
};
|
|
38
|
+
type CustomRenderScoreProps = {
|
|
39
|
+
children: SegmentComponent[];
|
|
40
|
+
};
|
|
41
|
+
export type ScoreLineGaugeProps = BoxProps & Intergalactic.InternalTypings.EfficientOmit<CommonScoreProps, 'value' | 'color'> & (ValuedScoreProps | CustomRenderScoreProps);
|
|
42
|
+
export type Enhances = {
|
|
43
|
+
resolveColor: ReturnType<typeof resolveColorEnhance>;
|
|
44
|
+
};
|
|
45
|
+
export type ScoreLineComponent = ComponentType<ScoreLineGaugeProps, {}, {}, Enhances> & {
|
|
46
|
+
Segment: Intergalactic.Component<typeof Box, SegmentProps>;
|
|
47
|
+
};
|
|
48
|
+
export {};
|