@semcore/mini-chart 0.22.0 → 0.23.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 +12 -0
- package/lib/cjs/component/score/Donut.js +9 -9
- package/lib/cjs/component/score/Donut.js.map +1 -1
- package/lib/cjs/component/score/Line.js +17 -17
- package/lib/cjs/component/score/Line.js.map +1 -1
- package/lib/cjs/component/trend/Bar.js +7 -7
- package/lib/cjs/component/trend/Bar.js.map +1 -1
- package/lib/cjs/component/trend/Line.js +7 -7
- package/lib/cjs/component/trend/Line.js.map +1 -1
- package/lib/cjs/component/trend/Trend.js +1 -1
- package/lib/cjs/component/trend/Trend.js.map +1 -1
- package/lib/es6/component/score/Donut.js +9 -9
- package/lib/es6/component/score/Donut.js.map +1 -1
- package/lib/es6/component/score/Line.js +17 -17
- package/lib/es6/component/score/Line.js.map +1 -1
- package/lib/es6/component/trend/Bar.js +7 -7
- package/lib/es6/component/trend/Bar.js.map +1 -1
- package/lib/es6/component/trend/Line.js +7 -7
- package/lib/es6/component/trend/Line.js.map +1 -1
- package/lib/es6/component/trend/Trend.js +1 -1
- package/lib/es6/component/trend/Trend.js.map +1 -1
- package/lib/types/component/trend/Trend.d.ts +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,12 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
+
## [0.23.0] - 2024-10-18
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Version minor update due to children dependencies update (`@semcore/flex-box` [5.35.0 ~> 5.36.0], `@semcore/utils` [4.39.0 ~> 4.41.0], `@semcore/core` [2.33.0 ~> 2.34.0]).
|
|
10
|
+
|
|
5
11
|
## [0.22.0] - 2024-10-11
|
|
6
12
|
|
|
7
13
|
### Changed
|
|
8
14
|
|
|
9
15
|
- Version minor update due to children dependencies update (`@semcore/flex-box` [5.34.0 ~> 5.35.0], `@semcore/utils` [4.38.0 ~> 4.39.0], `@semcore/core` [2.32.0 ~> 2.33.0]).
|
|
10
16
|
|
|
17
|
+
## [0.21.1] - 2024-10-08
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- Types for enhances.
|
|
22
|
+
|
|
11
23
|
## [0.21.0] - 2024-10-04
|
|
12
24
|
|
|
13
25
|
### 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_rwkad{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_rwkad_gg_.__loading_rwkad_gg_,.___SLineGauge_rwkad_gg_.__loading_rwkad_gg_,.___STrendBar_rwkad_gg_.__loading_rwkad_gg_,.___STrendLine_rwkad_gg_.__loading_rwkad_gg_{animation-name:pulse_rwkad;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SDonutContainer_rwkad_gg_.__semi_rwkad_gg_ g{transform:rotate(180deg) translate(-24px,-24px)}.___SDonutContainer_rwkad_gg_ g{transform:rotate(-90deg) translate(-24px)}.___SDonutContainer_rwkad_gg_.__animate_rwkad_gg_ circle{transition:all var(--intergalactic-duration-extra-slow, 500) ease-in-out}" /*__inner_css_end__*/, "rwkad_gg_") /*__reshadow_css_end__*/, {
|
|
22
|
+
"__SLineGauge": "___SLineGauge_rwkad_gg_",
|
|
23
|
+
"_loading": "__loading_rwkad_gg_",
|
|
24
|
+
"__SDonutContainer": "___SDonutContainer_rwkad_gg_",
|
|
25
|
+
"__STrendLine": "___STrendLine_rwkad_gg_",
|
|
26
|
+
"__STrendBar": "___STrendBar_rwkad_gg_",
|
|
27
|
+
"@pulse": "pulse_rwkad",
|
|
28
|
+
"_animate": "__animate_rwkad_gg_",
|
|
29
|
+
"_semi": "__semi_rwkad_gg_"
|
|
30
30
|
});
|
|
31
31
|
var DonutRoot = /*#__PURE__*/function (_Component) {
|
|
32
32
|
(0, _inherits2["default"])(DonutRoot, _Component);
|
|
@@ -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, {}, {},
|
|
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, {}, {}, typeof DonutRoot.enhance> {\n static enhance = [resolveColorEnhance()] as const;\n\n static style = style;\n\n static defaultProps = {\n animate: true,\n };\n\n render() {\n const SDonutContainer = Root;\n const {\n value,\n styles,\n 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,aAA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KAAA,CAAAuB,EAAA;QAAA,MACK,IAAI;QAAA,MACJ,IAAI;QAAA,KACJZ,MAAM;QAAA,eACID,WAAW;QAAA,UAChBH,YAAY,CAAC,mBAAmB,CAAC;QAAA,mBACxBa,oBAAoB;QAAA,oBACnB,CAAC,CAAC,GAAGL;MAAoB,GAE9C,CAEJ,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
|
-
"__SLineValue": "
|
|
29
|
-
"_percent": "
|
|
30
|
-
"--percent": "--
|
|
31
|
-
"_color": "
|
|
32
|
-
"__SLineSegmentItem": "
|
|
33
|
-
"--color": "--
|
|
34
|
-
"_segments": "
|
|
35
|
-
"__SLineGaugeSegment": "
|
|
36
|
-
"__SAnimationLine": "
|
|
37
|
-
"@move-line": "move-
|
|
21
|
+
var style = ( /*__reshadow_css_start__*/_index.sstyled.insert( /*__inner_css_start__*/"@keyframes pulse_csagc{0%,to{opacity:1}50%{opacity:.4}}@keyframes move-line_csagc{0%{transform:translateX(0)}to{transform:translateX(100%)}}.___SDonutContainer_csagc_gg_.__loading_csagc_gg_,.___SLineGauge_csagc_gg_.__loading_csagc_gg_,.___STrendBar_csagc_gg_.__loading_csagc_gg_,.___STrendLine_csagc_gg_.__loading_csagc_gg_{animation-name:pulse_csagc;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SLineGauge_csagc_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_csagc_gg_{height:8px;border-radius:var(--intergalactic-chart-rounded, 2px)0 0 var(--intergalactic-chart-rounded, 2px)}.___SLineValue_csagc_gg_.__percent_csagc_gg_{width:var(--percent_csagc)}.___SLineSegmentItem_csagc_gg_.__color_csagc_gg_,.___SLineValue_csagc_gg_.__color_csagc_gg_{background-color:var(--color_csagc, var(--intergalactic-chart-palette-order-1, #2bb3ff))}.___SLineGauge_csagc_gg_.__segments_csagc_gg_{border-radius:var(--intergalactic-progress-bar-rounded, 6px)}.___SAnimationLine_csagc_gg_,.___SLineGaugeSegment_csagc_gg_{position:absolute;top:0;left:0;right:0;bottom:0}.___SLineSegmentItem_csagc_gg_:last-child{margin-right:0;border-right:none}.___SLineSegmentItem_csagc_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_csagc_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_csagc;animation-duration:.5s;animation-timing-function:ease-in-out;animation-fill-mode:forwards}" /*__inner_css_end__*/, "csagc_gg_") /*__reshadow_css_end__*/, {
|
|
22
|
+
"__SLineGauge": "___SLineGauge_csagc_gg_",
|
|
23
|
+
"_loading": "__loading_csagc_gg_",
|
|
24
|
+
"__SDonutContainer": "___SDonutContainer_csagc_gg_",
|
|
25
|
+
"__STrendLine": "___STrendLine_csagc_gg_",
|
|
26
|
+
"__STrendBar": "___STrendBar_csagc_gg_",
|
|
27
|
+
"@pulse": "pulse_csagc",
|
|
28
|
+
"__SLineValue": "___SLineValue_csagc_gg_",
|
|
29
|
+
"_percent": "__percent_csagc_gg_",
|
|
30
|
+
"--percent": "--percent_csagc",
|
|
31
|
+
"_color": "__color_csagc_gg_",
|
|
32
|
+
"__SLineSegmentItem": "___SLineSegmentItem_csagc_gg_",
|
|
33
|
+
"--color": "--color_csagc",
|
|
34
|
+
"_segments": "__segments_csagc_gg_",
|
|
35
|
+
"__SLineGaugeSegment": "___SLineGaugeSegment_csagc_gg_",
|
|
36
|
+
"__SAnimationLine": "___SAnimationLine_csagc_gg_",
|
|
37
|
+
"@move-line": "move-line_csagc"
|
|
38
38
|
});
|
|
39
39
|
var LineRoot = /*#__PURE__*/function (_Component) {
|
|
40
40
|
(0, _inherits2["default"])(LineRoot, _Component);
|
|
@@ -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","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
|
|
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 ScoreLineComponent,\n ScoreLineGaugeProps,\n SegmentProps,\n InnerSegmentProps,\n} from './Line.types';\n\nclass LineRoot extends Component<ScoreLineGaugeProps, {}, {}, typeof LineRoot.enhance> {\n static enhance = [resolveColorEnhance()] as const;\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,IAU5EC,QAAQ,0BAAAC,UAAA;EAAA,IAAAC,UAAA,aAAAF,QAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,OAAAC,aAAA,aAAAJ,QAAA;EAAA,SAAAA,SAAA;IAAA,IAAAK,gBAAA,mBAAAL,QAAA;IAAA,OAAAG,MAAA,CAAAG,KAAA,OAAAC,SAAA;EAAA;EAAA,IAAAC,aAAA,aAAAR,QAAA;IAAAS,GAAA;IAAAC,KAAA,EAUZ,SAAAC,gBAAgBC,YAA0B,EAAE;MAC1C,IAAAC,aAAA,GAAmC,IAAI,CAACC,OAAO;QAAvCC,QAAQ,GAAAF,aAAA,CAARE,QAAQ;QAAEC,YAAY,GAAAH,aAAA,CAAZG,YAAY;MAE9B,IAAIC,GAAG,GAAG,CAAC;MACXC,iBAAK,CAACC,QAAQ,CAACC,OAAO,CAACL,QAAQ,EAAE,UAACM,KAAK,EAAK;QAC1C,kBAAIH,iBAAK,CAACI,cAAc,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AAClE,QAAQ,EAAE;EACrE4D,OAAO,EAAPA;AACF,CAAC,CAAC;AAACO,OAAA,CAAAF,SAAA,GAAAA,SAAA;AAEHA,SAAS,CAACD,WAAW,GAAG,qBAAqB"}
|
|
@@ -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_1e6h2{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_1e6h2_gg_.__loading_1e6h2_gg_,.___SLineGauge_1e6h2_gg_.__loading_1e6h2_gg_,.___STrendBar_1e6h2_gg_.__loading_1e6h2_gg_,.___STrendLine_1e6h2_gg_.__loading_1e6h2_gg_{animation-name:pulse_1e6h2;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}" /*__inner_css_end__*/, "1e6h2_gg_") /*__reshadow_css_end__*/, {
|
|
23
|
+
"__SLineGauge": "___SLineGauge_1e6h2_gg_",
|
|
24
|
+
"_loading": "__loading_1e6h2_gg_",
|
|
25
|
+
"__SDonutContainer": "___SDonutContainer_1e6h2_gg_",
|
|
26
|
+
"__STrendLine": "___STrendLine_1e6h2_gg_",
|
|
27
|
+
"__STrendBar": "___STrendBar_1e6h2_gg_",
|
|
28
|
+
"@pulse": "pulse_1e6h2"
|
|
29
29
|
});
|
|
30
30
|
var TrendBarRoot = /*#__PURE__*/function (_Trend) {
|
|
31
31
|
(0, _inherits2["default"])(TrendBarRoot, _Trend);
|
|
@@ -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,
|
|
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, typeof TrendBarRoot.enhance> {\n static enhance = [resolveColorEnhance()] as const;\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,CAAAF,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAAwC;AAAA,IAAAM,KAAA,+BAAAC,MAAA,CAAAC,OAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,IA2BlCC,YAAY,0BAAAC,MAAA;EAAA,IAAAC,UAAA,aAAAF,YAAA,EAAAC,MAAA;EAAA,IAAAE,MAAA,OAAAC,aAAA,aAAAJ,YAAA;EAAA,SAAAA,aAAA;IAAA,IAAAK,gBAAA,mBAAAL,YAAA;IAAA,OAAAG,MAAA,CAAAG,KAAA,OAAAC,SAAA;EAAA;EAAA,IAAAC,aAAA,aAAAR,YAAA;IAAAS,GAAA;IAAAC,GAAA,EAShB,SAAAA,IAAA,EAA6B;MAC3B,OAAO,CAAC;QAAEC,KAAK,EAAE;MAAG,CAAC,EAAE;QAAEA,KAA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AA;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_1e6h2{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_1e6h2_gg_.__loading_1e6h2_gg_,.___SLineGauge_1e6h2_gg_.__loading_1e6h2_gg_,.___STrendBar_1e6h2_gg_.__loading_1e6h2_gg_,.___STrendLine_1e6h2_gg_.__loading_1e6h2_gg_{animation-name:pulse_1e6h2;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}" /*__inner_css_end__*/, "1e6h2_gg_") /*__reshadow_css_end__*/, {
|
|
24
|
+
"__SLineGauge": "___SLineGauge_1e6h2_gg_",
|
|
25
|
+
"_loading": "__loading_1e6h2_gg_",
|
|
26
|
+
"__SDonutContainer": "___SDonutContainer_1e6h2_gg_",
|
|
27
|
+
"__STrendLine": "___STrendLine_1e6h2_gg_",
|
|
28
|
+
"__STrendBar": "___STrendBar_1e6h2_gg_",
|
|
29
|
+
"@pulse": "pulse_1e6h2"
|
|
30
30
|
});
|
|
31
31
|
var TrendLineRoot = /*#__PURE__*/function (_Trend) {
|
|
32
32
|
(0, _inherits2["default"])(TrendLineRoot, _Trend);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Line.js","names":["_core","_interopRequireWildcard","require","_react","_interopRequireDefault","_resolveColorEnhance","_uniqueID","_Trend2","_flexBox","style","_index","sstyled","insert","TrendLineRoot","_Trend","_inherits2","_super","_createSuper2","_classCallCheck2","apply","arguments","_createClass2","key","get","_this$asProps$lastPoi","asProps","lastPointRadius","_this$asProps","data","loading","defaultData","lastPointColor","defaultWidth","defaultHeight","_this$asProps2","resolveColor","_this$asProps2$color","color","value","render","_ref","_ref2","STrendLine","Box","_this$asProps3","uid","withArea","animate","styles","points","length","step","i","push","concat","createElement","cn","_objectSpread2","assignProps","containerRef","svgWidth","svgHeight","join","Trend","_defineProperty2","resolveColorEnhance","uniqueIDEnhancement","TrendLine","createComponent","exports","displayName","TrendArea","enhancements","wrapperProps","props"],"sources":["../../../../src/component/trend/Line.tsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { ComponentType, assignProps, Root, sstyled } from '@semcore/core';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\nimport uniqueIDEnhancement from '@semcore/utils/lib/uniqueID';\nimport { Trend, CommonTrendProps } from './Trend';\nimport { Box } from '@semcore/flex-box';\n\nimport style from '../skeleton/skeleton.shadow.css';\n\nexport type TrendLineProps = CommonTrendProps & {\n /**\n * List of values\n */\n data: number[];\n\n /**\n * Color of line\n */\n color?: string;\n\n /**\n * Color of last point in chart\n */\n lastPointColor?: string;\n\n /**\n * Radius for last point item\n */\n lastPointRadius?: number;\n};\n\ntype Enhances = {\n uid: string;\n resolveColor: ReturnType<typeof resolveColorEnhance>;\n withArea?: true;\n};\n\nclass TrendLineRoot extends Trend<TrendLineProps, Enhances> {\n static enhance = [resolveColorEnhance(), uniqueIDEnhancement()];\n\n static style = style;\n\n static defaultProps = {\n animate: true,\n };\n\n get defaultData(): number[] {\n return [15, 70, 20, 85, 20];\n }\n\n get lastPointRadius(): number {\n return this.asProps.lastPointRadius ?? 6;\n }\n\n get data(): number[] {\n const { data, loading } = this.asProps;\n\n if (loading) {\n return this.defaultData;\n }\n\n return data;\n }\n\n override get svgWidth(): number {\n return this.asProps.lastPointColor\n ? this.defaultWidth + this.lastPointRadius\n : this.defaultWidth;\n }\n\n override get svgHeight(): number {\n return this.asProps.lastPointColor\n ? this.defaultHeight + this.lastPointRadius\n : this.defaultHeight;\n }\n\n get color() {\n const { resolveColor, color = 'chart-palette-order-1', loading } = this.asProps;\n\n if (loading) {\n return resolveColor('skeleton-bg');\n }\n\n return resolveColor(color);\n }\n\n render() {\n const STrendLine = Root;\n const { uid, withArea, animate, lastPointColor, resolveColor, loading, styles } = this.asProps;\n\n const points: string[] = [];\n const length = this.data.length;\n const step = this.defaultWidth / (length - 1);\n\n for (let i = 0; i < length; i++) {\n points.push(`${step * i},${this.defaultHeight - this.data[i]}`);\n }\n\n return sstyled(styles)(\n <STrendLine render={Box} ref={this.containerRef} __excludeProps={['data']}>\n <svg width='100%' height='100%' viewBox={`0 0 ${this.svgWidth} ${this.svgHeight}`}>\n <polyline\n points={points.join(' ')}\n stroke={this.color}\n strokeWidth='4'\n fill={'none'}\n clipPath={`url(#${uid})`}\n />\n {withArea && (\n <polyline\n points={`0,${this.defaultHeight} ${points.join(' ')} ${this.defaultWidth},${\n this.defaultHeight\n }`}\n fill={this.color}\n fillOpacity={0.2}\n clipPath={`url(#${uid})`}\n />\n )}\n {lastPointColor && !loading && (\n <circle\n cx={step * (length - 1)}\n cy={this.defaultHeight - this.data[length - 1]}\n r={this.lastPointRadius}\n fill={resolveColor(lastPointColor)}\n stroke={resolveColor('chart-grid-border')}\n strokeWidth={4}\n clipPath={`url(#${uid})`}\n />\n )}\n\n {animate && !loading && (\n <clipPath id={uid}>\n <rect x='0' y='0' width='100%' height='100%' fill={'black'}>\n <animate dur='500ms' attributeName='width' values='0;100%' />\n </rect>\n </clipPath>\n )}\n </svg>\n </STrendLine>,\n );\n }\n}\n\nexport const TrendLine: ComponentType<TrendLineProps, {}, {}, Enhances> =\n createComponent(TrendLineRoot);\n\nTrendLine.displayName = 'MiniChart.TrendLine';\n\nexport const TrendArea: ComponentType<TrendLineProps, {}, {}, Enhances> = createComponent(\n TrendLineRoot,\n {},\n {\n enhancements: [\n () => {\n return {\n wrapperProps: (props: TrendLineProps) => {\n return assignProps(props, { withArea: true });\n },\n };\n },\n ],\n },\n);\n\nTrendArea.displayName = 'MiniChart.TrendArea';\n"],"mappings":";;;;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AADA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,oBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,SAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAAwC;AAAA,IAAAO,KAAA,+BAAAC,MAAA,CAAAC,OAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,IAgClCC,aAAa,0BAAAC,MAAA;EAAA,IAAAC,UAAA,aAAAF,aAAA,EAAAC,MAAA;EAAA,IAAAE,MAAA,OAAAC,aAAA,aAAAJ,aAAA;EAAA,SAAAA,cAAA;IAAA,IAAAK,gBAAA,mBAAAL,aAAA;IAAA,OAAAG,MAAA,CAAAG,KAAA,OAAAC,SAAA;EA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resolveColorEnhance","_uniqueID","_Trend2","_flexBox","style","_index","sstyled","insert","TrendLineRoot","_Trend","_inherits2","_super","_createSuper2","_classCallCheck2","apply","arguments","_createClass2","key","get","_this$asProps$lastPoi","asProps","lastPointRadius","_this$asProps","data","loading","defaultData","lastPointColor","defaultWidth","defaultHeight","_this$asProps2","resolveColor","_this$asProps2$color","color","value","render","_ref","_ref2","STrendLine","Box","_this$asProps3","uid","withArea","animate","styles","points","length","step","i","push","concat","createElement","cn","_objectSpread2","assignProps","containerRef","svgWidth","svgHeight","join","Trend","_defineProperty2","resolveColorEnhance","uniqueIDEnhancement","TrendLine","createComponent","exports","displayName","TrendArea","enhancements","wrapperProps","props"],"sources":["../../../../src/component/trend/Line.tsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { ComponentType, assignProps, Root, sstyled } from '@semcore/core';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\nimport uniqueIDEnhancement from '@semcore/utils/lib/uniqueID';\nimport { Trend, CommonTrendProps } from './Trend';\nimport { Box } from '@semcore/flex-box';\n\nimport style from '../skeleton/skeleton.shadow.css';\n\nexport type TrendLineProps = CommonTrendProps & {\n /**\n * List of values\n */\n data: number[];\n\n /**\n * Color of line\n */\n color?: string;\n\n /**\n * Color of last point in chart\n */\n lastPointColor?: string;\n\n /**\n * Radius for last point item\n */\n lastPointRadius?: number;\n};\n\ntype Enhances = {\n uid: string;\n resolveColor: ReturnType<typeof resolveColorEnhance>;\n withArea?: true;\n};\n\nclass TrendLineRoot extends Trend<TrendLineProps, typeof TrendLineRoot.enhance> {\n static enhance = [resolveColorEnhance(), uniqueIDEnhancement()] as const;\n\n static style = style;\n\n static defaultProps = {\n animate: true,\n };\n\n get defaultData(): number[] {\n return [15, 70, 20, 85, 20];\n }\n\n get lastPointRadius(): number {\n return this.asProps.lastPointRadius ?? 6;\n }\n\n get data(): number[] {\n const { data, loading } = this.asProps;\n\n if (loading) {\n return this.defaultData;\n }\n\n return data;\n }\n\n override get svgWidth(): number {\n return this.asProps.lastPointColor\n ? this.defaultWidth + this.lastPointRadius\n : this.defaultWidth;\n }\n\n override get svgHeight(): number {\n return this.asProps.lastPointColor\n ? this.defaultHeight + this.lastPointRadius\n : this.defaultHeight;\n }\n\n get color() {\n const { resolveColor, color = 'chart-palette-order-1', loading } = this.asProps;\n\n if (loading) {\n return resolveColor('skeleton-bg');\n }\n\n return resolveColor(color);\n }\n\n render() {\n const STrendLine = Root;\n const { uid, withArea, animate, lastPointColor, resolveColor, loading, styles } = this.asProps;\n\n const points: string[] = [];\n const length = this.data.length;\n const step = this.defaultWidth / (length - 1);\n\n for (let i = 0; i < length; i++) {\n points.push(`${step * i},${this.defaultHeight - this.data[i]}`);\n }\n\n return sstyled(styles)(\n <STrendLine render={Box} ref={this.containerRef} __excludeProps={['data']}>\n <svg width='100%' height='100%' viewBox={`0 0 ${this.svgWidth} ${this.svgHeight}`}>\n <polyline\n points={points.join(' ')}\n stroke={this.color}\n strokeWidth='4'\n fill={'none'}\n clipPath={`url(#${uid})`}\n />\n {withArea && (\n <polyline\n points={`0,${this.defaultHeight} ${points.join(' ')} ${this.defaultWidth},${\n this.defaultHeight\n }`}\n fill={this.color}\n fillOpacity={0.2}\n clipPath={`url(#${uid})`}\n />\n )}\n {lastPointColor && !loading && (\n <circle\n cx={step * (length - 1)}\n cy={this.defaultHeight - this.data[length - 1]}\n r={this.lastPointRadius}\n fill={resolveColor(lastPointColor)}\n stroke={resolveColor('chart-grid-border')}\n strokeWidth={4}\n clipPath={`url(#${uid})`}\n />\n )}\n\n {animate && !loading && (\n <clipPath id={uid}>\n <rect x='0' y='0' width='100%' height='100%' fill={'black'}>\n <animate dur='500ms' attributeName='width' values='0;100%' />\n </rect>\n </clipPath>\n )}\n </svg>\n </STrendLine>,\n );\n }\n}\n\nexport const TrendLine: ComponentType<TrendLineProps, {}, {}, Enhances> =\n createComponent(TrendLineRoot);\n\nTrendLine.displayName = 'MiniChart.TrendLine';\n\nexport const TrendArea: ComponentType<TrendLineProps, {}, {}, Enhances> = createComponent(\n TrendLineRoot,\n {},\n {\n enhancements: [\n () => {\n return {\n wrapperProps: (props: TrendLineProps) => {\n return assignProps(props, { withArea: true });\n },\n };\n },\n ],\n },\n);\n\nTrendArea.displayName = 'MiniChart.TrendArea';\n"],"mappings":";;;;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AADA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,oBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,SAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAAwC;AAAA,IAAAO,KAAA,+BAAAC,MAAA,CAAAC,OAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,IAgClCC,aAAa,0BAAAC,MAAA;EAAA,IAAAC,UAAA,aAAAF,aAAA,EAAAC,MAAA;EAAA,IAAAE,MAAA,OAAAC,aAAA,aAAAJ,aAAA;EAAA,SAAAA,cAAA;IAAA,IAAAK,gBAAA,mBAAAL,aAAA;IAAA,OAAAG,MAAA,CAAAG,KAAA,OAAAC,SAAA;EAAA;EAAA,IAAAC,aAAA,aAAAR,aAAA;IAAAS,GAAA;IAAAC,GAAA,EASjB,SAAAA,IAAA,EAA4B;MAC1B,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;IAC7B;EAAC;IAAAD,GAAA;IAAAC,GAAA,EAED,SAAAA,IAAA,EAA8B;MAAA,IAAAC,qBAAA;MAC5B,QAAAA,qBAAA,GAAO,IAAI,CAACC,OAAO,CAACC,eAAe,cAAAF,qBAAA,cAAAA,qBAAA,GAAI,CAAC;IAC1C;EAAC;IAAAF,GAAA;IAAAC,GAAA,EAED,SAAAA,IAAA,EAAqB;MACnB,IAAAI,aA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3BnD,aAAa,aACA,CAAC,IAAAoD,+BAAmB,GAAE,EAAE,IAAAC,oBAAmB,GAAE,CAAC;AAAA,IAAAF,gBAAA,aAD3DnD,aAAa,WAGFJ,KAAK;AAAA,IAAAuD,gBAAA,aAHhBnD,aAAa,kBAKK;EACpBkC,OAAO,EAAE;AACX,CAAC;AAmGI,IAAMoB,SAA0D,GACrE,IAAAC,gBAAe,EAACvD,aAAa,CAAC;AAACwD,OAAA,CAAAF,SAAA,GAAAA,SAAA;AAEjCA,SAAS,CAACG,WAAW,GAAG,qBAAqB;AAEtC,IAAMC,SAA0D,GAAG,IAAAH,gBAAe,EACvFvD,aAAa,EACb,CAAC,CAAC,EACF;EACE2D,YAAY,EAAE,CACZ,YAAM;IACJ,OAAO;MACLC,YAAY,EAAE,SAAAA,aAACC,KAAqB,EAAK;QACvC,OAAO,IAAAhB,iBAAW,EAACgB,KAAK,EAAE;UAAE5B,QAAQ,EAAE;QAAK,CAAC,CAAC;MAC/C;IACF,CAAC;EACH,CAAC;AAEL,CAAC,CACF;AAACuB,OAAA,CAAAE,SAAA,GAAAA,SAAA;AAEFA,SAAS,CAACD,WAAW,GAAG,qBAAqB"}
|
|
@@ -18,10 +18,10 @@ var Trend = /*#__PURE__*/function (_Component) {
|
|
|
18
18
|
var _super = (0, _createSuper2["default"])(Trend);
|
|
19
19
|
function Trend() {
|
|
20
20
|
var _this;
|
|
21
|
-
(0, _classCallCheck2["default"])(this, Trend);
|
|
22
21
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
23
22
|
args[_key] = arguments[_key];
|
|
24
23
|
}
|
|
24
|
+
(0, _classCallCheck2["default"])(this, Trend);
|
|
25
25
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
26
26
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {
|
|
27
27
|
width: 200,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Trend.js","names":["_react","_interopRequireDefault","require","_core","Trend","_Component","_inherits2","_super","_createSuper2","_this","
|
|
1
|
+
{"version":3,"file":"Trend.js","names":["_react","_interopRequireDefault","require","_core","Trend","_Component","_inherits2","_super","_createSuper2","_this","_len","arguments","length","args","Array","_key","_classCallCheck2","call","apply","concat","_defineProperty2","_assertThisInitialized2","width","height","React","createRef","_createClass2","key","value","componentDidMount","setSizes","componentDidUpdate","prevProps","w","props","h","data","get","_this$state","state","defaultHeight","defaultWidth","containerRef","current","boundingClientRect","getBoundingClientRect","setState","Component","exports"],"sources":["../../../../src/component/trend/Trend.tsx"],"sourcesContent":["import React from 'react';\nimport { Component } from '@semcore/core';\nimport { BoxProps } from '@semcore/flex-box';\n\nexport type CommonTrendProps = BoxProps & {\n /**\n * Flag to enable animate of charts\n * @default true\n */\n animate?: boolean;\n\n /**\n * Flag to enable skeleton\n * @default false\n */\n loading?: boolean;\n\n /**\n * Data for chart\n */\n data: any[];\n};\n\nexport abstract class Trend<\n P extends CommonTrendProps,\n E extends readonly ((...args: any[]) => any)[],\n> extends Component<P, {}, { width: number; height: number }, E> {\n state = {\n width: 200,\n height: 100,\n };\n\n containerRef = React.createRef<HTMLDivElement>();\n\n componentDidMount() {\n this.setSizes();\n }\n componentDidUpdate(prevProps: P) {\n if (\n prevProps.w !== this.props.w ||\n prevProps.h !== this.props.h ||\n prevProps.data !== this.props.data\n ) {\n this.setSizes();\n }\n }\n\n get defaultWidth(): number {\n const { width, height } = this.state;\n\n return (width / height) * this.defaultHeight;\n }\n\n get defaultHeight(): number {\n return 100;\n }\n\n get svgWidth(): number {\n return this.defaultWidth;\n }\n\n get svgHeight(): number {\n return this.defaultHeight;\n }\n\n setSizes() {\n if (this.containerRef.current) {\n const boundingClientRect = this.containerRef.current.getBoundingClientRect();\n\n const { width, height } = boundingClientRect;\n\n if (width > 0 && height > 0) {\n this.setState({ width, height });\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,O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,IAAA,EAA2B;MACzB,IAAAC,WAAA,GAA0B,IAAI,CAACC,KAAK;QAA5BjB,KAAK,GAAAgB,WAAA,CAALhB,KAAK;QAAEC,MAAM,GAAAe,WAAA,CAANf,MAAM;MAErB,OAAQD,KAAK,GAAGC,MAAM,GAAI,IAAI,CAACiB,aAAa;IAC9C;EAAC;IAAAb,GAAA;IAAAU,GAAA,EAED,SAAAA,IAAA,EAA4B;MAC1B,OAAO,GAAG;IACZ;EAAC;IAAAV,GAAA;IAAAU,GAAA,EAED,SAAAA,IAAA,EAAuB;MACrB,OAAO,IAAI,CAACI,YAAY;IAC1B;EAAC;IAAAd,GAAA;IAAAU,GAAA,EAED,SAAAA,IAAA,EAAwB;MACtB,OAAO,IAAI,CAACG,aAAa;IAC3B;EAAC;IAAAb,GAAA;IAAAC,KAAA,EAED,SAAAE,SAAA,EAAW;MACT,IAAI,IAAI,CAACY,YAAY,CAACC,OAAO,EAAE;QAC7B,IAAMC,kBAAkB,GAAG,IAAI,CAACF,YAAY,CAACC,OAAO,CAACE,qBAAqB,EAAE;QAE5E,IAAQvB,KAAK,GAAasB,kBAAkB,CAApCtB,KAAK;UAAEC,MAAM,GAAKqB,kBAAkB,CAA7BrB,MAAM;QAErB,IAAID,KAAK,GAAG,CAAC,IAAIC,MAAM,GAAG,CAAC,EAAE;UAC3B,IAAI,CAACuB,QAAQ,CAAC;YAAExB,KAAK,EAALA,KAAK;YAAEC,MAAM,EAANA;UAAO,CAAC,CAAC;QAClC;MACF;IACF;EAAC;EAAA,OAAAnB,KAAA;AAAA,EAjDO2C,eAAS;AAAAC,OAAA,CAAA5C,KAAA,GAAAA,KAAA"}
|
|
@@ -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_rwkad{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_rwkad_gg_.__loading_rwkad_gg_,.___SLineGauge_rwkad_gg_.__loading_rwkad_gg_,.___STrendBar_rwkad_gg_.__loading_rwkad_gg_,.___STrendLine_rwkad_gg_.__loading_rwkad_gg_{animation-name:pulse_rwkad;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SDonutContainer_rwkad_gg_.__semi_rwkad_gg_ g{transform:rotate(180deg) translate(-24px,-24px)}.___SDonutContainer_rwkad_gg_ g{transform:rotate(-90deg) translate(-24px)}.___SDonutContainer_rwkad_gg_.__animate_rwkad_gg_ circle{transition:all var(--intergalactic-duration-extra-slow, 500) ease-in-out}" /*__inner_css_end__*/, "rwkad_gg_") /*__reshadow_css_end__*/, {
|
|
16
|
+
"__SLineGauge": "___SLineGauge_rwkad_gg_",
|
|
17
|
+
"_loading": "__loading_rwkad_gg_",
|
|
18
|
+
"__SDonutContainer": "___SDonutContainer_rwkad_gg_",
|
|
19
|
+
"__STrendLine": "___STrendLine_rwkad_gg_",
|
|
20
|
+
"__STrendBar": "___STrendBar_rwkad_gg_",
|
|
21
|
+
"@pulse": "pulse_rwkad",
|
|
22
|
+
"_animate": "__animate_rwkad_gg_",
|
|
23
|
+
"_semi": "__semi_rwkad_gg_"
|
|
24
24
|
});
|
|
25
25
|
var DonutRoot = /*#__PURE__*/function (_Component) {
|
|
26
26
|
_inherits(DonutRoot, _Component);
|
|
@@ -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, {}, {},
|
|
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, {}, {}, typeof DonutRoot.enhance> {\n static enhance = [resolveColorEnhance()] as const;\n\n static style = style;\n\n static defaultProps = {\n animate: true,\n };\n\n render() {\n const SDonutContainer = Root;\n const {\n value,\n styles,\n 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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AAA,aAACC,KAAsB,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"}
|
|
@@ -13,23 +13,23 @@ import createComponent, { Component, Root, sstyled } from '@semcore/core';
|
|
|
13
13
|
import { Box, Flex } from '@semcore/flex-box';
|
|
14
14
|
import resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';
|
|
15
15
|
/*__reshadow-styles__:"./line.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": "
|
|
23
|
-
"__SLineValue": "
|
|
24
|
-
"_percent": "
|
|
25
|
-
"--percent": "--
|
|
26
|
-
"_color": "
|
|
27
|
-
"__SLineSegmentItem": "
|
|
28
|
-
"--color": "--
|
|
29
|
-
"_segments": "
|
|
30
|
-
"__SLineGaugeSegment": "
|
|
31
|
-
"__SAnimationLine": "
|
|
32
|
-
"@move-line": "move-
|
|
16
|
+
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/"@keyframes pulse_csagc{0%,to{opacity:1}50%{opacity:.4}}@keyframes move-line_csagc{0%{transform:translateX(0)}to{transform:translateX(100%)}}.___SDonutContainer_csagc_gg_.__loading_csagc_gg_,.___SLineGauge_csagc_gg_.__loading_csagc_gg_,.___STrendBar_csagc_gg_.__loading_csagc_gg_,.___STrendLine_csagc_gg_.__loading_csagc_gg_{animation-name:pulse_csagc;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}.___SLineGauge_csagc_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_csagc_gg_{height:8px;border-radius:var(--intergalactic-chart-rounded, 2px)0 0 var(--intergalactic-chart-rounded, 2px)}.___SLineValue_csagc_gg_.__percent_csagc_gg_{width:var(--percent_csagc)}.___SLineSegmentItem_csagc_gg_.__color_csagc_gg_,.___SLineValue_csagc_gg_.__color_csagc_gg_{background-color:var(--color_csagc, var(--intergalactic-chart-palette-order-1, #2bb3ff))}.___SLineGauge_csagc_gg_.__segments_csagc_gg_{border-radius:var(--intergalactic-progress-bar-rounded, 6px)}.___SAnimationLine_csagc_gg_,.___SLineGaugeSegment_csagc_gg_{position:absolute;top:0;left:0;right:0;bottom:0}.___SLineSegmentItem_csagc_gg_:last-child{margin-right:0;border-right:none}.___SLineSegmentItem_csagc_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_csagc_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_csagc;animation-duration:.5s;animation-timing-function:ease-in-out;animation-fill-mode:forwards}" /*__inner_css_end__*/, "csagc_gg_") /*__reshadow_css_end__*/, {
|
|
17
|
+
"__SLineGauge": "___SLineGauge_csagc_gg_",
|
|
18
|
+
"_loading": "__loading_csagc_gg_",
|
|
19
|
+
"__SDonutContainer": "___SDonutContainer_csagc_gg_",
|
|
20
|
+
"__STrendLine": "___STrendLine_csagc_gg_",
|
|
21
|
+
"__STrendBar": "___STrendBar_csagc_gg_",
|
|
22
|
+
"@pulse": "pulse_csagc",
|
|
23
|
+
"__SLineValue": "___SLineValue_csagc_gg_",
|
|
24
|
+
"_percent": "__percent_csagc_gg_",
|
|
25
|
+
"--percent": "--percent_csagc",
|
|
26
|
+
"_color": "__color_csagc_gg_",
|
|
27
|
+
"__SLineSegmentItem": "___SLineSegmentItem_csagc_gg_",
|
|
28
|
+
"--color": "--color_csagc",
|
|
29
|
+
"_segments": "__segments_csagc_gg_",
|
|
30
|
+
"__SLineGaugeSegment": "___SLineGaugeSegment_csagc_gg_",
|
|
31
|
+
"__SAnimationLine": "___SAnimationLine_csagc_gg_",
|
|
32
|
+
"@move-line": "move-line_csagc"
|
|
33
33
|
});
|
|
34
34
|
var LineRoot = /*#__PURE__*/function (_Component) {
|
|
35
35
|
_inherits(LineRoot, _Component);
|
|
@@ -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","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
|
|
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 ScoreLineComponent,\n ScoreLineGaugeProps,\n SegmentProps,\n InnerSegmentProps,\n} from './Line.types';\n\nclass LineRoot extends Component<ScoreLineGaugeProps, {}, {}, typeof LineRoot.enhance> {\n static enhance = [resolveColorEnhance()] as const;\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":";;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,eAAe,IAAIC,SAAS,EAAEC,IAAI,EAAEC,OAAO,QAAQ,eAAe;AACzE,SAASC,GAAG,EAAEC,IAAI,QAAQ,mBAAmB;AAC7C,OAAOC,mBAAmB,MAAM,iDAAiD;AAAC;AAAA,IAAAC,KAAA,+BAAAC,QAAA,CAAAC,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,IAU5EC,QAAQ,0BAAAC,UAAA;EAAAC,SAAA,CAAAF,QAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,QAAA;EAAA,SAAAA,SAAA;IAAAK,eAAA,OAAAL,QAAA;IAAA,OAAAG,MAAA,CAAAG,KAAA,OAAAC,SAAA;EAAA;EAAAC,YAAA,CAAAR,QAAA;IAAAS,GAAA;IAAAC,KAAA,EAUZ,SA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,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"}
|
|
@@ -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_1e6h2{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_1e6h2_gg_.__loading_1e6h2_gg_,.___SLineGauge_1e6h2_gg_.__loading_1e6h2_gg_,.___STrendBar_1e6h2_gg_.__loading_1e6h2_gg_,.___STrendLine_1e6h2_gg_.__loading_1e6h2_gg_{animation-name:pulse_1e6h2;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}" /*__inner_css_end__*/, "1e6h2_gg_") /*__reshadow_css_end__*/, {
|
|
16
|
+
"__SLineGauge": "___SLineGauge_1e6h2_gg_",
|
|
17
|
+
"_loading": "__loading_1e6h2_gg_",
|
|
18
|
+
"__SDonutContainer": "___SDonutContainer_1e6h2_gg_",
|
|
19
|
+
"__STrendLine": "___STrendLine_1e6h2_gg_",
|
|
20
|
+
"__STrendBar": "___STrendBar_1e6h2_gg_",
|
|
21
|
+
"@pulse": "pulse_1e6h2"
|
|
22
22
|
});
|
|
23
23
|
var TrendBarRoot = /*#__PURE__*/function (_Trend) {
|
|
24
24
|
_inherits(TrendBarRoot, _Trend);
|
|
@@ -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,
|
|
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, typeof TrendBarRoot.enhance> {\n static enhance = [resolveColorEnhance()] as const;\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;MAA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AC,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_1e6h2{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_1e6h2_gg_.__loading_1e6h2_gg_,.___SLineGauge_1e6h2_gg_.__loading_1e6h2_gg_,.___STrendBar_1e6h2_gg_.__loading_1e6h2_gg_,.___STrendLine_1e6h2_gg_.__loading_1e6h2_gg_{animation-name:pulse_1e6h2;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}" /*__inner_css_end__*/, "1e6h2_gg_") /*__reshadow_css_end__*/, {
|
|
17
|
+
"__SLineGauge": "___SLineGauge_1e6h2_gg_",
|
|
18
|
+
"_loading": "__loading_1e6h2_gg_",
|
|
19
|
+
"__SDonutContainer": "___SDonutContainer_1e6h2_gg_",
|
|
20
|
+
"__STrendLine": "___STrendLine_1e6h2_gg_",
|
|
21
|
+
"__STrendBar": "___STrendBar_1e6h2_gg_",
|
|
22
|
+
"@pulse": "pulse_1e6h2"
|
|
23
23
|
});
|
|
24
24
|
var TrendLineRoot = /*#__PURE__*/function (_Trend) {
|
|
25
25
|
_inherits(TrendLineRoot, _Trend);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Line.js","names":["React","createComponent","assignProps","Root","sstyled","resolveColorEnhance","uniqueIDEnhancement","Trend","Box","style","_sstyled","insert","TrendLineRoot","_Trend","_inherits","_super","_createSuper","_classCallCheck","apply","arguments","_createClass","key","get","_this$asProps$lastPoi","asProps","lastPointRadius","_this$asProps","data","loading","defaultData","lastPointColor","defaultWidth","defaultHeight","_this$asProps2","resolveColor","_this$asProps2$color","color","value","render","_ref","_ref2","STrendLine","_this$asProps3","uid","withArea","animate","styles","points","length","step","i","push","concat","createElement","cn","_objectSpread","_assignProps","containerRef","svgWidth","svgHeight","join","_defineProperty","TrendLine","displayName","TrendArea","enhancements","wrapperProps","props"],"sources":["../../../../src/component/trend/Line.tsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { ComponentType, assignProps, Root, sstyled } from '@semcore/core';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\nimport uniqueIDEnhancement from '@semcore/utils/lib/uniqueID';\nimport { Trend, CommonTrendProps } from './Trend';\nimport { Box } from '@semcore/flex-box';\n\nimport style from '../skeleton/skeleton.shadow.css';\n\nexport type TrendLineProps = CommonTrendProps & {\n /**\n * List of values\n */\n data: number[];\n\n /**\n * Color of line\n */\n color?: string;\n\n /**\n * Color of last point in chart\n */\n lastPointColor?: string;\n\n /**\n * Radius for last point item\n */\n lastPointRadius?: number;\n};\n\ntype Enhances = {\n uid: string;\n resolveColor: ReturnType<typeof resolveColorEnhance>;\n withArea?: true;\n};\n\nclass TrendLineRoot extends Trend<TrendLineProps,
|
|
1
|
+
{"version":3,"file":"Line.js","names":["React","createComponent","assignProps","Root","sstyled","resolveColorEnhance","uniqueIDEnhancement","Trend","Box","style","_sstyled","insert","TrendLineRoot","_Trend","_inherits","_super","_createSuper","_classCallCheck","apply","arguments","_createClass","key","get","_this$asProps$lastPoi","asProps","lastPointRadius","_this$asProps","data","loading","defaultData","lastPointColor","defaultWidth","defaultHeight","_this$asProps2","resolveColor","_this$asProps2$color","color","value","render","_ref","_ref2","STrendLine","_this$asProps3","uid","withArea","animate","styles","points","length","step","i","push","concat","createElement","cn","_objectSpread","_assignProps","containerRef","svgWidth","svgHeight","join","_defineProperty","TrendLine","displayName","TrendArea","enhancements","wrapperProps","props"],"sources":["../../../../src/component/trend/Line.tsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { ComponentType, assignProps, Root, sstyled } from '@semcore/core';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\nimport uniqueIDEnhancement from '@semcore/utils/lib/uniqueID';\nimport { Trend, CommonTrendProps } from './Trend';\nimport { Box } from '@semcore/flex-box';\n\nimport style from '../skeleton/skeleton.shadow.css';\n\nexport type TrendLineProps = CommonTrendProps & {\n /**\n * List of values\n */\n data: number[];\n\n /**\n * Color of line\n */\n color?: string;\n\n /**\n * Color of last point in chart\n */\n lastPointColor?: string;\n\n /**\n * Radius for last point item\n */\n lastPointRadius?: number;\n};\n\ntype Enhances = {\n uid: string;\n resolveColor: ReturnType<typeof resolveColorEnhance>;\n withArea?: true;\n};\n\nclass TrendLineRoot extends Trend<TrendLineProps, typeof TrendLineRoot.enhance> {\n static enhance = [resolveColorEnhance(), uniqueIDEnhancement()] as const;\n\n static style = style;\n\n static defaultProps = {\n animate: true,\n };\n\n get defaultData(): number[] {\n return [15, 70, 20, 85, 20];\n }\n\n get lastPointRadius(): number {\n return this.asProps.lastPointRadius ?? 6;\n }\n\n get data(): number[] {\n const { data, loading } = this.asProps;\n\n if (loading) {\n return this.defaultData;\n }\n\n return data;\n }\n\n override get svgWidth(): number {\n return this.asProps.lastPointColor\n ? this.defaultWidth + this.lastPointRadius\n : this.defaultWidth;\n }\n\n override get svgHeight(): number {\n return this.asProps.lastPointColor\n ? this.defaultHeight + this.lastPointRadius\n : this.defaultHeight;\n }\n\n get color() {\n const { resolveColor, color = 'chart-palette-order-1', loading } = this.asProps;\n\n if (loading) {\n return resolveColor('skeleton-bg');\n }\n\n return resolveColor(color);\n }\n\n render() {\n const STrendLine = Root;\n const { uid, withArea, animate, lastPointColor, resolveColor, loading, styles } = this.asProps;\n\n const points: string[] = [];\n const length = this.data.length;\n const step = this.defaultWidth / (length - 1);\n\n for (let i = 0; i < length; i++) {\n points.push(`${step * i},${this.defaultHeight - this.data[i]}`);\n }\n\n return sstyled(styles)(\n <STrendLine render={Box} ref={this.containerRef} __excludeProps={['data']}>\n <svg width='100%' height='100%' viewBox={`0 0 ${this.svgWidth} ${this.svgHeight}`}>\n <polyline\n points={points.join(' ')}\n stroke={this.color}\n strokeWidth='4'\n fill={'none'}\n clipPath={`url(#${uid})`}\n />\n {withArea && (\n <polyline\n points={`0,${this.defaultHeight} ${points.join(' ')} ${this.defaultWidth},${\n this.defaultHeight\n }`}\n fill={this.color}\n fillOpacity={0.2}\n clipPath={`url(#${uid})`}\n />\n )}\n {lastPointColor && !loading && (\n <circle\n cx={step * (length - 1)}\n cy={this.defaultHeight - this.data[length - 1]}\n r={this.lastPointRadius}\n fill={resolveColor(lastPointColor)}\n stroke={resolveColor('chart-grid-border')}\n strokeWidth={4}\n clipPath={`url(#${uid})`}\n />\n )}\n\n {animate && !loading && (\n <clipPath id={uid}>\n <rect x='0' y='0' width='100%' height='100%' fill={'black'}>\n <animate dur='500ms' attributeName='width' values='0;100%' />\n </rect>\n </clipPath>\n )}\n </svg>\n </STrendLine>,\n );\n }\n}\n\nexport const TrendLine: ComponentType<TrendLineProps, {}, {}, Enhances> =\n createComponent(TrendLineRoot);\n\nTrendLine.displayName = 'MiniChart.TrendLine';\n\nexport const TrendArea: ComponentType<TrendLineProps, {}, {}, Enhances> = createComponent(\n TrendLineRoot,\n {},\n {\n enhancements: [\n () => {\n return {\n wrapperProps: (props: TrendLineProps) => {\n return assignProps(props, { withArea: true });\n },\n };\n },\n ],\n },\n);\n\nTrendArea.displayName = 'MiniChart.TrendArea';\n"],"mappings":";;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,eAAe,IAAmBC,WAAW,EAAEC,IAAI,EAAEC,OAAO,QAAQ,eAAe;AAC1F,OAAOC,mBAAmB,MAAM,iDAAiD;AACjF,OAAOC,mBAAmB,MAAM,6BAA6B;AAC7D,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,IAgClCC,aAAa,0BAAAC,MAAA;EAAAC,SAAA,CAAAF,aAAA,EAAAC,MAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,aAAA;EAAA,SAAAA,cAAA;IAAAK,eAAA,OAAAL,aAAA;IAAA,OAAAG,MAAA,CAAAG,KAAA,OAAAC,SAAA;EAAA;EAAAC,YAAA,CAAAR,aAAA;IAAAS,GAAA;IAAAC,GAAA,EASjB,SAAAA,IAAA,EAA4B;MAC1B,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;IAC7B;EAAC;IAAAD,GAAA;IAAAC,GAAA,EAED,SAAAA,IAAA,EAA8B;MAAA,IAAAC,qBAAA;MAC5B,QAAAA,qBAAA,GAAO,IAAI,CAACC,OAAO,CAACC,eAAe,cAAAF,qBAAA,cAAAA,qBAAA,GAAI,CAAC;IAC1C;EAAC;IAAAF,GAAA;IAAAC,GAAA,EAED,SAAAA,IAAA,EAAqB;MACnB,IAAAI,aAAA,GAA0B,IAAI,CAACF,OAAO;QAA9BG,IAAI,GAAAD,aAAA,CAAJC,IAAI;QAAEC,OAAO,GAAAF,aAAA,CAAPE,OAAO;MAErB,IA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KK;EACpBiC,OAAO,EAAE;AACX,CAAC;AAmGH,OAAO,IAAMiB,SAA0D,GACrE7D,eAAe,CAACW,aAAa,CAAC;AAEhCkD,SAAS,CAACC,WAAW,GAAG,qBAAqB;AAE7C,OAAO,IAAMC,SAA0D,GAAG/D,eAAe,CACvFW,aAAa,EACb,CAAC,CAAC,EACF;EACEqD,YAAY,EAAE,CACZ,YAAM;IACJ,OAAO;MACLC,YAAY,EAAE,SAAAA,aAACC,KAAqB,EAAK;QACvC,OAAOjE,WAAW,CAACiE,KAAK,EAAE;UAAEvB,QAAQ,EAAE;QAAK,CAAC,CAAC;MAC/C;IACF,CAAC;EACH,CAAC;AAEL,CAAC,CACF;AAEDoB,SAAS,CAACD,WAAW,GAAG,qBAAqB"}
|
|
@@ -11,10 +11,10 @@ export var Trend = /*#__PURE__*/function (_Component) {
|
|
|
11
11
|
var _super = _createSuper(Trend);
|
|
12
12
|
function Trend() {
|
|
13
13
|
var _this;
|
|
14
|
-
_classCallCheck(this, Trend);
|
|
15
14
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
16
15
|
args[_key] = arguments[_key];
|
|
17
16
|
}
|
|
17
|
+
_classCallCheck(this, Trend);
|
|
18
18
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
19
19
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
20
20
|
width: 200,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Trend.js","names":["React","Component","Trend","_Component","_inherits","_super","_createSuper","_this","
|
|
1
|
+
{"version":3,"file":"Trend.js","names":["React","Component","Trend","_Component","_inherits","_super","_createSuper","_this","_len","arguments","length","args","Array","_key","_classCallCheck","call","apply","concat","_defineProperty","_assertThisInitialized","width","height","createRef","_createClass","key","value","componentDidMount","setSizes","componentDidUpdate","prevProps","w","props","h","data","get","_this$state","state","defaultHeight","defaultWidth","containerRef","current","boundingClientRect","getBoundingClientRect","setState"],"sources":["../../../../src/component/trend/Trend.tsx"],"sourcesContent":["import React from 'react';\nimport { Component } from '@semcore/core';\nimport { BoxProps } from '@semcore/flex-box';\n\nexport type CommonTrendProps = BoxProps & {\n /**\n * Flag to enable animate of charts\n * @default true\n */\n animate?: boolean;\n\n /**\n * Flag to enable skeleton\n * @default false\n */\n loading?: boolean;\n\n /**\n * Data for chart\n */\n data: any[];\n};\n\nexport abstract class Trend<\n P extends CommonTrendProps,\n E extends readonly ((...args: any[]) => any)[],\n> extends Component<P, {}, { width: number; height: number }, E> {\n state = {\n width: 200,\n height: 100,\n };\n\n containerRef = React.createRef<HTMLDivElement>();\n\n componentDidMount() {\n this.setSizes();\n }\n componentDidUpdate(prevProps: P) {\n if (\n prevProps.w !== this.props.w ||\n prevProps.h !== this.props.h ||\n prevProps.data !== this.props.data\n ) {\n this.setSizes();\n }\n }\n\n get defaultWidth(): number {\n const { width, height } = this.state;\n\n return (width / height) * this.defaultHeight;\n }\n\n get defaultHeight(): number {\n return 100;\n }\n\n get svgWidth(): number {\n return this.defaultWidth;\n }\n\n get svgHeight(): number {\n return this.defaultHeight;\n }\n\n setSizes() {\n if (this.containerRef.current) {\n const boundingClientRect = this.containerRef.current.getBoundingClientRect();\n\n const { width, height } = boundingClientRect;\n\n if (width > 0 && height > 0) {\n this.setState({ width, height });\n }\n }\n }\n}\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,QAAQ,eAAe;AAsBzC,WAAsBC,KAAK,0BAAAC,UAAA;EAAAC,SAAA,CAAAF,KAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,KAAA;EAAA,SAAAA,MAAA;IAAA,IAAAK,KAAA;IAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAAAF,IAAA,CAAAE,IAAA,IAAAJ,SAAA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ED,SAAAA,IAAA,EAAwB;MACtB,OAAO,IAAI,CAACG,aAAa;IAC3B;EAAC;IAAAb,GAAA;IAAAC,KAAA,EAED,SAAAE,SAAA,EAAW;MACT,IAAI,IAAI,CAACY,YAAY,CAACC,OAAO,EAAE;QAC7B,IAAMC,kBAAkB,GAAG,IAAI,CAACF,YAAY,CAACC,OAAO,CAACE,qBAAqB,EAAE;QAE5E,IAAQtB,KAAK,GAAaqB,kBAAkB,CAApCrB,KAAK;UAAEC,MAAM,GAAKoB,kBAAkB,CAA7BpB,MAAM;QAErB,IAAID,KAAK,GAAG,CAAC,IAAIC,MAAM,GAAG,CAAC,EAAE;UAC3B,IAAI,CAACsB,QAAQ,CAAC;YAAEvB,KAAK,EAALA,KAAK;YAAEC,MAAM,EAANA;UAAO,CAAC,CAAC;QAClC;MACF;IACF;EAAC;EAAA,OAAAnB,KAAA;AAAA,EAjDOD,SAAS"}
|
|
@@ -17,7 +17,7 @@ export type CommonTrendProps = BoxProps & {
|
|
|
17
17
|
*/
|
|
18
18
|
data: any[];
|
|
19
19
|
};
|
|
20
|
-
export declare abstract class Trend<P extends CommonTrendProps, E> extends Component<P, {}, {
|
|
20
|
+
export declare abstract class Trend<P extends CommonTrendProps, E extends readonly ((...args: any[]) => any)[]> extends Component<P, {}, {
|
|
21
21
|
width: number;
|
|
22
22
|
height: number;
|
|
23
23
|
}, E> {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/mini-chart",
|
|
3
3
|
"description": "Semrush MiniChart Component",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.23.0",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"author": "UI-kit team <ui-kit-team@semrush.com>",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@semcore/flex-box": "5.
|
|
13
|
-
"@semcore/utils": "4.
|
|
12
|
+
"@semcore/flex-box": "5.36.0",
|
|
13
|
+
"@semcore/utils": "4.41.0"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"@semcore/core": "^2.17.5",
|