@semcore/mini-chart 17.1.0-prerelease.3 → 17.2.0-prerelease.3
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 +6 -0
- package/lib/cjs/component/score/Donut.js +21 -9
- package/lib/cjs/component/score/Donut.js.map +1 -1
- package/lib/cjs/component/score/Line.js +24 -18
- package/lib/cjs/component/score/Line.js.map +1 -1
- package/lib/cjs/component/score/Line.types.js.map +1 -1
- package/lib/cjs/component/trend/Bar.js +19 -7
- package/lib/cjs/component/trend/Bar.js.map +1 -1
- package/lib/cjs/component/trend/Line.js +19 -7
- package/lib/cjs/component/trend/Line.js.map +1 -1
- package/lib/cjs/component/trend/Trend.js.map +1 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/es6/component/score/Donut.js +21 -9
- package/lib/es6/component/score/Donut.js.map +1 -1
- package/lib/es6/component/score/Line.js +24 -18
- package/lib/es6/component/score/Line.js.map +1 -1
- package/lib/es6/component/score/Line.types.js.map +1 -1
- package/lib/es6/component/trend/Bar.js +19 -7
- package/lib/es6/component/trend/Bar.js.map +1 -1
- package/lib/es6/component/trend/Line.js +19 -7
- package/lib/es6/component/trend/Line.js.map +1 -1
- package/lib/es6/component/trend/Trend.js.map +1 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/esm/component/score/Donut.mjs +11 -11
- package/lib/esm/component/score/Line.mjs +20 -20
- package/lib/esm/component/trend/Bar.mjs +9 -9
- package/lib/esm/component/trend/Line.mjs +9 -9
- package/lib/esm/component/trend/Trend.mjs +1 -1
- package/lib/esm/utils/ScoreDonutUtils.mjs +1 -1
- package/lib/types/component/score/Donut.d.ts +32 -6
- package/lib/types/component/score/Line.d.ts +5 -0
- package/lib/types/component/score/Line.types.d.ts +6 -0
- package/lib/types/component/trend/Bar.d.ts +31 -3
- package/lib/types/component/trend/Line.d.ts +38 -7
- package/lib/types/component/trend/Trend.d.ts +5 -2
- package/lib/types/index.d.ts +2 -0
- package/package.json +5 -5
|
@@ -8,26 +8,26 @@ import { createComponent, Component, Root, sstyled } from '@semcore/core';
|
|
|
8
8
|
import resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';
|
|
9
9
|
import React from 'react';
|
|
10
10
|
/*!__reshadow-styles__:"./line.shadow.css"*/
|
|
11
|
-
const style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/"
|
|
11
|
+
const style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SDonutContainer_fb95t_gg_.__loading_fb95t_gg_,.___SLineGauge_fb95t_gg_.__loading_fb95t_gg_,.___STrendBar_fb95t_gg_.__loading_fb95t_gg_,.___STrendLine_fb95t_gg_.__loading_fb95t_gg_{animation-name:pulse_fb95t;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}@keyframes pulse_fb95t{0%{opacity:1}50%{opacity:.4}to{opacity:1}}.___SLineGauge_fb95t_gg_{height:8px;background-color:var(--base-bg-color_fb95t,var(--intergalactic-chart-grid-bar-chart-base-bg,#f1f2f2));border-radius:var(--intergalactic-chart-rounded,2px);overflow:hidden;position:relative}.___SLineValue_fb95t_gg_{height:8px;border-radius:var(--intergalactic-chart-rounded,2px) 0 0 var(--intergalactic-chart-rounded,2px)}.___SLineValue_fb95t_gg_.__percent_fb95t_gg_{width:var(--percent_fb95t)}.___SLineSegmentItem_fb95t_gg_.__color_fb95t_gg_,.___SLineValue_fb95t_gg_.__color_fb95t_gg_{background-color:var(--color_fb95t,var(--intergalactic-chart-palette-order-1,#666bdb))}.___SLineGauge_fb95t_gg_.__segments_fb95t_gg_{border-radius:var(--intergalactic-progress-bar-rounded,6px)}.___SAnimationLine_fb95t_gg_,.___SLineGaugeSegment_fb95t_gg_{position:absolute;top:0;left:0;right:0;bottom:0}.___SLineSegmentItem_fb95t_gg_:last-child{margin-right:0;border-right:none}.___SLineSegmentItem_fb95t_gg_{height:8px;background:#0000;border-right:1px solid var(--intergalactic-chart-grid-border,#fff);box-sizing:initial}.___SAnimationLine_fb95t_gg_{background-color:var(--intergalactic-chart-grid-bar-chart-base-bg,#f1f2f2);transition:all var(--intergalactic-duration-extra-slow,500) ease-in-out;animation-name:move-line_fb95t;animation-duration:.5s;animation-timing-function:ease-in-out;animation-fill-mode:forwards}@keyframes move-line_fb95t{0%{transform:translateX(0)}to{transform:translateX(100%)}}", /*__inner_css_end__*/"fb95t_gg_"),
|
|
12
12
|
/*__reshadow_css_end__*/
|
|
13
13
|
{
|
|
14
|
-
"__SLineGauge": "
|
|
15
|
-
"_loading": "
|
|
16
|
-
"__SDonutContainer": "
|
|
17
|
-
"__STrendLine": "
|
|
18
|
-
"__STrendBar": "
|
|
19
|
-
"@pulse": "
|
|
20
|
-
"__SLineValue": "
|
|
21
|
-
"_percent": "
|
|
22
|
-
"--percent": "--
|
|
23
|
-
"_color": "
|
|
24
|
-
"__SLineSegmentItem": "
|
|
25
|
-
"_segments": "
|
|
26
|
-
"__SLineGaugeSegment": "
|
|
27
|
-
"__SAnimationLine": "
|
|
28
|
-
"@move-line": "move-
|
|
29
|
-
"--base-bg-color": "--base-bg-
|
|
30
|
-
"--color": "--
|
|
14
|
+
"__SLineGauge": "___SLineGauge_fb95t_gg_",
|
|
15
|
+
"_loading": "__loading_fb95t_gg_",
|
|
16
|
+
"__SDonutContainer": "___SDonutContainer_fb95t_gg_",
|
|
17
|
+
"__STrendLine": "___STrendLine_fb95t_gg_",
|
|
18
|
+
"__STrendBar": "___STrendBar_fb95t_gg_",
|
|
19
|
+
"@pulse": "pulse_fb95t",
|
|
20
|
+
"__SLineValue": "___SLineValue_fb95t_gg_",
|
|
21
|
+
"_percent": "__percent_fb95t_gg_",
|
|
22
|
+
"--percent": "--percent_fb95t",
|
|
23
|
+
"_color": "__color_fb95t_gg_",
|
|
24
|
+
"__SLineSegmentItem": "___SLineSegmentItem_fb95t_gg_",
|
|
25
|
+
"_segments": "__segments_fb95t_gg_",
|
|
26
|
+
"__SLineGaugeSegment": "___SLineGaugeSegment_fb95t_gg_",
|
|
27
|
+
"__SAnimationLine": "___SAnimationLine_fb95t_gg_",
|
|
28
|
+
"@move-line": "move-line_fb95t",
|
|
29
|
+
"--base-bg-color": "--base-bg-color_fb95t",
|
|
30
|
+
"--color": "--color_fb95t"
|
|
31
31
|
});
|
|
32
32
|
class LineRoot extends Component {
|
|
33
33
|
getSegmentProps(segmentProps) {
|
|
@@ -124,6 +124,12 @@ function Segment(props) {
|
|
|
124
124
|
}));
|
|
125
125
|
}
|
|
126
126
|
Segment.displayName = 'Segment';
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* MiniCharts.ScoreLine
|
|
130
|
+
*
|
|
131
|
+
* {@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}
|
|
132
|
+
*/
|
|
127
133
|
export const ScoreLine = createComponent(LineRoot, {
|
|
128
134
|
Segment
|
|
129
135
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Line.js","names":["Box","Flex","createComponent","Component","Root","sstyled","resolveColorEnhance","React","style","_sstyled","insert","LineRoot","getSegmentProps","segmentProps","children","resolveColor","asProps","sum","Children","forEach","child","isValidElement","props","value","width","color","render","_ref","_ref5","SLineGauge","SLineValue","SAnimationLine","SLineGaugeSegment","SLineSegmentItem","styles","baseBgColor","loading","animate","undefined","_ref3","createElement","cn","_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 { Box, Flex } from '@semcore/base-components';\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 './line.shadow.css';\nimport type {\n ScoreLineComponent,\n ScoreLineGaugeProps,\n SegmentProps,\n InnerSegmentProps,\n} from './Line.types';\n\nclass LineRoot extends Component
|
|
1
|
+
{"version":3,"file":"Line.js","names":["Box","Flex","createComponent","Component","Root","sstyled","resolveColorEnhance","React","style","_sstyled","insert","LineRoot","getSegmentProps","segmentProps","children","resolveColor","asProps","sum","Children","forEach","child","isValidElement","props","value","width","color","render","_ref","_ref5","SLineGauge","SLineValue","SAnimationLine","SLineGaugeSegment","SLineSegmentItem","styles","baseBgColor","loading","animate","undefined","_ref3","createElement","cn","_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 { Box, Flex } from '@semcore/base-components';\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 './line.shadow.css';\nimport type {\n ScoreLineComponent,\n ScoreLineGaugeProps,\n SegmentProps,\n InnerSegmentProps,\n ScoreLineGaugeDefaultProps,\n} from './Line.types';\n\nclass LineRoot extends Component<\n ScoreLineGaugeProps,\n typeof LineRoot.enhance,\n {},\n {},\n {},\n ScoreLineGaugeDefaultProps\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: 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 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 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(props: InnerSegmentProps) {\n const { styles, value } = props;\n const SLineSegmentItem = Root;\n\n if (!value) return null;\n\n return sstyled(styles)(<SLineSegmentItem render={Box} />);\n}\nSegment.displayName = 'Segment';\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 ScoreLineComponent,\n typeof LineRoot\n>(LineRoot, { Segment });\n\nScoreLine.displayName = 'MiniChart.ScoreLine';\n"],"mappings":";;;;;AAAA,SAASA,GAAG,EAAEC,IAAI,QAAQ,0BAA0B;AACpD,SAASC,eAAe,EAAEC,SAAS,EAAEC,IAAI,EAAEC,OAAO,QAAQ,e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AAM,CAAC,eAAC3B,KAAA,CAAAiC,aAAA,CAACP,gBAAgB,EAAAuB,KAAA,CAAAf,EAAA;IAAA,GAAAgB,aAAA,KAAAH,KAAA;EAAA,EAAe,CAAC;AAC1D;AACAD,OAAO,CAACK,WAAW,GAAG,SAAS;;AAE/B;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,SAAS,GAAGzD,eAAe,CAGtCS,QAAQ,EAAE;EAAE0C;AAAQ,CAAC,CAAC;AAExBM,SAAS,CAACD,WAAW,GAAG,qBAAqB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Line.types.js","names":[],"sources":["../../../../src/component/score/Line.types.ts"],"sourcesContent":["import type { BoxProps, Box } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport type resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';\nimport type React from 'react';\n\nimport type { CommonScoreProps } from './Score';\n\ntype Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N\n ? Acc[number]\n : Enumerate<N, [...Acc, Acc['length']]>;\n\ntype Range<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;\n\nexport type SegmentColor = `chart-palette-order-${Range<1, 24>}`;\n\nexport type SegmentProps = {\n value: number;\n /**\n * Color of value\n */\n color: SegmentColor;\n};\n\ntype SegmentComponent = React.FC<SegmentProps>;\n\nexport type InnerSegmentProps = SegmentProps & {\n styles: React.DetailedHTMLProps<React.StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement>;\n};\n\ntype ValuedScoreProps = {\n /**\n * Value of score (in percents from 0 to 100) or count of selected segments (for Line with segments)\n */\n value: number;\n /**\n * Color of value\n */\n color?: SegmentColor;\n /**\n * Count of line segments\n */\n segments?: number;\n /**\n * We don't accept children in this way\n */\n children?: never;\n};\n\ntype CustomRenderScoreProps = {\n children: SegmentComponent[];\n};\n\nexport type ScoreLineGaugeProps = BoxProps &\n Intergalactic.InternalTypings.EfficientOmit<CommonScoreProps, 'value' | 'color'> &\n (ValuedScoreProps | CustomRenderScoreProps);\n\nexport type Enhances = [() => {\n resolveColor: ReturnType<typeof resolveColorEnhance>;\n}];\n\nexport type ScoreLineComponent = Intergalactic.Component<'svg', ScoreLineGaugeProps, {}, Enhances> & {\n Segment: Intergalactic.Component<typeof Box, SegmentProps>;\n};\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Line.types.js","names":[],"sources":["../../../../src/component/score/Line.types.ts"],"sourcesContent":["import type { BoxProps, Box } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport type resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';\nimport type React from 'react';\n\nimport type { CommonScoreProps } from './Score';\n\ntype Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N\n ? Acc[number]\n : Enumerate<N, [...Acc, Acc['length']]>;\n\ntype Range<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;\n\nexport type SegmentColor = `chart-palette-order-${Range<1, 24>}`;\n\nexport type SegmentProps = {\n value: number;\n /**\n * Color of value\n */\n color: SegmentColor;\n};\n\ntype SegmentComponent = React.FC<SegmentProps>;\n\nexport type InnerSegmentProps = SegmentProps & {\n styles: React.DetailedHTMLProps<React.StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement>;\n};\n\ntype ValuedScoreProps = {\n /**\n * Value of score (in percents from 0 to 100) or count of selected segments (for Line with segments)\n */\n value: number;\n /**\n * Color of value\n */\n color?: SegmentColor;\n /**\n * Count of line segments\n */\n segments?: number;\n /**\n * We don't accept children in this way\n */\n children?: never;\n};\n\ntype CustomRenderScoreProps = {\n value?: never;\n segments?: never;\n color?: never;\n children: SegmentComponent[];\n};\n\nexport type ScoreLineGaugeProps = BoxProps &\n Intergalactic.InternalTypings.EfficientOmit<CommonScoreProps, 'value' | 'color'> &\n (ValuedScoreProps | CustomRenderScoreProps);\n\nexport type ScoreLineGaugeDefaultProps = {\n animate: true;\n};\n\nexport type Enhances = [() => {\n resolveColor: ReturnType<typeof resolveColorEnhance>;\n}];\n\nexport type ScoreLineComponent = Intergalactic.Component<'svg', ScoreLineGaugeProps, {}, Enhances> & {\n Segment: Intergalactic.Component<typeof Box, SegmentProps>;\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -8,15 +8,15 @@ import resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEn
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import { Trend } from './Trend';
|
|
10
10
|
/*!__reshadow-styles__:"../skeleton/skeleton.shadow.css"*/
|
|
11
|
-
const style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/"
|
|
11
|
+
const style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SDonutContainer_1b4gu_gg_.__loading_1b4gu_gg_,.___SLineGauge_1b4gu_gg_.__loading_1b4gu_gg_,.___STrendBar_1b4gu_gg_.__loading_1b4gu_gg_,.___STrendLine_1b4gu_gg_.__loading_1b4gu_gg_{animation-name:pulse_1b4gu;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}@keyframes pulse_1b4gu{0%{opacity:1}50%{opacity:.4}to{opacity:1}}", /*__inner_css_end__*/"1b4gu_gg_"),
|
|
12
12
|
/*__reshadow_css_end__*/
|
|
13
13
|
{
|
|
14
|
-
"__SLineGauge": "
|
|
15
|
-
"_loading": "
|
|
16
|
-
"__SDonutContainer": "
|
|
17
|
-
"__STrendLine": "
|
|
18
|
-
"__STrendBar": "
|
|
19
|
-
"@pulse": "
|
|
14
|
+
"__SLineGauge": "___SLineGauge_1b4gu_gg_",
|
|
15
|
+
"_loading": "__loading_1b4gu_gg_",
|
|
16
|
+
"__SDonutContainer": "___SDonutContainer_1b4gu_gg_",
|
|
17
|
+
"__STrendLine": "___STrendLine_1b4gu_gg_",
|
|
18
|
+
"__STrendBar": "___STrendBar_1b4gu_gg_",
|
|
19
|
+
"@pulse": "pulse_1b4gu"
|
|
20
20
|
});
|
|
21
21
|
class TrendBarRoot extends Trend {
|
|
22
22
|
get defaultData() {
|
|
@@ -87,6 +87,12 @@ class TrendBarRoot extends Trend {
|
|
|
87
87
|
})));
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* MiniCharts.TrendBar
|
|
93
|
+
*
|
|
94
|
+
* {@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}
|
|
95
|
+
*/
|
|
90
96
|
_defineProperty(TrendBarRoot, "enhance", [resolveColorEnhance()]);
|
|
91
97
|
_defineProperty(TrendBarRoot, "style", style);
|
|
92
98
|
_defineProperty(TrendBarRoot, "defaultProps", {
|
|
@@ -94,6 +100,12 @@ _defineProperty(TrendBarRoot, "defaultProps", {
|
|
|
94
100
|
});
|
|
95
101
|
export const TrendBar = createComponent(TrendBarRoot);
|
|
96
102
|
TrendBar.displayName = 'MiniChart.TrendBar';
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* MiniCharts.TrendHistogram
|
|
106
|
+
*
|
|
107
|
+
* {@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}
|
|
108
|
+
*/
|
|
97
109
|
export const TrendHistogram = createComponent(TrendBarRoot, {}, {
|
|
98
110
|
enhancements: [() => {
|
|
99
111
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Bar.js","names":["Box","createComponent","assignProps","Root","sstyled","extractAriaProps","resolveColorEnhance","React","Trend","style","_sstyled","insert","TrendBarRoot","defaultData","value","data","loading","asProps","render","_ref","_ref2","STrendBar","styles","resolveColor","isHistogram","animate","step","defaultWidth","length","__excludeProps","extractedAriaProps","createElement","cn","_assignProps","containerRef","svgWidth","svgHeight","map","barItem","index","color","key","x","y","defaultHeight","width","height","fill","attributeName","values","dur","_defineProperty","TrendBar","displayName","TrendHistogram","enhancements","wrapperProps","props"],"sources":["../../../../src/component/trend/Bar.tsx"],"sourcesContent":["import { Box } from '@semcore/base-components';\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, type CommonTrendProps } from './Trend';\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\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 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\
|
|
1
|
+
{"version":3,"file":"Bar.js","names":["Box","createComponent","assignProps","Root","sstyled","extractAriaProps","resolveColorEnhance","React","Trend","style","_sstyled","insert","TrendBarRoot","defaultData","value","data","loading","asProps","render","_ref","_ref2","STrendBar","styles","resolveColor","isHistogram","animate","step","defaultWidth","length","__excludeProps","extractedAriaProps","createElement","cn","_assignProps","containerRef","svgWidth","svgHeight","map","barItem","index","color","key","x","y","defaultHeight","width","height","fill","attributeName","values","dur","_defineProperty","TrendBar","displayName","TrendHistogram","enhancements","wrapperProps","props"],"sources":["../../../../src/component/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, type CommonTrendProps } from './Trend';\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 TrendBarComponent = Intergalactic.Component<'svg', TrendBarProps, {}, typeof TrendBarRoot.enhance>;\n\ntype TrendBarDefaultProps = {\n animate: true;\n};\n\nclass TrendBarRoot extends Trend<TrendBarProps, typeof TrendBarRoot.enhance, TrendBarDefaultProps> {\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(): 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 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 TrendBarComponent,\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 TrendBarComponent,\n typeof TrendBarRoot\n>(\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\nTrendHistog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AACA;AACA;AACA;AAJAC,eAAA,CAtEMvC,YAAY,aACC,CAACN,mBAAmB,CAAC,CAAC,CAAC;AAAA6C,eAAA,CADpCvC,YAAY,WAGDH,KAAK;AAAA0C,eAAA,CAHhBvC,YAAY,kBAKM;EACpBa,OAAO,EAAE;AACX,CAAC;AAoEH,OAAO,MAAM2B,QAAQ,GAAGnD,eAAe,CAGrCW,YAAY,CAAC;AAEfwC,QAAQ,CAACC,WAAW,GAAG,oBAAoB;;AAE3C;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,cAAc,GAAGrD,eAAe,CAI3CW,YAAY,EACZ,CAAC,CAAC,EACF;EACE2C,YAAY,EAAE,CACZ,MAAM;IACJ,OAAO;MACLC,YAAY,EAAGC,KAAoB,IAAK;QACtC,OAAOvD,WAAW,CAACuD,KAAK,EAAE;UAAEjC,WAAW,EAAE;QAAK,CAAC,CAAC;MAClD;IACF,CAAC;EACH,CAAC;AAEL,CACF,CAAC;AAED8B,cAAc,CAACD,WAAW,GAAG,0BAA0B","ignoreList":[]}
|
|
@@ -9,15 +9,15 @@ import uniqueIDEnhancement from '@semcore/core/lib/utils/uniqueID';
|
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import { Trend } from './Trend';
|
|
11
11
|
/*!__reshadow-styles__:"../skeleton/skeleton.shadow.css"*/
|
|
12
|
-
const style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/"
|
|
12
|
+
const style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SDonutContainer_1b4gu_gg_.__loading_1b4gu_gg_,.___SLineGauge_1b4gu_gg_.__loading_1b4gu_gg_,.___STrendBar_1b4gu_gg_.__loading_1b4gu_gg_,.___STrendLine_1b4gu_gg_.__loading_1b4gu_gg_{animation-name:pulse_1b4gu;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}@keyframes pulse_1b4gu{0%{opacity:1}50%{opacity:.4}to{opacity:1}}", /*__inner_css_end__*/"1b4gu_gg_"),
|
|
13
13
|
/*__reshadow_css_end__*/
|
|
14
14
|
{
|
|
15
|
-
"__SLineGauge": "
|
|
16
|
-
"_loading": "
|
|
17
|
-
"__SDonutContainer": "
|
|
18
|
-
"__STrendLine": "
|
|
19
|
-
"__STrendBar": "
|
|
20
|
-
"@pulse": "
|
|
15
|
+
"__SLineGauge": "___SLineGauge_1b4gu_gg_",
|
|
16
|
+
"_loading": "__loading_1b4gu_gg_",
|
|
17
|
+
"__SDonutContainer": "___SDonutContainer_1b4gu_gg_",
|
|
18
|
+
"__STrendLine": "___STrendLine_1b4gu_gg_",
|
|
19
|
+
"__STrendBar": "___STrendBar_1b4gu_gg_",
|
|
20
|
+
"@pulse": "pulse_1b4gu"
|
|
21
21
|
});
|
|
22
22
|
class TrendLineRoot extends Trend {
|
|
23
23
|
get defaultData() {
|
|
@@ -121,6 +121,12 @@ class TrendLineRoot extends Trend {
|
|
|
121
121
|
}))))));
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* MiniCharts.TrendLine
|
|
127
|
+
*
|
|
128
|
+
* {@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}
|
|
129
|
+
*/
|
|
124
130
|
_defineProperty(TrendLineRoot, "enhance", [resolveColorEnhance(), uniqueIDEnhancement()]);
|
|
125
131
|
_defineProperty(TrendLineRoot, "style", style);
|
|
126
132
|
_defineProperty(TrendLineRoot, "defaultProps", {
|
|
@@ -128,6 +134,12 @@ _defineProperty(TrendLineRoot, "defaultProps", {
|
|
|
128
134
|
});
|
|
129
135
|
export const TrendLine = createComponent(TrendLineRoot);
|
|
130
136
|
TrendLine.displayName = 'MiniChart.TrendLine';
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* MiniCharts.TrendArea
|
|
140
|
+
*
|
|
141
|
+
* {@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}
|
|
142
|
+
*/
|
|
131
143
|
export const TrendArea = createComponent(TrendLineRoot, {}, {
|
|
132
144
|
enhancements: [() => {
|
|
133
145
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Line.js","names":["Box","createComponent","assignProps","Root","sstyled","extractAriaProps","resolveColorEnhance","uniqueIDEnhancement","React","Trend","style","_sstyled","insert","TrendLineRoot","defaultData","lastPointRadius","asProps","data","loading","svgWidth","lastPointColor","defaultWidth","svgHeight","defaultHeight","color","resolveColor","render","_ref","_ref2","STrendLine","uid","withArea","animate","styles","points","length","step","i","push","__excludeProps","extractedAriaProps","createElement","cn","_assignProps","containerRef","join","_defineProperty","TrendLine","displayName","TrendArea","enhancements","wrapperProps","props"],"sources":["../../../../src/component/trend/Line.tsx"],"sourcesContent":["import { Box } from '@semcore/base-components';\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, type CommonTrendProps } from './Trend';\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\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 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\nexport const TrendLine = createComponent<'svg', TrendLineProps, {}, typeof TrendLineRoot.enhance>(TrendLineRoot);\n\nTrendLine.displayName = 'MiniChart.TrendLine';\n\nexport const TrendArea = createComponent<'svg', TrendLineProps, {}, typeof TrendLineRoot.enhance>(\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,SAASA,GAAG,QAAQ,0BAA0B;AAC9C,SAASC,eAAe,EAAEC,WAAW,EAAEC,IAAI,EAAEC,OAAO,QAAQ,eAAe;AAC3E,SAASC,gBAAgB,QAAQ,mCAAmC;AACpE,OAAOC,mBAAmB,MAAM,sDAAsD;AACtF,OAAOC,mBAAmB,MAAM,kCAAkC;AAClE,OAAOC,KAAK,MAAM,OAAO;AAEzB,SAASC,KAAK,QAA+B,SAAS;AAAC;AAAA,MAAAC,KAAA,8BAAAC,QAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAyBvD,MAAMC,aAAa,SAASJ,KAAK,CAA+C;EAS9E,IAAIK,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,IAAI;MAAEC;IAAQ,CAAC,GAAG,IAAI,CAACF,OAAO;IAEtC,IAAIE,OAAO,EAAE;MACX,OAAO,IAAI,CAACJ,WAAW;IACzB;IAEA,OAAOG,IAAI;EACb;EAEA,IAAa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"Line.js","names":["Box","createComponent","assignProps","Root","sstyled","extractAriaProps","resolveColorEnhance","uniqueIDEnhancement","React","Trend","style","_sstyled","insert","TrendLineRoot","defaultData","lastPointRadius","asProps","data","loading","svgWidth","lastPointColor","defaultWidth","svgHeight","defaultHeight","color","resolveColor","render","_ref","_ref2","STrendLine","uid","withArea","animate","styles","points","length","step","i","push","__excludeProps","extractedAriaProps","createElement","cn","_assignProps","containerRef","join","_defineProperty","TrendLine","displayName","TrendArea","enhancements","wrapperProps","props"],"sources":["../../../../src/component/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, type CommonTrendProps } from './Trend';\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 TrendLineComponent = Intergalactic.Component<'svg', TrendLineProps, {}, typeof TrendLineRoot.enhance>;\n\ntype TrendLineDefaultProps = {\n animate: true;\n};\n\nclass TrendLineRoot extends Trend<TrendLineProps, typeof TrendLineRoot.enhance, TrendLineDefaultProps> {\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<TrendLineComponent, 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<TrendLineComponent, typeof TrendLineRoot>(\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,SAASA,GAAG,QAAQ,0BAA0B;AAE9C,SAASC,eAAe,EAAEC,WAAW,EAAEC,IAAI,EAAEC,OAAO,QAAQ,eAAe;AAC3E,SAASC,gBAAgB,QAAQ,mCAAmC;AACpE,OAAOC,mBAAmB,MAAM,sDAAsD;AACtF,OAAOC,mBAAmB,MAAM,kCAAkC;AAClE,OAAOC,KAAK,MAAM,OAAO;AAEzB,SAASC,KAAK,QAA+B,SAAS;AAAC;AAAA,MAAAC,KAAA,8BAAAC,QAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AA+BvD,MAAMC,aAAa,SAASJ,KAAK,CAAsE;EASrG,IAAIK,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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C,KAAqB,IAAK;QACvC,OAAOlD,WAAW,CAACkD,KAAK,EAAE;UAAErB,QAAQ,EAAE;QAAK,CAAC,CAAC;MAC/C;IACF,CAAC;EACH,CAAC;AAEL,CACF,CAAC;AAEDkB,SAAS,CAACD,WAAW,GAAG,qBAAqB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Trend.js","names":["Component","React","Trend","constructor","args","_defineProperty","width","height","createRef","componentDidMount","setSizes","componentDidUpdate","prevProps","w","props","h","data","defaultWidth","state","defaultHeight","svgWidth","svgHeight","containerRef","current","boundingClientRect","getBoundingClientRect","setState"],"sources":["../../../../src/component/trend/Trend.tsx"],"sourcesContent":["import type { BoxProps } from '@semcore/base-components';\nimport { Component } from '@semcore/core';\nimport React from 'react';\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, E, Readonly<{}>, {
|
|
1
|
+
{"version":3,"file":"Trend.js","names":["Component","React","Trend","constructor","args","_defineProperty","width","height","createRef","componentDidMount","setSizes","componentDidUpdate","prevProps","w","props","h","data","defaultWidth","state","defaultHeight","svgWidth","svgHeight","containerRef","current","boundingClientRect","getBoundingClientRect","setState"],"sources":["../../../../src/component/trend/Trend.tsx"],"sourcesContent":["import type { BoxProps } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport { Component } from '@semcore/core';\nimport React from 'react';\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\ntype CommonTrendState = { width: number; height: number };\n\nexport abstract class Trend<\n P extends CommonTrendProps,\n E extends readonly ((...args: any[]) => any)[],\n DP extends Intergalactic.InternalTypings.ValidDefaultProps<DP, P> = never,\n> extends Component<P, E, Readonly<{}>, {}, CommonTrendState, 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":";AAEA,SAASA,SAAS,QAAQ,eAAe;AACzC,OAAOC,KAAK,MAAM,OAAO;AAuBzB,OAAO,MAAeC,KAAK,SAIjBF,SAAS,CAA+C;EAAAG,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,gBACxD;MACNC,KAAK,EAAE,GAAG;MACVC,MAAM,EAAE;IACV,CAAC;IAAAF,eAAA,oCAEcJ,KAAK,CAACO,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;MAAEX,KAAK;MAAEC;IAAO,CAAC,GAAG,IAAI,CAACW,KAAK;IAEpC,OAAQZ,KAAK,GAAGC,MAAM,GAAI,IAAI,CAACY,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;QAAEnB,KAAK;QAAEC;MAAO,CAAC,GAAGiB,kBAAkB;MAE5C,IAAIlB,KAAK,GAAG,CAAC,IAAIC,MAAM,GAAG,CAAC,EAAE;QAC3B,IAAI,CAACmB,QAAQ,CAAC;UAAEpB,KAAK;UAAEC;QAAO,CAAC,CAAC;MAClC;IACF;EACF;AACF","ignoreList":[]}
|
package/lib/es6/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ScoreLine","ScoreDonut","ScoreSemiDonut","TrendLine","TrendArea","TrendBar","TrendHistogram","miniCharts"],"sources":["../../src/index.ts"],"sourcesContent":["import { ScoreLine, ScoreDonut, ScoreSemiDonut } from './component/score';\nimport { TrendLine, TrendArea, TrendBar, TrendHistogram } from './component/trend';\n\nconst miniCharts: {\n TrendLine: typeof TrendLine;\n TrendArea: typeof TrendArea;\n TrendBar: typeof TrendBar;\n TrendHistogram: typeof TrendHistogram;\n ScoreSemiDonut: typeof ScoreSemiDonut;\n ScoreDonut: typeof ScoreDonut;\n ScoreLine: typeof ScoreLine;\n} = {\n TrendLine,\n TrendArea,\n TrendBar,\n TrendHistogram,\n ScoreSemiDonut,\n ScoreDonut,\n ScoreLine,\n};\n\nexport default miniCharts;\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,UAAU,EAAEC,cAAc,QAAQ,mBAAmB;
|
|
1
|
+
{"version":3,"file":"index.js","names":["ScoreLine","ScoreDonut","ScoreSemiDonut","TrendLine","TrendArea","TrendBar","TrendHistogram","miniCharts"],"sources":["../../src/index.ts"],"sourcesContent":["import { ScoreLine, ScoreDonut, ScoreSemiDonut } from './component/score';\nimport type { SegmentColor } from './component/score/Line.types';\nimport { TrendLine, TrendArea, TrendBar, TrendHistogram } from './component/trend';\n\nconst miniCharts: {\n TrendLine: typeof TrendLine;\n TrendArea: typeof TrendArea;\n TrendBar: typeof TrendBar;\n TrendHistogram: typeof TrendHistogram;\n ScoreSemiDonut: typeof ScoreSemiDonut;\n ScoreDonut: typeof ScoreDonut;\n ScoreLine: typeof ScoreLine;\n} = {\n TrendLine,\n TrendArea,\n TrendBar,\n TrendHistogram,\n ScoreSemiDonut,\n ScoreDonut,\n ScoreLine,\n};\n\nexport default miniCharts;\n\nexport type {\n SegmentColor,\n};\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,UAAU,EAAEC,cAAc,QAAQ,mBAAmB;AAEzE,SAASC,SAAS,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,cAAc,QAAQ,mBAAmB;AAElF,MAAMC,UAQL,GAAG;EACFJ,SAAS;EACTC,SAAS;EACTC,QAAQ;EACRC,cAAc;EACdJ,cAAc;EACdD,UAAU;EACVD;AACF,CAAC;AAED,eAAeO,UAAU","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { sstyled, Component, assignProps, createComponent } from "@semcore/core";
|
|
3
3
|
import { Box } from "@semcore/base-components";
|
|
4
4
|
import { extractAriaProps } from "@semcore/core/lib/utils/ariaProps";
|
|
@@ -11,19 +11,19 @@ const style = (
|
|
|
11
11
|
/*__reshadow_css_start__*/
|
|
12
12
|
(sstyled.insert(
|
|
13
13
|
/*__inner_css_start__*/
|
|
14
|
-
"
|
|
14
|
+
".___SDonutContainer_1k8k3_gg_.__loading_1k8k3_gg_,.___SLineGauge_1k8k3_gg_.__loading_1k8k3_gg_,.___STrendBar_1k8k3_gg_.__loading_1k8k3_gg_,.___STrendLine_1k8k3_gg_.__loading_1k8k3_gg_{animation-name:pulse_1k8k3;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}@keyframes pulse_1k8k3{0%{opacity:1}50%{opacity:.4}to{opacity:1}}.___SDonutContainer_1k8k3_gg_.__semi_1k8k3_gg_ g{transform:rotate(180deg) translate(-24px,-24px)}.___SDonutContainer_1k8k3_gg_ g{transform:rotate(-90deg) translate(-24px)}.___SDonutContainer_1k8k3_gg_.__animate_1k8k3_gg_ circle{transition:all var(--intergalactic-duration-extra-slow,500) ease-in-out}",
|
|
15
15
|
/*__inner_css_end__*/
|
|
16
|
-
"
|
|
16
|
+
"1k8k3_gg_"
|
|
17
17
|
), /*__reshadow_css_end__*/
|
|
18
18
|
{
|
|
19
|
-
"__SLineGauge": "
|
|
20
|
-
"_loading": "
|
|
21
|
-
"__SDonutContainer": "
|
|
22
|
-
"__STrendLine": "
|
|
23
|
-
"__STrendBar": "
|
|
24
|
-
"@pulse": "
|
|
25
|
-
"_animate": "
|
|
26
|
-
"_semi": "
|
|
19
|
+
"__SLineGauge": "___SLineGauge_1k8k3_gg_",
|
|
20
|
+
"_loading": "__loading_1k8k3_gg_",
|
|
21
|
+
"__SDonutContainer": "___SDonutContainer_1k8k3_gg_",
|
|
22
|
+
"__STrendLine": "___STrendLine_1k8k3_gg_",
|
|
23
|
+
"__STrendBar": "___STrendBar_1k8k3_gg_",
|
|
24
|
+
"@pulse": "pulse_1k8k3",
|
|
25
|
+
"_animate": "__animate_1k8k3_gg_",
|
|
26
|
+
"_semi": "__semi_1k8k3_gg_"
|
|
27
27
|
})
|
|
28
28
|
);
|
|
29
29
|
class DonutRoot extends Component {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { sstyled, Component, assignProps, createComponent } from "@semcore/core";
|
|
3
3
|
import { Box, Flex } from "@semcore/base-components";
|
|
4
4
|
import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
|
|
@@ -8,28 +8,28 @@ const style = (
|
|
|
8
8
|
/*__reshadow_css_start__*/
|
|
9
9
|
(sstyled.insert(
|
|
10
10
|
/*__inner_css_start__*/
|
|
11
|
-
"
|
|
11
|
+
".___SDonutContainer_fb95t_gg_.__loading_fb95t_gg_,.___SLineGauge_fb95t_gg_.__loading_fb95t_gg_,.___STrendBar_fb95t_gg_.__loading_fb95t_gg_,.___STrendLine_fb95t_gg_.__loading_fb95t_gg_{animation-name:pulse_fb95t;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}@keyframes pulse_fb95t{0%{opacity:1}50%{opacity:.4}to{opacity:1}}.___SLineGauge_fb95t_gg_{height:8px;background-color:var(--base-bg-color_fb95t,var(--intergalactic-chart-grid-bar-chart-base-bg,#f1f2f2));border-radius:var(--intergalactic-chart-rounded,2px);overflow:hidden;position:relative}.___SLineValue_fb95t_gg_{height:8px;border-radius:var(--intergalactic-chart-rounded,2px) 0 0 var(--intergalactic-chart-rounded,2px)}.___SLineValue_fb95t_gg_.__percent_fb95t_gg_{width:var(--percent_fb95t)}.___SLineSegmentItem_fb95t_gg_.__color_fb95t_gg_,.___SLineValue_fb95t_gg_.__color_fb95t_gg_{background-color:var(--color_fb95t,var(--intergalactic-chart-palette-order-1,#666bdb))}.___SLineGauge_fb95t_gg_.__segments_fb95t_gg_{border-radius:var(--intergalactic-progress-bar-rounded,6px)}.___SAnimationLine_fb95t_gg_,.___SLineGaugeSegment_fb95t_gg_{position:absolute;top:0;left:0;right:0;bottom:0}.___SLineSegmentItem_fb95t_gg_:last-child{margin-right:0;border-right:none}.___SLineSegmentItem_fb95t_gg_{height:8px;background:#0000;border-right:1px solid var(--intergalactic-chart-grid-border,#fff);box-sizing:initial}.___SAnimationLine_fb95t_gg_{background-color:var(--intergalactic-chart-grid-bar-chart-base-bg,#f1f2f2);transition:all var(--intergalactic-duration-extra-slow,500) ease-in-out;animation-name:move-line_fb95t;animation-duration:.5s;animation-timing-function:ease-in-out;animation-fill-mode:forwards}@keyframes move-line_fb95t{0%{transform:translateX(0)}to{transform:translateX(100%)}}",
|
|
12
12
|
/*__inner_css_end__*/
|
|
13
|
-
"
|
|
13
|
+
"fb95t_gg_"
|
|
14
14
|
), /*__reshadow_css_end__*/
|
|
15
15
|
{
|
|
16
|
-
"__SLineGauge": "
|
|
17
|
-
"_loading": "
|
|
18
|
-
"__SDonutContainer": "
|
|
19
|
-
"__STrendLine": "
|
|
20
|
-
"__STrendBar": "
|
|
21
|
-
"@pulse": "
|
|
22
|
-
"__SLineValue": "
|
|
23
|
-
"_percent": "
|
|
24
|
-
"--percent": "--
|
|
25
|
-
"_color": "
|
|
26
|
-
"__SLineSegmentItem": "
|
|
27
|
-
"_segments": "
|
|
28
|
-
"__SLineGaugeSegment": "
|
|
29
|
-
"__SAnimationLine": "
|
|
30
|
-
"@move-line": "move-
|
|
31
|
-
"--base-bg-color": "--base-bg-
|
|
32
|
-
"--color": "--
|
|
16
|
+
"__SLineGauge": "___SLineGauge_fb95t_gg_",
|
|
17
|
+
"_loading": "__loading_fb95t_gg_",
|
|
18
|
+
"__SDonutContainer": "___SDonutContainer_fb95t_gg_",
|
|
19
|
+
"__STrendLine": "___STrendLine_fb95t_gg_",
|
|
20
|
+
"__STrendBar": "___STrendBar_fb95t_gg_",
|
|
21
|
+
"@pulse": "pulse_fb95t",
|
|
22
|
+
"__SLineValue": "___SLineValue_fb95t_gg_",
|
|
23
|
+
"_percent": "__percent_fb95t_gg_",
|
|
24
|
+
"--percent": "--percent_fb95t",
|
|
25
|
+
"_color": "__color_fb95t_gg_",
|
|
26
|
+
"__SLineSegmentItem": "___SLineSegmentItem_fb95t_gg_",
|
|
27
|
+
"_segments": "__segments_fb95t_gg_",
|
|
28
|
+
"__SLineGaugeSegment": "___SLineGaugeSegment_fb95t_gg_",
|
|
29
|
+
"__SAnimationLine": "___SAnimationLine_fb95t_gg_",
|
|
30
|
+
"@move-line": "move-line_fb95t",
|
|
31
|
+
"--base-bg-color": "--base-bg-color_fb95t",
|
|
32
|
+
"--color": "--color_fb95t"
|
|
33
33
|
})
|
|
34
34
|
);
|
|
35
35
|
class LineRoot extends Component {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { sstyled, assignProps, createComponent } from "@semcore/core";
|
|
3
3
|
import { Box } from "@semcore/base-components";
|
|
4
4
|
import { extractAriaProps } from "@semcore/core/lib/utils/ariaProps";
|
|
@@ -10,17 +10,17 @@ const style = (
|
|
|
10
10
|
/*__reshadow_css_start__*/
|
|
11
11
|
(sstyled.insert(
|
|
12
12
|
/*__inner_css_start__*/
|
|
13
|
-
"
|
|
13
|
+
".___SDonutContainer_1b4gu_gg_.__loading_1b4gu_gg_,.___SLineGauge_1b4gu_gg_.__loading_1b4gu_gg_,.___STrendBar_1b4gu_gg_.__loading_1b4gu_gg_,.___STrendLine_1b4gu_gg_.__loading_1b4gu_gg_{animation-name:pulse_1b4gu;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}@keyframes pulse_1b4gu{0%{opacity:1}50%{opacity:.4}to{opacity:1}}",
|
|
14
14
|
/*__inner_css_end__*/
|
|
15
|
-
"
|
|
15
|
+
"1b4gu_gg_"
|
|
16
16
|
), /*__reshadow_css_end__*/
|
|
17
17
|
{
|
|
18
|
-
"__SLineGauge": "
|
|
19
|
-
"_loading": "
|
|
20
|
-
"__SDonutContainer": "
|
|
21
|
-
"__STrendLine": "
|
|
22
|
-
"__STrendBar": "
|
|
23
|
-
"@pulse": "
|
|
18
|
+
"__SLineGauge": "___SLineGauge_1b4gu_gg_",
|
|
19
|
+
"_loading": "__loading_1b4gu_gg_",
|
|
20
|
+
"__SDonutContainer": "___SDonutContainer_1b4gu_gg_",
|
|
21
|
+
"__STrendLine": "___STrendLine_1b4gu_gg_",
|
|
22
|
+
"__STrendBar": "___STrendBar_1b4gu_gg_",
|
|
23
|
+
"@pulse": "pulse_1b4gu"
|
|
24
24
|
})
|
|
25
25
|
);
|
|
26
26
|
class TrendBarRoot extends Trend {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { sstyled, assignProps, createComponent } from "@semcore/core";
|
|
3
3
|
import { Box } from "@semcore/base-components";
|
|
4
4
|
import { extractAriaProps } from "@semcore/core/lib/utils/ariaProps";
|
|
@@ -11,17 +11,17 @@ const style = (
|
|
|
11
11
|
/*__reshadow_css_start__*/
|
|
12
12
|
(sstyled.insert(
|
|
13
13
|
/*__inner_css_start__*/
|
|
14
|
-
"
|
|
14
|
+
".___SDonutContainer_1b4gu_gg_.__loading_1b4gu_gg_,.___SLineGauge_1b4gu_gg_.__loading_1b4gu_gg_,.___STrendBar_1b4gu_gg_.__loading_1b4gu_gg_,.___STrendLine_1b4gu_gg_.__loading_1b4gu_gg_{animation-name:pulse_1b4gu;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}@keyframes pulse_1b4gu{0%{opacity:1}50%{opacity:.4}to{opacity:1}}",
|
|
15
15
|
/*__inner_css_end__*/
|
|
16
|
-
"
|
|
16
|
+
"1b4gu_gg_"
|
|
17
17
|
), /*__reshadow_css_end__*/
|
|
18
18
|
{
|
|
19
|
-
"__SLineGauge": "
|
|
20
|
-
"_loading": "
|
|
21
|
-
"__SDonutContainer": "
|
|
22
|
-
"__STrendLine": "
|
|
23
|
-
"__STrendBar": "
|
|
24
|
-
"@pulse": "
|
|
19
|
+
"__SLineGauge": "___SLineGauge_1b4gu_gg_",
|
|
20
|
+
"_loading": "__loading_1b4gu_gg_",
|
|
21
|
+
"__SDonutContainer": "___SDonutContainer_1b4gu_gg_",
|
|
22
|
+
"__STrendLine": "___STrendLine_1b4gu_gg_",
|
|
23
|
+
"__STrendBar": "___STrendBar_1b4gu_gg_",
|
|
24
|
+
"@pulse": "pulse_1b4gu"
|
|
25
25
|
})
|
|
26
26
|
);
|
|
27
27
|
class TrendLineRoot extends Trend {
|
|
@@ -1,9 +1,35 @@
|
|
|
1
1
|
import { type BoxProps } from '@semcore/base-components';
|
|
2
|
+
import type { Intergalactic } from '@semcore/core';
|
|
3
|
+
import { Component } from '@semcore/core';
|
|
4
|
+
import React from 'react';
|
|
2
5
|
import type { CommonScoreProps } from './Score';
|
|
3
6
|
export type ScoreDonutProps = BoxProps & CommonScoreProps;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
7
|
+
type ScoreDonutDefaultProps = {
|
|
8
|
+
animate: true;
|
|
9
|
+
};
|
|
10
|
+
type ScoreDonutComponent = Intergalactic.Component<'svg', ScoreDonutProps, {}, typeof DonutRoot.enhance>;
|
|
11
|
+
declare class DonutRoot extends Component<ScoreDonutProps, typeof DonutRoot.enhance, {}, {}, {}, ScoreDonutDefaultProps> {
|
|
12
|
+
static enhance: readonly [<T extends {}>(props: T) => T & {
|
|
13
|
+
duration: string;
|
|
14
|
+
}, (props: any) => any];
|
|
15
|
+
static style: {
|
|
16
|
+
[key: string]: string;
|
|
17
|
+
};
|
|
18
|
+
static defaultProps: {
|
|
19
|
+
readonly animate: true;
|
|
20
|
+
};
|
|
21
|
+
render(): React.ReactNode;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* MiniCharts.ScoreDount
|
|
25
|
+
*
|
|
26
|
+
* {@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}
|
|
27
|
+
*/
|
|
28
|
+
export declare const ScoreDonut: ScoreDonutComponent;
|
|
29
|
+
/**
|
|
30
|
+
* MiniCharts.ScoreSemiDount
|
|
31
|
+
*
|
|
32
|
+
* {@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}
|
|
33
|
+
*/
|
|
34
|
+
export declare const ScoreSemiDonut: ScoreDonutComponent;
|
|
35
|
+
export {};
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import type { ScoreLineComponent } from './Line.types';
|
|
2
|
+
/**
|
|
3
|
+
* MiniCharts.ScoreLine
|
|
4
|
+
*
|
|
5
|
+
* {@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}
|
|
6
|
+
*/
|
|
2
7
|
export declare const ScoreLine: ScoreLineComponent;
|
|
@@ -36,9 +36,15 @@ type ValuedScoreProps = {
|
|
|
36
36
|
children?: never;
|
|
37
37
|
};
|
|
38
38
|
type CustomRenderScoreProps = {
|
|
39
|
+
value?: never;
|
|
40
|
+
segments?: never;
|
|
41
|
+
color?: never;
|
|
39
42
|
children: SegmentComponent[];
|
|
40
43
|
};
|
|
41
44
|
export type ScoreLineGaugeProps = BoxProps & Intergalactic.InternalTypings.EfficientOmit<CommonScoreProps, 'value' | 'color'> & (ValuedScoreProps | CustomRenderScoreProps);
|
|
45
|
+
export type ScoreLineGaugeDefaultProps = {
|
|
46
|
+
animate: true;
|
|
47
|
+
};
|
|
42
48
|
export type Enhances = [
|
|
43
49
|
() => {
|
|
44
50
|
resolveColor: ReturnType<typeof resolveColorEnhance>;
|