@semcore/mini-chart 17.2.2 → 18.0.0-prerelease.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/lib/cjs/component/score/line.shadow.css +4 -4
- package/lib/cjs/{component → components}/score/Donut.js +10 -10
- package/lib/cjs/components/score/Donut.js.map +1 -0
- package/lib/cjs/{component → components}/score/Line.js +24 -23
- package/lib/cjs/components/score/Line.js.map +1 -0
- package/lib/cjs/components/score/index.js.map +1 -0
- package/lib/cjs/{component → components}/trend/Bar.js +8 -8
- package/lib/cjs/components/trend/Bar.js.map +1 -0
- package/lib/cjs/{component → components}/trend/Line.js +8 -8
- package/lib/cjs/components/trend/Line.js.map +1 -0
- package/lib/cjs/components/trend/Trend.js.map +1 -0
- package/lib/cjs/components/trend/index.js.map +1 -0
- package/lib/cjs/index.js +3 -4
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/{component/score → styles}/donut.shadow.css +1 -1
- package/lib/cjs/styles/line.shadow.css +62 -0
- package/lib/cjs/types.js +2 -0
- package/lib/cjs/types.js.map +1 -0
- package/lib/es6/component/score/line.shadow.css +4 -4
- package/lib/es6/{component → components}/score/Donut.js +10 -10
- package/lib/es6/components/score/Donut.js.map +1 -0
- package/lib/es6/{component → components}/score/Line.js +24 -23
- package/lib/es6/components/score/Line.js.map +1 -0
- package/lib/es6/components/score/index.js +3 -0
- package/lib/es6/components/score/index.js.map +1 -0
- package/lib/es6/{component → components}/trend/Bar.js +8 -8
- package/lib/es6/components/trend/Bar.js.map +1 -0
- package/lib/es6/{component → components}/trend/Line.js +8 -8
- package/lib/es6/components/trend/Line.js.map +1 -0
- package/lib/es6/components/trend/Trend.js.map +1 -0
- package/lib/es6/components/trend/index.js +3 -0
- package/lib/es6/components/trend/index.js.map +1 -0
- package/lib/es6/index.js +3 -4
- package/lib/es6/index.js.map +1 -1
- package/lib/{esm/component/score → es6/styles}/donut.shadow.css +1 -1
- package/lib/es6/styles/line.shadow.css +62 -0
- package/lib/es6/types.js +2 -0
- package/lib/es6/types.js.map +1 -0
- package/lib/esm/component/score/line.shadow.css +4 -4
- package/lib/esm/{component → components}/score/Donut.mjs +11 -11
- package/lib/esm/{component → components}/score/Line.mjs +22 -24
- package/lib/esm/{component → components}/trend/Bar.mjs +9 -9
- package/lib/esm/{component → components}/trend/Line.mjs +9 -9
- package/lib/esm/index.mjs +8 -8
- package/lib/{es6/component/score → esm/styles}/donut.shadow.css +1 -1
- package/lib/esm/styles/line.shadow.css +62 -0
- package/lib/types/components/score/Donut.d.ts +14 -0
- package/lib/types/components/score/Donut.d.ts.map +1 -0
- package/lib/types/{component → components}/score/Line.d.ts +2 -2
- package/lib/types/components/score/Line.d.ts.map +1 -0
- package/lib/types/components/score/index.d.ts +3 -0
- package/lib/types/components/score/index.d.ts.map +1 -0
- package/lib/types/components/trend/Bar.d.ts +14 -0
- package/lib/types/components/trend/Bar.d.ts.map +1 -0
- package/lib/types/components/trend/Line.d.ts +14 -0
- package/lib/types/components/trend/Line.d.ts.map +1 -0
- package/lib/types/components/trend/Trend.d.ts +19 -0
- package/lib/types/components/trend/Trend.d.ts.map +1 -0
- package/lib/types/components/trend/index.d.ts +3 -0
- package/lib/types/components/trend/index.d.ts.map +1 -0
- package/lib/types/index.d.ts +11 -13
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/types.d.ts +153 -0
- package/lib/types/types.d.ts.map +1 -0
- package/package.json +5 -5
- package/lib/cjs/component/score/Donut.js.map +0 -1
- package/lib/cjs/component/score/Line.js.map +0 -1
- package/lib/cjs/component/score/Line.types.js +0 -2
- package/lib/cjs/component/score/Line.types.js.map +0 -1
- package/lib/cjs/component/score/Score.js +0 -2
- package/lib/cjs/component/score/Score.js.map +0 -1
- package/lib/cjs/component/score/index.js.map +0 -1
- package/lib/cjs/component/trend/Bar.js.map +0 -1
- package/lib/cjs/component/trend/Line.js.map +0 -1
- package/lib/cjs/component/trend/Trend.js.map +0 -1
- package/lib/cjs/component/trend/index.js.map +0 -1
- package/lib/es6/component/score/Donut.js.map +0 -1
- package/lib/es6/component/score/Line.js.map +0 -1
- package/lib/es6/component/score/Line.types.js +0 -2
- package/lib/es6/component/score/Line.types.js.map +0 -1
- package/lib/es6/component/score/Score.js +0 -2
- package/lib/es6/component/score/Score.js.map +0 -1
- package/lib/es6/component/score/index.js +0 -4
- package/lib/es6/component/score/index.js.map +0 -1
- package/lib/es6/component/trend/Bar.js.map +0 -1
- package/lib/es6/component/trend/Line.js.map +0 -1
- package/lib/es6/component/trend/Trend.js.map +0 -1
- package/lib/es6/component/trend/index.js +0 -4
- package/lib/es6/component/trend/index.js.map +0 -1
- package/lib/types/component/score/Donut.d.ts +0 -36
- package/lib/types/component/score/Donut.d.ts.map +0 -1
- package/lib/types/component/score/Line.d.ts.map +0 -1
- package/lib/types/component/score/Line.types.d.ts +0 -57
- package/lib/types/component/score/Line.types.d.ts.map +0 -1
- package/lib/types/component/score/Score.d.ts +0 -25
- package/lib/types/component/score/Score.d.ts.map +0 -1
- package/lib/types/component/score/index.d.ts +0 -4
- package/lib/types/component/score/index.d.ts.map +0 -1
- package/lib/types/component/trend/Bar.d.ts +0 -49
- package/lib/types/component/trend/Bar.d.ts.map +0 -1
- package/lib/types/component/trend/Line.d.ts +0 -57
- package/lib/types/component/trend/Line.d.ts.map +0 -1
- package/lib/types/component/trend/Trend.d.ts +0 -40
- package/lib/types/component/trend/Trend.d.ts.map +0 -1
- package/lib/types/component/trend/index.d.ts +0 -4
- package/lib/types/component/trend/index.d.ts.map +0 -1
- /package/lib/cjs/{component → components}/score/index.js +0 -0
- /package/lib/cjs/{component → components}/trend/Trend.js +0 -0
- /package/lib/cjs/{component → components}/trend/index.js +0 -0
- /package/lib/cjs/{component/skeleton → styles}/skeleton.shadow.css +0 -0
- /package/lib/es6/{component → components}/trend/Trend.js +0 -0
- /package/lib/es6/{component/skeleton → styles}/skeleton.shadow.css +0 -0
- /package/lib/esm/{component → components}/score/index.mjs +0 -0
- /package/lib/esm/{component → components}/trend/Trend.mjs +0 -0
- /package/lib/esm/{component → components}/trend/index.mjs +0 -0
- /package/lib/esm/{component/skeleton → styles}/skeleton.shadow.css +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
+
## [18.0.0] - 2026-09-28
|
|
6
|
+
|
|
7
|
+
### BREAK
|
|
8
|
+
|
|
9
|
+
- New theme applied.
|
|
10
|
+
- Update `MiniChart.Score` typings to enforce either `value`/`color`
|
|
11
|
+
props or custom `children`, preventing unsupported prop combinations.
|
|
12
|
+
|
|
5
13
|
## [17.2.2] - 2026-09-10
|
|
6
14
|
|
|
7
15
|
### Fixed
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
SLineGauge {
|
|
4
4
|
height: 8px;
|
|
5
|
-
background-color: var(--base-bg-color, var(--intergalactic-chart-grid-bar-chart-base-bg, oklch(0.
|
|
5
|
+
background-color: var(--base-bg-color, var(--intergalactic-chart-grid-bar-chart-base-bg, oklch(0.96 0.001 180)));
|
|
6
6
|
border-radius: var(--intergalactic-chart-rounded, 2px);
|
|
7
7
|
overflow: hidden;
|
|
8
8
|
position: relative;
|
|
@@ -18,7 +18,7 @@ SLineValue[percent] {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
SLineValue[color], SLineSegmentItem[color] {
|
|
21
|
-
background-color: var(--color, var(--intergalactic-chart-palette-order-1, oklch(0.
|
|
21
|
+
background-color: var(--color, var(--intergalactic-chart-palette-order-1, oklch(0.23 0.01 140)));
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
SLineGauge[segments] {
|
|
@@ -41,14 +41,14 @@ SLineSegmentItem:last-child {
|
|
|
41
41
|
SLineSegmentItem {
|
|
42
42
|
height: 8px;
|
|
43
43
|
background: transparent;
|
|
44
|
-
border-right-color: var(--intergalactic-chart-grid-border, #
|
|
44
|
+
border-right-color: var(--intergalactic-chart-grid-border, #ffffff);
|
|
45
45
|
border-right-style: solid;
|
|
46
46
|
border-right-width: 1px;
|
|
47
47
|
box-sizing: content-box;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
SAnimationLine {
|
|
51
|
-
background-color: var(--intergalactic-chart-grid-bar-chart-base-bg, oklch(0.
|
|
51
|
+
background-color: var(--intergalactic-chart-grid-bar-chart-base-bg, oklch(0.96 0.001 180));
|
|
52
52
|
transition: all var(--intergalactic-duration-extra-slow, 500) ease-in-out;
|
|
53
53
|
animation-name: move-line;
|
|
54
54
|
animation-duration: 0.5s;
|
|
@@ -13,18 +13,18 @@ var _resolveColorEnhance = _interopRequireDefault(require("@semcore/core/lib/uti
|
|
|
13
13
|
var _useCssVariable = require("@semcore/core/lib/utils/useCssVariable");
|
|
14
14
|
var _react = _interopRequireDefault(require("react"));
|
|
15
15
|
var _ScoreDonutUtils = require("../../utils/ScoreDonutUtils");
|
|
16
|
-
/*!__reshadow-styles__:"
|
|
17
|
-
const style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".
|
|
16
|
+
/*!__reshadow-styles__:"../../styles/donut.shadow.css"*/
|
|
17
|
+
const style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".___SDonutContainer_6nq9n_gg_.__loading_6nq9n_gg_,.___SLineGauge_6nq9n_gg_.__loading_6nq9n_gg_,.___STrendBar_6nq9n_gg_.__loading_6nq9n_gg_,.___STrendLine_6nq9n_gg_.__loading_6nq9n_gg_{animation-name:pulse_6nq9n;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}@keyframes pulse_6nq9n{0%{opacity:1}50%{opacity:.4}to{opacity:1}}.___SDonutContainer_6nq9n_gg_.__semi_6nq9n_gg_ g{transform:rotate(180deg) translate(-24px,-24px)}.___SDonutContainer_6nq9n_gg_ g{transform:rotate(-90deg) translate(-24px)}.___SDonutContainer_6nq9n_gg_.__animate_6nq9n_gg_ circle{transition:all var(--intergalactic-duration-extra-slow,500) ease-in-out}", /*__inner_css_end__*/"6nq9n_gg_"),
|
|
18
18
|
/*__reshadow_css_end__*/
|
|
19
19
|
{
|
|
20
|
-
"__SLineGauge": "
|
|
21
|
-
"_loading": "
|
|
22
|
-
"__SDonutContainer": "
|
|
23
|
-
"__STrendLine": "
|
|
24
|
-
"__STrendBar": "
|
|
25
|
-
"@pulse": "
|
|
26
|
-
"_animate": "
|
|
27
|
-
"_semi": "
|
|
20
|
+
"__SLineGauge": "___SLineGauge_6nq9n_gg_",
|
|
21
|
+
"_loading": "__loading_6nq9n_gg_",
|
|
22
|
+
"__SDonutContainer": "___SDonutContainer_6nq9n_gg_",
|
|
23
|
+
"__STrendLine": "___STrendLine_6nq9n_gg_",
|
|
24
|
+
"__STrendBar": "___STrendBar_6nq9n_gg_",
|
|
25
|
+
"@pulse": "pulse_6nq9n",
|
|
26
|
+
"_animate": "__animate_6nq9n_gg_",
|
|
27
|
+
"_semi": "__semi_6nq9n_gg_"
|
|
28
28
|
});
|
|
29
29
|
class DonutRoot extends _core.Component {
|
|
30
30
|
render() {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Donut.js","names":["_core","require","_baseComponents","_ariaProps","_resolveColorEnhance","_interopRequireDefault","_useCssVariable","_react","_ScoreDonutUtils","style","sstyled","insert","DonutRoot","Component","render","_ref","asProps","_ref2","SDonutContainer","Box","value","styles","baseBgColor","color","resolveColor","isSemiDonut","loading","animate","duration","scoreDonut","ScoreDonutUtils","__excludeProps","extractedAriaProps","extractAriaProps","default","createElement","cn","assignProps","viewBox","radius","strokeWidth","undefined","baseLength","fullLength","baseOffset","Fragment","animatedBaseLengthFrom","animatedBaseLengthTo","startMargin","valueLength","_defineProperty2","cssVariableEnhance","variable","fallback","map","v","Number","parseInt","toString","prop","resolveColorEnhance","ScoreDonut","exports","createComponent","displayName","ScoreSemiDonut","enhancements","wrapperProps","props"],"sources":["../../../../src/components/score/Donut.tsx"],"sourcesContent":["import { Box } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport { createComponent, Component, Root, sstyled, assignProps } from '@semcore/core';\nimport { extractAriaProps } from '@semcore/core/lib/utils/ariaProps';\nimport resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';\nimport { cssVariableEnhance } from '@semcore/core/lib/utils/useCssVariable';\nimport React from 'react';\n\nimport style from '../../styles/donut.shadow.css';\nimport type { NSMiniChart } from '../../types';\nimport { ScoreDonutUtils } from '../../utils/ScoreDonutUtils';\n\nclass DonutRoot extends Component<\n Intergalactic.InternalTypings.InferComponentProps<NSMiniChart.Score.Donut.Component>,\n typeof DonutRoot.enhance,\n {},\n {},\n {},\n NSMiniChart.Score.Donut.DefaultProps\n> {\n static enhance = [\n cssVariableEnhance({\n variable: '--intergalactic-duration-extra-slow',\n fallback: '500',\n map: (v: string) => Number.parseInt(v, 10).toString(),\n prop: 'duration',\n }),\n resolveColorEnhance(),\n ] as const;\n\n static style = style;\n\n static defaultProps = {\n animate: true,\n } as const;\n\n render() {\n const SDonutContainer = Root;\n const {\n value,\n styles,\n baseBgColor = 'chart-grid-bar-chart-base-bg',\n color = 'chart-palette-order-1',\n resolveColor,\n isSemiDonut,\n loading,\n animate,\n duration,\n } = this.asProps;\n\n const scoreDonut = new ScoreDonutUtils(value, isSemiDonut);\n const { __excludeProps, extractedAriaProps } = extractAriaProps(this.asProps);\n\n return sstyled(styles)(\n <SDonutContainer render={Box} semi={isSemiDonut} __excludeProps={__excludeProps}>\n <svg\n width='100%'\n height='100%'\n viewBox={scoreDonut.viewBox}\n fill='none'\n role='img'\n {...extractedAriaProps}\n >\n <g>\n <circle\n cx='12'\n cy='12'\n r={scoreDonut.radius}\n strokeWidth={scoreDonut.strokeWidth}\n stroke={resolveColor(baseBgColor)}\n strokeDasharray={\n loading\n ? undefined\n : `${scoreDonut.baseLength} ${scoreDonut.fullLength}`\n }\n strokeDashoffset={scoreDonut.baseOffset}\n >\n {animate && value > 0 && (\n <>\n <animate\n attributeName='stroke-dasharray'\n from={`${scoreDonut.animatedBaseLengthFrom} ${scoreDonut.fullLength}`}\n to={`${scoreDonut.animatedBaseLengthTo} ${scoreDonut.fullLength}`}\n dur={duration + 'ms'}\n />\n <animate\n attributeName='stroke-dashoffset'\n from={-1 * scoreDonut.startMargin}\n to={scoreDonut.baseOffset}\n dur={duration + 'ms'}\n />\n </>\n )}\n </circle>\n {!loading && value > 0 && (\n <>\n <circle\n cx='12'\n cy='12'\n r={scoreDonut.radius}\n strokeWidth={scoreDonut.strokeWidth}\n stroke={resolveColor(color)}\n strokeDasharray={`${scoreDonut.valueLength} ${scoreDonut.fullLength}`}\n >\n {animate && (\n <animate\n attributeName='stroke-dasharray'\n from={`0 ${scoreDonut.fullLength}`}\n to={`${scoreDonut.valueLength} ${scoreDonut.fullLength}`}\n dur={duration + 'ms'}\n />\n )}\n </circle>\n </>\n )}\n </g>\n </svg>\n </SDonutContainer>,\n );\n }\n}\n\n/**\n * MiniCharts.ScoreDount\n *\n * {@link https://developer.semrush.com/intergalactic/data-display/mini-chart/mini-chart-api|API} | {@link https://developer.semrush.com/intergalactic/data-display/mini-chart/mini-chart-code|Examples}\n */\nexport const ScoreDonut = createComponent<\n NSMiniChart.Score.Donut.Component,\n typeof DonutRoot\n>(DonutRoot);\n\nScoreDonut.displayName = 'MiniChart.ScoreDonut';\n\n/**\n * MiniCharts.ScoreSemiDount\n *\n * {@link https://developer.semrush.com/intergalactic/data-display/mini-chart/mini-chart-api|API} | {@link https://developer.semrush.com/intergalactic/data-display/mini-chart/mini-chart-code|Examples}\n */\nexport const ScoreSemiDonut = createComponent<\n NSMiniChart.Score.Donut.Component,\n typeof DonutRoot\n>(\n DonutRoot,\n {},\n {\n enhancements: [\n () => {\n return {\n wrapperProps: (props: NSMiniChart.Score.Donut.Props) => {\n return assignProps(props, { isSemiDon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,MAAMkC,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAG,IAAAE,qBAAe,EAGvCnD,SAAS,CAAC;AAEZiD,UAAU,CAACG,WAAW,GAAG,sBAAsB;;AAE/C;AACA;AACA;AACA;AACA;AACO,MAAMC,cAAc,GAAAH,OAAA,CAAAG,cAAA,GAAG,IAAAF,qBAAe,EAI3CnD,SAAS,EACT,CAAC,CAAC,EACF;EACEsD,YAAY,EAAE,CACZ,MAAM;IACJ,OAAO;MACLC,YAAY,EAAGC,KAAoC,IAAK;QACtD,OAAO,IAAA/B,iBAAW,EAAC+B,KAAK,EAAE;UAAE3C,WAAW,EAAE;QAAK,CAAC,CAAC;MAClD;IACF,CAAC;EACH,CAAC;AAEL,CACF,CAAC;AAEDwC,cAAc,CAACD,WAAW,GAAG,0BAA0B","ignoreList":[]}
|
|
@@ -10,27 +10,27 @@ var _core = require("@semcore/core");
|
|
|
10
10
|
var _baseComponents = require("@semcore/base-components");
|
|
11
11
|
var _resolveColorEnhance = _interopRequireDefault(require("@semcore/core/lib/utils/enhances/resolveColorEnhance"));
|
|
12
12
|
var _react = _interopRequireDefault(require("react"));
|
|
13
|
-
/*!__reshadow-styles__:"
|
|
14
|
-
const style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".
|
|
13
|
+
/*!__reshadow-styles__:"../../styles/line.shadow.css"*/
|
|
14
|
+
const style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".___SDonutContainer_1bwtu_gg_.__loading_1bwtu_gg_,.___SLineGauge_1bwtu_gg_.__loading_1bwtu_gg_,.___STrendBar_1bwtu_gg_.__loading_1bwtu_gg_,.___STrendLine_1bwtu_gg_.__loading_1bwtu_gg_{animation-name:pulse_1bwtu;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}@keyframes pulse_1bwtu{0%{opacity:1}50%{opacity:.4}to{opacity:1}}.___SLineGauge_1bwtu_gg_{height:8px;background-color:var(--base-bg-color_1bwtu,var(--intergalactic-chart-grid-bar-chart-base-bg,oklch(.96 .001 180)));border-radius:var(--intergalactic-chart-rounded,2px);overflow:hidden;position:relative}.___SLineValue_1bwtu_gg_{height:8px;border-radius:var(--intergalactic-chart-rounded,2px) 0 0 var(--intergalactic-chart-rounded,2px)}.___SLineValue_1bwtu_gg_.__percent_1bwtu_gg_{width:var(--percent_1bwtu)}.___SLineSegmentItem_1bwtu_gg_.__color_1bwtu_gg_,.___SLineValue_1bwtu_gg_.__color_1bwtu_gg_{background-color:var(--color_1bwtu,var(--intergalactic-chart-palette-order-1,oklch(.23 .01 140)))}.___SLineGauge_1bwtu_gg_.__segments_1bwtu_gg_{border-radius:var(--intergalactic-progress-bar-rounded,6px)}.___SAnimationLine_1bwtu_gg_,.___SLineGaugeSegment_1bwtu_gg_{position:absolute;top:0;left:0;right:0;bottom:0}.___SLineSegmentItem_1bwtu_gg_:last-child{margin-right:0;border-right:none}.___SLineSegmentItem_1bwtu_gg_{height:8px;background:#0000;border-right:1px solid var(--intergalactic-chart-grid-border,#fff);box-sizing:initial}.___SAnimationLine_1bwtu_gg_{background-color:var(--intergalactic-chart-grid-bar-chart-base-bg,oklch(.96 .001 180));transition:all var(--intergalactic-duration-extra-slow,500) ease-in-out;animation-name:move-line_1bwtu;animation-duration:.5s;animation-timing-function:ease-in-out;animation-fill-mode:forwards}@keyframes move-line_1bwtu{0%{transform:translateX(0)}to{transform:translateX(100%)}}", /*__inner_css_end__*/"1bwtu_gg_"),
|
|
15
15
|
/*__reshadow_css_end__*/
|
|
16
16
|
{
|
|
17
|
-
"__SLineGauge": "
|
|
18
|
-
"_loading": "
|
|
19
|
-
"__SDonutContainer": "
|
|
20
|
-
"__STrendLine": "
|
|
21
|
-
"__STrendBar": "
|
|
22
|
-
"@pulse": "
|
|
23
|
-
"--base-bg-color": "--base-bg-
|
|
24
|
-
"__SLineValue": "
|
|
25
|
-
"_percent": "
|
|
26
|
-
"--percent": "--
|
|
27
|
-
"_color": "
|
|
28
|
-
"__SLineSegmentItem": "
|
|
29
|
-
"--color": "--
|
|
30
|
-
"_segments": "
|
|
31
|
-
"__SLineGaugeSegment": "
|
|
32
|
-
"__SAnimationLine": "
|
|
33
|
-
"@move-line": "move-
|
|
17
|
+
"__SLineGauge": "___SLineGauge_1bwtu_gg_",
|
|
18
|
+
"_loading": "__loading_1bwtu_gg_",
|
|
19
|
+
"__SDonutContainer": "___SDonutContainer_1bwtu_gg_",
|
|
20
|
+
"__STrendLine": "___STrendLine_1bwtu_gg_",
|
|
21
|
+
"__STrendBar": "___STrendBar_1bwtu_gg_",
|
|
22
|
+
"@pulse": "pulse_1bwtu",
|
|
23
|
+
"--base-bg-color": "--base-bg-color_1bwtu",
|
|
24
|
+
"__SLineValue": "___SLineValue_1bwtu_gg_",
|
|
25
|
+
"_percent": "__percent_1bwtu_gg_",
|
|
26
|
+
"--percent": "--percent_1bwtu",
|
|
27
|
+
"_color": "__color_1bwtu_gg_",
|
|
28
|
+
"__SLineSegmentItem": "___SLineSegmentItem_1bwtu_gg_",
|
|
29
|
+
"--color": "--color_1bwtu",
|
|
30
|
+
"_segments": "__segments_1bwtu_gg_",
|
|
31
|
+
"__SLineGaugeSegment": "___SLineGaugeSegment_1bwtu_gg_",
|
|
32
|
+
"__SAnimationLine": "___SAnimationLine_1bwtu_gg_",
|
|
33
|
+
"@move-line": "move-line_1bwtu"
|
|
34
34
|
});
|
|
35
35
|
class LineRoot extends _core.Component {
|
|
36
36
|
getSegmentProps(segmentProps) {
|
|
@@ -78,6 +78,7 @@ class LineRoot extends _core.Component {
|
|
|
78
78
|
}, _ref)
|
|
79
79
|
}), /*#__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", {})));
|
|
80
80
|
}
|
|
81
|
+
if (value === undefined) return null;
|
|
81
82
|
const {
|
|
82
83
|
segments
|
|
83
84
|
} = this.asProps;
|
|
@@ -117,16 +118,13 @@ function Segment(props) {
|
|
|
117
118
|
var _ref2 = arguments[0],
|
|
118
119
|
_ref6;
|
|
119
120
|
const {
|
|
120
|
-
styles
|
|
121
|
-
value
|
|
121
|
+
styles
|
|
122
122
|
} = props;
|
|
123
123
|
const SLineSegmentItem = _baseComponents.Box;
|
|
124
|
-
if (!value) return null;
|
|
125
124
|
return _ref6 = (0, _core.sstyled)(styles), /*#__PURE__*/_react.default.createElement(SLineSegmentItem, _ref6.cn("SLineSegmentItem", {
|
|
126
125
|
...(0, _core.assignProps)({}, _ref2)
|
|
127
126
|
}));
|
|
128
127
|
}
|
|
129
|
-
Segment.displayName = 'Segment';
|
|
130
128
|
|
|
131
129
|
/**
|
|
132
130
|
* MiniCharts.ScoreLine
|
|
@@ -136,5 +134,8 @@ Segment.displayName = 'Segment';
|
|
|
136
134
|
const ScoreLine = exports.ScoreLine = (0, _core.createComponent)(LineRoot, {
|
|
137
135
|
Segment
|
|
138
136
|
});
|
|
137
|
+
|
|
138
|
+
// Since the Intergalactic.Component was unfolded to plain component structure.
|
|
139
|
+
// @ts-ignore
|
|
139
140
|
ScoreLine.displayName = 'MiniChart.ScoreLine';
|
|
140
141
|
//# sourceMappingURL=Line.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Line.js","names":["_core","require","_baseComponents","_resolveColorEnhance","_interopRequireDefault","_react","style","sstyled","insert","LineRoot","Component","getSegmentProps","segmentProps","children","resolveColor","asProps","sum","React","Children","forEach","child","isValidElement","props","value","width","color","render","_ref","_ref5","SLineGauge","Box","SLineValue","SAnimationLine","SLineGaugeSegment","Flex","SLineSegmentItem","styles","baseBgColor","loading","animate","undefined","_ref3","default","createElement","cn","assignProps","segments","SegmentItems","i","_ref4","push","percent","Boolean","length","_defineProperty2","resolveColorEnhance","Segment","_ref2","arguments[0]","_ref6","ScoreLine","exports","createComponent","displayName"],"sources":["../../../../src/components/score/Line.tsx"],"sourcesContent":["import { Box, Flex } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport { createComponent, Component, Root, sstyled } from '@semcore/core';\nimport resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';\nimport React from 'react';\n\nimport style from '../../styles/line.shadow.css';\nimport type { NSMiniChart } from '../../types';\n\nclass LineRoot extends Component<\n Intergalactic.InternalTypings.InferComponentProps<NSMiniChart.Score.Line.Component>,\n typeof LineRoot.enhance,\n {},\n {},\n {},\n NSMiniChart.Score.Line.DefaultProps\n> {\n static enhance = [resolveColorEnhance()] as const;\n static displayName = 'ScoreLine';\n\n static style = style;\n\n static defaultProps = {\n animate: true,\n } as const;\n\n getSegmentProps(segmentProps: NSMiniChart.Score.Line.Segment.Props) {\n const { children, resolveColor } = this.asProps;\n\n let sum = 0;\n React.Children.forEach(children, (child) => {\n if (React.isValidElement<NSMiniChart.Score.Line.Segment.Props>(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 baseBgColor,\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 base-bg-color={resolveColor(baseBgColor)}>\n <SLineGaugeSegment>\n <Children />\n </SLineGaugeSegment>\n {animate && <SAnimationLine />}\n </SLineGauge>,\n );\n }\n\n if (value === undefined) return null;\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} base-bg-color={resolveColor(baseBgColor)}>\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(\n props: Intergalactic.InternalTypings.InferChildComponentProps<NSMiniChart.Score.Line.Segment.Component, typeof LineRoot, 'Segment'>,\n) {\n const { styles } = props;\n const SLineSegmentItem = Root;\n\n return sstyled(styles)(<SLineSegmentItem render={Box} />);\n}\n\n/**\n * MiniCharts.ScoreLine\n *\n * {@link https://developer.semrush.com/intergalactic/data-display/mini-chart/mini-chart-api|API} | {@link https://developer.semrush.com/intergalactic/data-display/mini-chart/mini-chart-code|Examples}\n */\nexport const ScoreLine = createComponent<\n NSMiniChart.Score.Line.Component,\n typeof LineRoot\n>(LineRoot, { Segment });\n\n// Since the Intergalactic.Component was unfolded to plain component structure.\n// @ts-ignore\nScoreLine.displayName = 'MiniChart.ScoreLine';\n"],"mappings":";;;;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAFA,IAAAC,eAAA,GAAAD,OAAA;AAGA,IAAAE,oBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAD,sBAAA,CAAAH,OAAA;AAA0B;AAAA,MAAAK,KAAA,8BAAAN,KAAA,CAAAO,OAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAK1B,MAAMC,QAAQ,SAASC,eAAS,CAO9B;EAUAC,eAAeA,CAACC,YAAkD,EAAE;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AAgB,EAAAwB,KAAA,CAAAf,EAAA;IAAA,OAAA5C,KAAA,CAAA6C,WAAA,MAAAY,KAAA;EAAA,EAAe,CAAC;AAC1D;;AAEA;AACA;AACA;AACA;AACA;AACO,MAAMG,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG,IAAAE,qBAAe,EAGtCrD,QAAQ,EAAE;EAAE+C;AAAQ,CAAC,CAAC;;AAExB;AACA;AACAI,SAAS,CAACG,WAAW,GAAG,qBAAqB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Donut","require","_Line"],"sources":["../../../../src/components/score/index.ts"],"sourcesContent":["export { ScoreDonut, ScoreSemiDonut } from './Donut';\nexport { ScoreLine } from './Line';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA","ignoreList":[]}
|
|
@@ -12,16 +12,16 @@ var _ariaProps = require("@semcore/core/lib/utils/ariaProps");
|
|
|
12
12
|
var _resolveColorEnhance = _interopRequireDefault(require("@semcore/core/lib/utils/enhances/resolveColorEnhance"));
|
|
13
13
|
var _react = _interopRequireDefault(require("react"));
|
|
14
14
|
var _Trend = require("./Trend");
|
|
15
|
-
/*!__reshadow-styles__:"
|
|
16
|
-
const style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".
|
|
15
|
+
/*!__reshadow-styles__:"../../styles/skeleton.shadow.css"*/
|
|
16
|
+
const style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".___SDonutContainer_30y2p_gg_.__loading_30y2p_gg_,.___SLineGauge_30y2p_gg_.__loading_30y2p_gg_,.___STrendBar_30y2p_gg_.__loading_30y2p_gg_,.___STrendLine_30y2p_gg_.__loading_30y2p_gg_{animation-name:pulse_30y2p;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}@keyframes pulse_30y2p{0%{opacity:1}50%{opacity:.4}to{opacity:1}}", /*__inner_css_end__*/"30y2p_gg_"),
|
|
17
17
|
/*__reshadow_css_end__*/
|
|
18
18
|
{
|
|
19
|
-
"__SLineGauge": "
|
|
20
|
-
"_loading": "
|
|
21
|
-
"__SDonutContainer": "
|
|
22
|
-
"__STrendLine": "
|
|
23
|
-
"__STrendBar": "
|
|
24
|
-
"@pulse": "
|
|
19
|
+
"__SLineGauge": "___SLineGauge_30y2p_gg_",
|
|
20
|
+
"_loading": "__loading_30y2p_gg_",
|
|
21
|
+
"__SDonutContainer": "___SDonutContainer_30y2p_gg_",
|
|
22
|
+
"__STrendLine": "___STrendLine_30y2p_gg_",
|
|
23
|
+
"__STrendBar": "___STrendBar_30y2p_gg_",
|
|
24
|
+
"@pulse": "pulse_30y2p"
|
|
25
25
|
});
|
|
26
26
|
class TrendBarRoot extends _Trend.Trend {
|
|
27
27
|
get defaultData() {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Bar.js","names":["_core","require","_baseComponents","_ariaProps","_resolveColorEnhance","_interopRequireDefault","_react","_Trend","style","sstyled","insert","TrendBarRoot","Trend","defaultData","value","data","loading","asProps","render","_ref","_ref2","STrendBar","Box","styles","resolveColor","isHistogram","animate","step","defaultWidth","length","__excludeProps","extractedAriaProps","extractAriaProps","default","createElement","cn","assignProps","containerRef","svgWidth","svgHeight","map","barItem","index","color","key","x","y","defaultHeight","width","height","fill","attributeName","values","dur","_defineProperty2","resolveColorEnhance","TrendBar","exports","createComponent","displayName","TrendHistogram","enhancements","wrapperProps","props"],"sources":["../../../../src/components/trend/Bar.tsx"],"sourcesContent":["import { Box } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport { createComponent, assignProps, Root, sstyled } from '@semcore/core';\nimport { extractAriaProps } from '@semcore/core/lib/utils/ariaProps';\nimport resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';\nimport React from 'react';\n\nimport { Trend } from './Trend';\nimport style from '../../styles/skeleton.shadow.css';\nimport type { NSMiniChart } from '../../types';\n\nclass TrendBarRoot extends Trend<\n Intergalactic.InternalTypings.InferComponentProps<NSMiniChart.Trend.Bar.Component>,\n typeof TrendBarRoot.enhance,\n NSMiniChart.Trend.Bar.DefaultProps\n> {\n static enhance = [resolveColorEnhance()] as const;\n\n static style = style;\n\n static defaultProps = {\n animate: true,\n } as const;\n\n get defaultData(): NSMiniChart.Trend.Bar.Item[] {\n return [{ value: 20 }, { value: 80 }, { value: 45 }, { value: 10 }];\n }\n\n get data(): NSMiniChart.Trend.Bar.Item[] {\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 const { __excludeProps, extractedAriaProps } = extractAriaProps(this.asProps);\n\n return sstyled(styles)(\n <STrendBar render={Box} ref={this.containerRef} __excludeProps={['data', ...__excludeProps]}>\n <svg\n width='100%'\n height='100%'\n viewBox={`0 0 ${this.svgWidth} ${this.svgHeight}`}\n role='img'\n {...extractedAriaProps}\n >\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\n/**\n * MiniCharts.TrendBar\n *\n * {@link https://developer.semrush.com/intergalactic/data-display/mini-chart/mini-chart-api#trend-charts|API} | {@link https://developer.semrush.com/intergalactic/data-display/mini-chart/mini-chart-code|Examples}\n */\nexport const TrendBar = createComponent<\n NSMiniChart.Trend.Bar.Component,\n typeof TrendBarRoot\n>(TrendBarRoot);\n\nTrendBar.displayName = 'MiniChart.TrendBar';\n\n/**\n * MiniCharts.TrendHistogram\n *\n * {@link https://developer.semrush.com/intergalactic/data-display/mini-chart/mini-chart-api#trend-charts|API} | {@link https://developer.semrush.com/intergalactic/data-display/mini-chart/mini-chart-code|Examples}\n */\nexport const TrendHistogram = createComponent<\n NSMiniChart.Trend.Bar.Component,\n typeof TrendBarRoot\n>(\n TrendBarRoot,\n {},\n {\n enhancements: [\n () => {\n return {\n wrapperProps: (props: NSMiniChart.Trend.Bar.Props) => {\n return assignProps(props, { isHistogram: true });\n },\n };\n },\n ],\n },\n);\n\nTrendHistogram.displayName = 'MiniChart.TrendHistogram';\n"],"mappings":";;;;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAFA,IAAAC,eAAA,GAAAD,OAAA;AAGA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAD,sBAAA,CAAAJ,OAAA;AAEA,IAAAM,MAAA,GAAAN,OAAA;AAAgC;AAAA,MAAAO,KAAA,8BAAAR,KAAA,CAAAS,OAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAIhC,MAAMC,YAAY,SAASC,YAAK,CAI9B;EASA,IAAIC,WAAWA,CAAA,EAAiC;IAC9C,OAAO,CAAC;MAAEC,KAAK,EAAE;IAAG,CAAC,EAAE;MAAEA,KAAK,EAAE;IAAG,CAAC,EAAE;MAAEA,KAAK,EAAE;IAAG,CAAC,EAAE;MAAEA,KAAK,EAAE;IAAG,CAAC,CAAC;EACrE;EAEA,IAAIC,IAAIA,CAAA,EAAiC;IACvC,MAAM;MAAEA,IAAI;MAAEC;IAAQ,CAAC,GAAG,IAAI,CAACC,OAAO;IAEtC,IAAID,OAAO,EAAE;MACX,OAAO,IAAI,CAACH,WAAW;IACzB;IAEA,OAAOE,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DmC,cAAc,CAACD,WAAW,GAAG,0BAA0B","ignoreList":[]}
|
|
@@ -13,16 +13,16 @@ var _resolveColorEnhance = _interopRequireDefault(require("@semcore/core/lib/uti
|
|
|
13
13
|
var _uniqueID = _interopRequireDefault(require("@semcore/core/lib/utils/uniqueID"));
|
|
14
14
|
var _react = _interopRequireDefault(require("react"));
|
|
15
15
|
var _Trend = require("./Trend");
|
|
16
|
-
/*!__reshadow-styles__:"
|
|
17
|
-
const style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".
|
|
16
|
+
/*!__reshadow-styles__:"../../styles/skeleton.shadow.css"*/
|
|
17
|
+
const style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".___SDonutContainer_30y2p_gg_.__loading_30y2p_gg_,.___SLineGauge_30y2p_gg_.__loading_30y2p_gg_,.___STrendBar_30y2p_gg_.__loading_30y2p_gg_,.___STrendLine_30y2p_gg_.__loading_30y2p_gg_{animation-name:pulse_30y2p;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}@keyframes pulse_30y2p{0%{opacity:1}50%{opacity:.4}to{opacity:1}}", /*__inner_css_end__*/"30y2p_gg_"),
|
|
18
18
|
/*__reshadow_css_end__*/
|
|
19
19
|
{
|
|
20
|
-
"__SLineGauge": "
|
|
21
|
-
"_loading": "
|
|
22
|
-
"__SDonutContainer": "
|
|
23
|
-
"__STrendLine": "
|
|
24
|
-
"__STrendBar": "
|
|
25
|
-
"@pulse": "
|
|
20
|
+
"__SLineGauge": "___SLineGauge_30y2p_gg_",
|
|
21
|
+
"_loading": "__loading_30y2p_gg_",
|
|
22
|
+
"__SDonutContainer": "___SDonutContainer_30y2p_gg_",
|
|
23
|
+
"__STrendLine": "___STrendLine_30y2p_gg_",
|
|
24
|
+
"__STrendBar": "___STrendBar_30y2p_gg_",
|
|
25
|
+
"@pulse": "pulse_30y2p"
|
|
26
26
|
});
|
|
27
27
|
class TrendLineRoot extends _Trend.Trend {
|
|
28
28
|
get defaultData() {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Line.js","names":["_core","require","_baseComponents","_ariaProps","_resolveColorEnhance","_interopRequireDefault","_uniqueID","_react","_Trend","style","sstyled","insert","TrendLineRoot","Trend","defaultData","lastPointRadius","asProps","data","loading","svgWidth","lastPointColor","defaultWidth","svgHeight","defaultHeight","color","resolveColor","render","_ref","_ref2","STrendLine","Box","uid","withArea","animate","styles","points","length","step","i","push","__excludeProps","extractedAriaProps","extractAriaProps","default","createElement","cn","assignProps","containerRef","join","_defineProperty2","resolveColorEnhance","uniqueIDEnhancement","TrendLine","exports","createComponent","displayName","TrendArea","enhancements","wrapperProps","props"],"sources":["../../../../src/components/trend/Line.tsx"],"sourcesContent":["import { Box } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport { createComponent, assignProps, Root, sstyled } from '@semcore/core';\nimport { extractAriaProps } from '@semcore/core/lib/utils/ariaProps';\nimport resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';\nimport uniqueIDEnhancement from '@semcore/core/lib/utils/uniqueID';\nimport React from 'react';\n\nimport { Trend } from './Trend';\nimport style from '../../styles/skeleton.shadow.css';\nimport type { NSMiniChart } from '../../types';\n\nclass TrendLineRoot extends Trend<\n Intergalactic.InternalTypings.InferComponentProps<NSMiniChart.Trend.Line.Component>,\n typeof TrendLineRoot.enhance,\n NSMiniChart.Trend.Line.DefaultProps\n> {\n static enhance = [resolveColorEnhance(), uniqueIDEnhancement()] as const;\n\n static style = style;\n\n static defaultProps = {\n animate: true,\n } as const;\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 const { __excludeProps, extractedAriaProps } = extractAriaProps(this.asProps);\n\n return sstyled(styles)(\n <STrendLine render={Box} ref={this.containerRef} __excludeProps={['data', ...__excludeProps]}>\n <svg\n width='100%'\n height='100%'\n viewBox={`0 0 ${this.svgWidth} ${this.svgHeight}`}\n role='img'\n {...extractedAriaProps}\n >\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\n/**\n * MiniCharts.TrendLine\n *\n * {@link https://developer.semrush.com/intergalactic/data-display/mini-chart/mini-chart-api#trend-charts|API} | {@link https://developer.semrush.com/intergalactic/data-display/mini-chart/mini-chart-code|Examples}\n */\nexport const TrendLine = createComponent<NSMiniChart.Trend.Line.Component, typeof TrendLineRoot>(TrendLineRoot);\n\nTrendLine.displayName = 'MiniChart.TrendLine';\n\n/**\n * MiniCharts.TrendArea\n *\n * {@link https://developer.semrush.com/intergalactic/data-display/mini-chart/mini-chart-api#trend-charts|API} | {@link https://developer.semrush.com/intergalactic/data-display/mini-chart/mini-chart-code|Examples}\n */\nexport const TrendArea = createComponent<NSMiniChart.Trend.Line.Component, typeof TrendLineRoot>(\n TrendLineRoot,\n {},\n {\n enhancements: [\n () => {\n return {\n wrapperProps: (props: NSMiniChart.Trend.Line.Props) => {\n return assignProps(props, { withArea: true });\n },\n };\n },\n ],\n },\n);\n\nTrendArea.displayName = 'MiniChart.TrendArea';\n"],"mappings":";;;;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAFA,IAAAC,eAAA,GAAAD,OAAA;AAGA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,MAAA,GAAAF,sBAAA,CAAAJ,OAAA;AAEA,IAAAO,MAAA,GAAAP,OAAA;AAAgC;AAAA,MAAAQ,KAAA,8BAAAT,KAAA,CAAAU,OAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAIhC,MAAMC,aAAa,SAASC,YAAK,CAI/B;EASA,IAAIC,WAAWA,CAAA,EAAa;IAC1B,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;EAC7B;EAEA,IAAIC,eAAeA,CAAA,EAAW;IAC5B,OAAO,IAAI,CAACC,OAAO,CAACD,eAAe,IAAI,CAAC;EAC1C;EAEA,IAAIE,IAAIA,CAAA,EAAa;IACnB,MAAM;MAAEA,IA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AE,qBAAe,EAAyD1C,aAAa,CAAC;AAE/GwC,SAAS,CAACG,WAAW,GAAG,qBAAqB;;AAE7C;AACA;AACA;AACA;AACA;AACO,MAAMC,SAAS,GAAAH,OAAA,CAAAG,SAAA,GAAG,IAAAF,qBAAe,EACtC1C,aAAa,EACb,CAAC,CAAC,EACF;EACE6C,YAAY,EAAE,CACZ,MAAM;IACJ,OAAO;MACLC,YAAY,EAAGC,KAAmC,IAAK;QACrD,OAAO,IAAAb,iBAAW,EAACa,KAAK,EAAE;UAAE3B,QAAQ,EAAE;QAAK,CAAC,CAAC;MAC/C;IACF,CAAC;EACH,CAAC;AAEL,CACF,CAAC;AAEDwB,SAAS,CAACD,WAAW,GAAG,qBAAqB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Trend.js","names":["_core","require","_react","_interopRequireDefault","Trend","Component","constructor","args","_defineProperty2","default","width","height","React","createRef","componentDidMount","setSizes","componentDidUpdate","prevProps","w","props","h","data","defaultWidth","state","defaultHeight","svgWidth","svgHeight","containerRef","current","boundingClientRect","getBoundingClientRect","setState","exports"],"sources":["../../../../src/components/trend/Trend.tsx"],"sourcesContent":["import type { Intergalactic } from '@semcore/core';\nimport { Component } from '@semcore/core';\nimport React from 'react';\n\nimport type { NSMiniChart } from '../../types';\n\nexport abstract class Trend<\n P extends Record<string, any>,\n E extends readonly ((...args: any[]) => any)[],\n DP extends Intergalactic.InternalTypings.ValidDefaultProps<DP, P> = never,\n> extends Component<P, E, Readonly<{}>, {}, NSMiniChart.Trend.CommonState, DP> {\n state = {\n width: 200,\n height: 100,\n };\n\n containerRef = React.createRef<HTMLDivElement>();\n\n componentDidMount() {\n this.setSizes();\n }\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":";;;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAIO,MAAeG,KAAK,SAIjBC,eAAS,CAA4D;EAAAC,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,iBACrE;MACNC,KAAK,EAAE,GAAG;MACVC,MAAM,EAAE;IACV,CAAC;IAAA,IAAAH,gBAAA,CAAAC,OAAA,qCAEcG,cAAK,CAACC,SAAS,CAAiB,CAAC;EAAA;EAEhDC,iBAAiBA,CAAA,EAAG;IAClB,IAAI,CAACC,QAAQ,CAAC,CAAC;EACjB;EAEAC,kBAAkBA,CAACC,SAAY,EAAE;IAC/B,IACEA,SAAS,CAACC,CAAC,KAAK,IAAI,CAACC,KAAK,CAACD,CAAC,IAC5BD,SAAS,CAACG,CAAC,KAAK,IAAI,CAACD,KAAK,CAACC,CAAC,IAC5BH,SAAS,CAACI,IAAI,KAAK,IAAI,CAACF,KAAK,CAACE,IAAI,EAClC;MACA,IAAI,CAACN,QAAQ,CAAC,CAAC;IACjB;EACF;EAEA,IAAIO,YAAYA,CAAA,EAAW;IACzB,MAAM;MAAEZ,KAAK;MAAEC;IAAO,CAAC,GAAG,IAAI,CAACY,KAAK;IAEpC,OAAQb,KAAK,GAAGC,MAAM,GAAI,IAAI,CAACa,aAAa;EAC9C;EAEA,IAAIA,aAAaA,CAAA,EAAW;IAC1B,OAAO,GAAG;EACZ;EAEA,IAAIC,QAAQA,CAAA,EAAW;IACrB,OAAO,IAAI,CAACH,YAAY;EAC1B;EAEA,IAAII,SAASA,CAAA,EAAW;IACtB,OAAO,IAAI,CAACF,aAAa;EAC3B;EAEAT,QAAQA,CAAA,EAAG;IACT,IAAI,IAAI,CAACY,YAAY,CAACC,OAAO,EAAE;MAC7B,MAAMC,kBAAkB,GAAG,IAAI,CAACF,YAAY,CAACC,OAAO,CAACE,qBAAqB,CAAC,CAAC;MAE5E,MAAM;QAAEpB,KAAK;QAAEC;MAAO,CAAC,GAAGkB,kBAAkB;MAE5C,IAAInB,KAAK,GAAG,CAAC,IAAIC,MAAM,GAAG,CAAC,EAAE;QAC3B,IAAI,CAACoB,QAAQ,CAAC;UAAErB,KAAK;UAAEC;QAAO,CAAC,CAAC;MAClC;IACF;EACF;AACF;AAACqB,OAAA,CAAA5B,KAAA,GAAAA,KAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Bar","require","_Line"],"sources":["../../../../src/components/trend/index.ts"],"sourcesContent":["export { TrendBar, TrendHistogram } from './Bar';\nexport { TrendLine, TrendArea } from './Line';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA","ignoreList":[]}
|
package/lib/cjs/index.js
CHANGED
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _score = require("./
|
|
8
|
-
var _trend = require("./
|
|
9
|
-
|
|
7
|
+
var _score = require("./components/score");
|
|
8
|
+
var _trend = require("./components/trend");
|
|
9
|
+
var _default = exports.default = {
|
|
10
10
|
TrendLine: _trend.TrendLine,
|
|
11
11
|
TrendArea: _trend.TrendArea,
|
|
12
12
|
TrendBar: _trend.TrendBar,
|
|
@@ -15,5 +15,4 @@ const miniCharts = {
|
|
|
15
15
|
ScoreDonut: _score.ScoreDonut,
|
|
16
16
|
ScoreLine: _score.ScoreLine
|
|
17
17
|
};
|
|
18
|
-
var _default = exports.default = miniCharts;
|
|
19
18
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_score","require","_trend","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_score","require","_trend","_default","exports","default","TrendLine","TrendArea","TrendBar","TrendHistogram","ScoreSemiDonut","ScoreDonut","ScoreLine"],"sources":["../../src/index.ts"],"sourcesContent":["import { ScoreDonut, ScoreSemiDonut, ScoreLine } from './components/score';\nimport { TrendLine, TrendArea, TrendBar, TrendHistogram } from './components/trend';\nimport type { SegmentColor, NSMiniChart } from './types';\n\nexport default {\n TrendLine,\n TrendArea,\n TrendBar,\n TrendHistogram,\n ScoreSemiDonut,\n ScoreDonut,\n ScoreLine,\n};\n\nexport type {\n SegmentColor,\n NSMiniChart,\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAAoF,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAGrE;EACbC,SAAS,EAATA,gBAAS;EACTC,SAAS,EAATA,gBAAS;EACTC,QAAQ,EAARA,eAAQ;EACRC,cAAc,EAAdA,qBAAc;EACdC,cAAc,EAAdA,qBAAc;EACdC,UAAU,EAAVA,iBAAU;EACVC,SAAS,EAATA;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
@import './skeleton.shadow.css';
|
|
2
|
+
|
|
3
|
+
SLineGauge {
|
|
4
|
+
height: 8px;
|
|
5
|
+
background-color: var(--base-bg-color, var(--intergalactic-chart-grid-bar-chart-base-bg, oklch(0.96 0.001 180)));
|
|
6
|
+
border-radius: var(--intergalactic-chart-rounded, 2px);
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
position: relative;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
SLineValue {
|
|
12
|
+
height: 8px;
|
|
13
|
+
border-radius: var(--intergalactic-chart-rounded, 2px) 0 0 var(--intergalactic-chart-rounded, 2px);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
SLineValue[percent] {
|
|
17
|
+
width: var(--percent);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
SLineValue[color], SLineSegmentItem[color] {
|
|
21
|
+
background-color: var(--color, var(--intergalactic-chart-palette-order-1, oklch(0.23 0.01 140)));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
SLineGauge[segments] {
|
|
25
|
+
border-radius: var(--intergalactic-progress-bar-rounded, 6px);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
SLineGaugeSegment, SAnimationLine {
|
|
29
|
+
position: absolute;
|
|
30
|
+
top: 0;
|
|
31
|
+
left: 0;
|
|
32
|
+
right: 0;
|
|
33
|
+
bottom: 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
SLineSegmentItem:last-child {
|
|
37
|
+
margin-right: 0;
|
|
38
|
+
border-right: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
SLineSegmentItem {
|
|
42
|
+
height: 8px;
|
|
43
|
+
background: transparent;
|
|
44
|
+
border-right-color: var(--intergalactic-chart-grid-border, #ffffff);
|
|
45
|
+
border-right-style: solid;
|
|
46
|
+
border-right-width: 1px;
|
|
47
|
+
box-sizing: content-box;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
SAnimationLine {
|
|
51
|
+
background-color: var(--intergalactic-chart-grid-bar-chart-base-bg, oklch(0.96 0.001 180));
|
|
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
|
+
|
|
59
|
+
@keyframes move-line {
|
|
60
|
+
0% {transform: translateX(0);}
|
|
61
|
+
100% {transform: translateX(100%);}
|
|
62
|
+
}
|
package/lib/cjs/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../src/types.ts"],"sourcesContent":["import type { NSBox } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\n\ntype Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N\n ? Acc[number]\n : Enumerate<N, [...Acc, Acc['length']]>;\ntype Range<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;\n\ndeclare namespace NSMiniChart {\n namespace Score {\n type CommonProps = {\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 /**\n * Color of value\n */\n color?: string;\n\n /**\n * Color of background\n */\n baseBgColor?: string;\n\n /**\n * Flag to enable skeleton\n * @default false\n */\n loading?: boolean;\n\n /**\n * Flag to enable animate of charts\n * @default true\n */\n animate?: boolean;\n };\n\n namespace Donut {\n type Props = NSBox.Props & NSMiniChart.Score.CommonProps;\n type DefaultProps = {\n animate: true;\n };\n\n type Component = Intergalactic.Component<'svg', Props>;\n }\n\n namespace Line {\n type Props = NSBox.Props &\n Intergalactic.InternalTypings.EfficientOmit<NSMiniChart.Score.CommonProps, 'value' | 'color'> &\n (\n | {\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?: NSMiniChart.Score.Line.Segment.Color;\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 | {\n value?: never;\n segments?: never;\n color?: never;\n children: React.ReactNode;\n }\n );\n type DefaultProps = {\n animate: true;\n };\n\n namespace Segment {\n type Color = `chart-palette-order-${Range<1, 24>}`;\n type Props = {\n value: number;\n /**\n * Color of value\n */\n color: NSMiniChart.Score.Line.Segment.Color;\n };\n\n type Component = Intergalactic.Component<NSBox.Component, Props>;\n }\n\n type Component = ((\n props: Props,\n ) => Intergalactic.InternalTypings.ComponentRenderingResults &\n Intergalactic.InternalTypings.ComponentAdditive<'svg', 'svg', Props>) & {\n Segment: Segment.Component;\n };\n }\n }\n\n namespace Trend {\n type CommonProps = NSBox.Props & {\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 type CommonState = { width: number; height: number };\n\n namespace Line {\n type Props = NSMiniChart.Trend.CommonProps & {\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 type DefaultProps = {\n animate: true;\n };\n\n type Component = Intergalactic.Component<'svg', Props>;\n }\n\n namespace Bar {\n type Item = {\n /**\n * Value\n */\n value: number;\n /**\n * Color of value\n */\n color?: string;\n };\n type Props = NSMiniChart.Trend.CommonProps & {\n /**\n * Data to bar chart\n */\n data: NSMiniChart.Trend.Bar.Item[];\n };\n type DefaultProps = {\n animate: true;\n };\n\n type Component = Intergalactic.Component<'svg', Props>;\n }\n }\n}\n\nexport type { NSMiniChart };\n\n/** @deprecated It will be removed in v19. */\nexport type SegmentColor = NSMiniChart.Score.Line.Segment.Color;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
SLineGauge {
|
|
4
4
|
height: 8px;
|
|
5
|
-
background-color: var(--base-bg-color, var(--intergalactic-chart-grid-bar-chart-base-bg, oklch(0.
|
|
5
|
+
background-color: var(--base-bg-color, var(--intergalactic-chart-grid-bar-chart-base-bg, oklch(0.96 0.001 180)));
|
|
6
6
|
border-radius: var(--intergalactic-chart-rounded, 2px);
|
|
7
7
|
overflow: hidden;
|
|
8
8
|
position: relative;
|
|
@@ -18,7 +18,7 @@ SLineValue[percent] {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
SLineValue[color], SLineSegmentItem[color] {
|
|
21
|
-
background-color: var(--color, var(--intergalactic-chart-palette-order-1, oklch(0.
|
|
21
|
+
background-color: var(--color, var(--intergalactic-chart-palette-order-1, oklch(0.23 0.01 140)));
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
SLineGauge[segments] {
|
|
@@ -41,14 +41,14 @@ SLineSegmentItem:last-child {
|
|
|
41
41
|
SLineSegmentItem {
|
|
42
42
|
height: 8px;
|
|
43
43
|
background: transparent;
|
|
44
|
-
border-right-color: var(--intergalactic-chart-grid-border, #
|
|
44
|
+
border-right-color: var(--intergalactic-chart-grid-border, #ffffff);
|
|
45
45
|
border-right-style: solid;
|
|
46
46
|
border-right-width: 1px;
|
|
47
47
|
box-sizing: content-box;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
SAnimationLine {
|
|
51
|
-
background-color: var(--intergalactic-chart-grid-bar-chart-base-bg, oklch(0.
|
|
51
|
+
background-color: var(--intergalactic-chart-grid-bar-chart-base-bg, oklch(0.96 0.001 180));
|
|
52
52
|
transition: all var(--intergalactic-duration-extra-slow, 500) ease-in-out;
|
|
53
53
|
animation-name: move-line;
|
|
54
54
|
animation-duration: 0.5s;
|
|
@@ -7,18 +7,18 @@ import { extractAriaProps } from '@semcore/core/lib/utils/ariaProps';
|
|
|
7
7
|
import resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';
|
|
8
8
|
import { cssVariableEnhance } from '@semcore/core/lib/utils/useCssVariable';
|
|
9
9
|
import React from 'react';
|
|
10
|
-
/*!__reshadow-styles__:"
|
|
11
|
-
const style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".
|
|
10
|
+
/*!__reshadow-styles__:"../../styles/donut.shadow.css"*/
|
|
11
|
+
const style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SDonutContainer_6nq9n_gg_.__loading_6nq9n_gg_,.___SLineGauge_6nq9n_gg_.__loading_6nq9n_gg_,.___STrendBar_6nq9n_gg_.__loading_6nq9n_gg_,.___STrendLine_6nq9n_gg_.__loading_6nq9n_gg_{animation-name:pulse_6nq9n;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}@keyframes pulse_6nq9n{0%{opacity:1}50%{opacity:.4}to{opacity:1}}.___SDonutContainer_6nq9n_gg_.__semi_6nq9n_gg_ g{transform:rotate(180deg) translate(-24px,-24px)}.___SDonutContainer_6nq9n_gg_ g{transform:rotate(-90deg) translate(-24px)}.___SDonutContainer_6nq9n_gg_.__animate_6nq9n_gg_ circle{transition:all var(--intergalactic-duration-extra-slow,500) ease-in-out}", /*__inner_css_end__*/"6nq9n_gg_"),
|
|
12
12
|
/*__reshadow_css_end__*/
|
|
13
13
|
{
|
|
14
|
-
"__SLineGauge": "
|
|
15
|
-
"_loading": "
|
|
16
|
-
"__SDonutContainer": "
|
|
17
|
-
"__STrendLine": "
|
|
18
|
-
"__STrendBar": "
|
|
19
|
-
"@pulse": "
|
|
20
|
-
"_animate": "
|
|
21
|
-
"_semi": "
|
|
14
|
+
"__SLineGauge": "___SLineGauge_6nq9n_gg_",
|
|
15
|
+
"_loading": "__loading_6nq9n_gg_",
|
|
16
|
+
"__SDonutContainer": "___SDonutContainer_6nq9n_gg_",
|
|
17
|
+
"__STrendLine": "___STrendLine_6nq9n_gg_",
|
|
18
|
+
"__STrendBar": "___STrendBar_6nq9n_gg_",
|
|
19
|
+
"@pulse": "pulse_6nq9n",
|
|
20
|
+
"_animate": "__animate_6nq9n_gg_",
|
|
21
|
+
"_semi": "__semi_6nq9n_gg_"
|
|
22
22
|
});
|
|
23
23
|
import { ScoreDonutUtils } from '../../utils/ScoreDonutUtils';
|
|
24
24
|
class DonutRoot extends Component {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Donut.js","names":["Box","createComponent","Component","Root","sstyled","assignProps","extractAriaProps","resolveColorEnhance","cssVariableEnhance","React","style","_sstyled","insert","ScoreDonutUtils","DonutRoot","render","_ref","asProps","_ref2","SDonutContainer","value","styles","baseBgColor","color","resolveColor","isSemiDonut","loading","animate","duration","scoreDonut","__excludeProps","extractedAriaProps","createElement","cn","_assignProps","viewBox","radius","strokeWidth","undefined","baseLength","fullLength","baseOffset","Fragment","animatedBaseLengthFrom","animatedBaseLengthTo","startMargin","valueLength","_defineProperty","variable","fallback","map","v","Number","parseInt","toString","prop","ScoreDonut","displayName","ScoreSemiDonut","enhancements","wrapperProps","props"],"sources":["../../../../src/components/score/Donut.tsx"],"sourcesContent":["import { Box } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport { createComponent, Component, Root, sstyled, assignProps } from '@semcore/core';\nimport { extractAriaProps } from '@semcore/core/lib/utils/ariaProps';\nimport resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';\nimport { cssVariableEnhance } from '@semcore/core/lib/utils/useCssVariable';\nimport React from 'react';\n\nimport style from '../../styles/donut.shadow.css';\nimport type { NSMiniChart } from '../../types';\nimport { ScoreDonutUtils } from '../../utils/ScoreDonutUtils';\n\nclass DonutRoot extends Component<\n Intergalactic.InternalTypings.InferComponentProps<NSMiniChart.Score.Donut.Component>,\n typeof DonutRoot.enhance,\n {},\n {},\n {},\n NSMiniChart.Score.Donut.DefaultProps\n> {\n static enhance = [\n cssVariableEnhance({\n variable: '--intergalactic-duration-extra-slow',\n fallback: '500',\n map: (v: string) => Number.parseInt(v, 10).toString(),\n prop: 'duration',\n }),\n resolveColorEnhance(),\n ] as const;\n\n static style = style;\n\n static defaultProps = {\n animate: true,\n } as const;\n\n render() {\n const SDonutContainer = Root;\n const {\n value,\n styles,\n baseBgColor = 'chart-grid-bar-chart-base-bg',\n color = 'chart-palette-order-1',\n resolveColor,\n isSemiDonut,\n loading,\n animate,\n duration,\n } = this.asProps;\n\n const scoreDonut = new ScoreDonutUtils(value, isSemiDonut);\n const { __excludeProps, extractedAriaProps } = extractAriaProps(this.asProps);\n\n return sstyled(styles)(\n <SDonutContainer render={Box} semi={isSemiDonut} __excludeProps={__excludeProps}>\n <svg\n width='100%'\n height='100%'\n viewBox={scoreDonut.viewBox}\n fill='none'\n role='img'\n {...extractedAriaProps}\n >\n <g>\n <circle\n cx='12'\n cy='12'\n r={scoreDonut.radius}\n strokeWidth={scoreDonut.strokeWidth}\n stroke={resolveColor(baseBgColor)}\n strokeDasharray={\n loading\n ? undefined\n : `${scoreDonut.baseLength} ${scoreDonut.fullLength}`\n }\n strokeDashoffset={scoreDonut.baseOffset}\n >\n {animate && value > 0 && (\n <>\n <animate\n attributeName='stroke-dasharray'\n from={`${scoreDonut.animatedBaseLengthFrom} ${scoreDonut.fullLength}`}\n to={`${scoreDonut.animatedBaseLengthTo} ${scoreDonut.fullLength}`}\n dur={duration + 'ms'}\n />\n <animate\n attributeName='stroke-dashoffset'\n from={-1 * scoreDonut.startMargin}\n to={scoreDonut.baseOffset}\n dur={duration + 'ms'}\n />\n </>\n )}\n </circle>\n {!loading && value > 0 && (\n <>\n <circle\n cx='12'\n cy='12'\n r={scoreDonut.radius}\n strokeWidth={scoreDonut.strokeWidth}\n stroke={resolveColor(color)}\n strokeDasharray={`${scoreDonut.valueLength} ${scoreDonut.fullLength}`}\n >\n {animate && (\n <animate\n attributeName='stroke-dasharray'\n from={`0 ${scoreDonut.fullLength}`}\n to={`${scoreDonut.valueLength} ${scoreDonut.fullLength}`}\n dur={duration + 'ms'}\n />\n )}\n </circle>\n </>\n )}\n </g>\n </svg>\n </SDonutContainer>,\n );\n }\n}\n\n/**\n * MiniCharts.ScoreDount\n *\n * {@link https://developer.semrush.com/intergalactic/data-display/mini-chart/mini-chart-api|API} | {@link https://developer.semrush.com/intergalactic/data-display/mini-chart/mini-chart-code|Examples}\n */\nexport const ScoreDonut = createComponent<\n NSMiniChart.Score.Donut.Component,\n typeof DonutRoot\n>(DonutRoot);\n\nScoreDonut.displayName = 'MiniChart.ScoreDonut';\n\n/**\n * MiniCharts.ScoreSemiDount\n *\n * {@link https://developer.semrush.com/intergalactic/data-display/mini-chart/mini-chart-api|API} | {@link https://developer.semrush.com/intergalactic/data-display/mini-chart/mini-chart-code|Examples}\n */\nexport const ScoreSemiDonut = createComponent<\n NSMiniChart.Score.Donut.Component,\n typeof DonutRoot\n>(\n DonutRoot,\n {},\n {\n enhancements: [\n () => {\n return {\n wrapperProps: (props: NSMiniChart.Score.Donut.Props) => {\n return assignProps(props, { isSemiDonut: true });\n },\n };\n },\n ],\n },\n);\n\nScoreSemiDonut.displayName = 'MiniChart.ScoreSemiDonut';\n"],"mappings":";;;AAAA,SAASA,GAAG,QAAQ,0BAA0B;AAE9C,SAASC,eAAe,EAAEC,SAAS,EAAEC,IAAI,EAAEC,OAAO,EAAEC,WAAW,QAAQ,eAAe;AACtF,SAASC,gBAAgB,QAAQ,mCAAmC;AACpE,OAAOC,mBAAmB,MAAM,sDAAsD;AACtF,SAASC,kBAAkB,QAAQ,wCAAwC;AAC3E,OAAOC,KAAK,MAAM,OAAO;AAAC;AAAA,MAAAC,KAAA,8BAAAC,QAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAI1B,SAASC,eAAe,QAAQ,6BAA6B;AAE7D,MAAMC,SAAS,SAASZ,SAAS,CAO/B;EAiBAa,MAAMA,CAAA,EAAG;IAAA,IAAAC,IAAA,QAAAC,OAAA;MAAAC,KAAA;IACP,MAAMC,eAAe,GAiBMnB,GAAG;IAhB9B,MAAM;MACJoB,KAAK;MACLC,MAAM;MACNC,WAAW,GAAG,8BAA8B;MAC5CC,KAAK,GAAG,uBAAuB;MAC/BC,YAAY;MACZC,WAAW;MACXC,OAAO;MACPC,OAAO;MACPC;IACF,CAAC,GAAG,IAAI,CAACX,OAAO;IAEhB,MAAMY,UAAU,GAAG,IAAIhB,eAAe,CAACO,KAAK,EAAEK,WAAW,CAAC;IAC1D,MAAM;MAAEK,cAA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