@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
|
@@ -7,27 +7,27 @@ import { Box, Flex } from '@semcore/base-components';
|
|
|
7
7
|
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
|
-
/*!__reshadow-styles__:"
|
|
11
|
-
const style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".
|
|
10
|
+
/*!__reshadow-styles__:"../../styles/line.shadow.css"*/
|
|
11
|
+
const style = (/*__reshadow_css_start__*/_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_"),
|
|
12
12
|
/*__reshadow_css_end__*/
|
|
13
13
|
{
|
|
14
|
-
"__SLineGauge": "
|
|
15
|
-
"_loading": "
|
|
16
|
-
"__SDonutContainer": "
|
|
17
|
-
"__STrendLine": "
|
|
18
|
-
"__STrendBar": "
|
|
19
|
-
"@pulse": "
|
|
20
|
-
"--base-bg-color": "--base-bg-
|
|
21
|
-
"__SLineValue": "
|
|
22
|
-
"_percent": "
|
|
23
|
-
"--percent": "--
|
|
24
|
-
"_color": "
|
|
25
|
-
"__SLineSegmentItem": "
|
|
26
|
-
"--color": "--
|
|
27
|
-
"_segments": "
|
|
28
|
-
"__SLineGaugeSegment": "
|
|
29
|
-
"__SAnimationLine": "
|
|
30
|
-
"@move-line": "move-
|
|
14
|
+
"__SLineGauge": "___SLineGauge_1bwtu_gg_",
|
|
15
|
+
"_loading": "__loading_1bwtu_gg_",
|
|
16
|
+
"__SDonutContainer": "___SDonutContainer_1bwtu_gg_",
|
|
17
|
+
"__STrendLine": "___STrendLine_1bwtu_gg_",
|
|
18
|
+
"__STrendBar": "___STrendBar_1bwtu_gg_",
|
|
19
|
+
"@pulse": "pulse_1bwtu",
|
|
20
|
+
"--base-bg-color": "--base-bg-color_1bwtu",
|
|
21
|
+
"__SLineValue": "___SLineValue_1bwtu_gg_",
|
|
22
|
+
"_percent": "__percent_1bwtu_gg_",
|
|
23
|
+
"--percent": "--percent_1bwtu",
|
|
24
|
+
"_color": "__color_1bwtu_gg_",
|
|
25
|
+
"__SLineSegmentItem": "___SLineSegmentItem_1bwtu_gg_",
|
|
26
|
+
"--color": "--color_1bwtu",
|
|
27
|
+
"_segments": "__segments_1bwtu_gg_",
|
|
28
|
+
"__SLineGaugeSegment": "___SLineGaugeSegment_1bwtu_gg_",
|
|
29
|
+
"__SAnimationLine": "___SAnimationLine_1bwtu_gg_",
|
|
30
|
+
"@move-line": "move-line_1bwtu"
|
|
31
31
|
});
|
|
32
32
|
class LineRoot extends Component {
|
|
33
33
|
getSegmentProps(segmentProps) {
|
|
@@ -75,6 +75,7 @@ class LineRoot extends Component {
|
|
|
75
75
|
}, _ref)
|
|
76
76
|
}), /*#__PURE__*/React.createElement(SLineGaugeSegment, _ref3.cn("SLineGaugeSegment", {}), /*#__PURE__*/React.createElement(Children, _ref3.cn("Children", {}))), animate && /*#__PURE__*/React.createElement(SAnimationLine, _ref3.cn("SAnimationLine", {})));
|
|
77
77
|
}
|
|
78
|
+
if (value === undefined) return null;
|
|
78
79
|
const {
|
|
79
80
|
segments
|
|
80
81
|
} = this.asProps;
|
|
@@ -114,16 +115,13 @@ function Segment(props) {
|
|
|
114
115
|
var _ref2 = arguments[0],
|
|
115
116
|
_ref6;
|
|
116
117
|
const {
|
|
117
|
-
styles
|
|
118
|
-
value
|
|
118
|
+
styles
|
|
119
119
|
} = props;
|
|
120
120
|
const SLineSegmentItem = Box;
|
|
121
|
-
if (!value) return null;
|
|
122
121
|
return _ref6 = sstyled(styles), /*#__PURE__*/React.createElement(SLineSegmentItem, _ref6.cn("SLineSegmentItem", {
|
|
123
122
|
..._assignProps3({}, _ref2)
|
|
124
123
|
}));
|
|
125
124
|
}
|
|
126
|
-
Segment.displayName = 'Segment';
|
|
127
125
|
|
|
128
126
|
/**
|
|
129
127
|
* MiniCharts.ScoreLine
|
|
@@ -133,5 +131,8 @@ Segment.displayName = 'Segment';
|
|
|
133
131
|
export const ScoreLine = createComponent(LineRoot, {
|
|
134
132
|
Segment
|
|
135
133
|
});
|
|
134
|
+
|
|
135
|
+
// Since the Intergalactic.Component was unfolded to plain component structure.
|
|
136
|
+
// @ts-ignore
|
|
136
137
|
ScoreLine.displayName = 'MiniChart.ScoreLine';
|
|
137
138
|
//# sourceMappingURL=Line.js.map
|
|
@@ -0,0 +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","ScoreLine","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":";;;;;AAAA,SAASA,GAAG,EAAEC,IAAI,QAAQ,0BAA0B;AAEpD,SAASC,eAAe,EAAEC,SAAS,EAAEC,IAAI,EAAEC,OAAO,QAAQ,eAAe;AACzE,OAAOC,mBAAmB,MAAM,sDAAsD;AACtF,OAAOC,KAAK,MAAM,OAAO;AAAC;AAAA,MAAAC,KAAA,8BAAAC,QAAA,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,SAASR,SAAS,CAO9B;EAUAS,eAAeA,CAACC,YAAkD,EAAE;IAClE,MAAM;MAAEC,QAAQ;MAAEC;IAAa,CAAC,GAAG,IAAI,CAACC,OAAO;IAE/C,IAAIC,GAAG,GAAG,CAAC;IACXV,KAAK,CAACW,QAAQ,CAACC,OAAO,CAACL,QAAQ,EAAGM,KAAK,IAAK;MAC1C,iBAAIb,KAAK,CAACc,cAAc,CAAuCD,KAAK,CAAC,EAAE;QACrEH,GAAG,GAAGA,GAAG,GAAGG,KAAK,CAACE,KAAK,CAACC,KAAK;MAC/B;IACF,CAAC,CAAC;IAEF,MAAMC,KAAK,GAAGP,GAAG,GAAG,CAAC,GAAI,GAAG,GAAGJ,YAAY,CAACU,KAAK,GAAIN,GAAG,GAAG,CAAC;IAE5D,OAAO;MACL,GAAG,EAAE,GAAGO,KAAK,GAA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ApGKzC,QAAQ,aAQK,CAACL,mBAAmB,CAAC,CAAC,CAAC;AAAA8C,eAAA,CARpCzC,QAAQ,iBASS,WAAW;AAAAyC,eAAA,CAT5BzC,QAAQ,WAWGH,KAAK;AAAA4C,eAAA,CAXhBzC,QAAQ,kBAaU;EACpB0B,OAAO,EAAE;AACX,CAAC;AAuFH,SAASgB,OAAOA,CACd/B,KAAmI,EACnI;EAAA,IAAAgC,KAAA,GAAAC,YAAA;IAAAC,KAAA;EACA,MAAM;IAAEtB;EAAO,CAAC,GAAGZ,KAAK;EACxB,MAAMW,gBAAgB,GAE2BjC,GAAG;EAApD,OAAAwD,KAAA,GAAOnD,OAAO,CAAC6B,MAAM,CAAC,eAAC3B,KAAA,CAAAiC,aAAA,CAACP,gBAAgB,EAAAuB,KAAA,CAAAf,EAAA;IAAA,GAAAgB,aAAA,KAAAH,KAAA;EAAA,EAAe,CAAC;AAC1D;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,SAAS,GAAGxD,eAAe,CAGtCS,QAAQ,EAAE;EAAE0C;AAAQ,CAAC,CAAC;;AAExB;AACA;AACAK,SAAS,CAACC,WAAW,GAAG,qBAAqB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["ScoreDonut","ScoreSemiDonut","ScoreLine"],"sources":["../../../../src/components/score/index.ts"],"sourcesContent":["export { ScoreDonut, ScoreSemiDonut } from './Donut';\nexport { ScoreLine } from './Line';\n"],"mappings":"AAAA,SAASA,UAAU,EAAEC,cAAc,QAAQ,SAAS;AACpD,SAASC,SAAS,QAAQ,QAAQ","ignoreList":[]}
|
|
@@ -7,16 +7,16 @@ import { extractAriaProps } from '@semcore/core/lib/utils/ariaProps';
|
|
|
7
7
|
import resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import { Trend } from './Trend';
|
|
10
|
-
/*!__reshadow-styles__:"
|
|
11
|
-
const style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".
|
|
10
|
+
/*!__reshadow-styles__:"../../styles/skeleton.shadow.css"*/
|
|
11
|
+
const style = (/*__reshadow_css_start__*/_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_"),
|
|
12
12
|
/*__reshadow_css_end__*/
|
|
13
13
|
{
|
|
14
|
-
"__SLineGauge": "
|
|
15
|
-
"_loading": "
|
|
16
|
-
"__SDonutContainer": "
|
|
17
|
-
"__STrendLine": "
|
|
18
|
-
"__STrendBar": "
|
|
19
|
-
"@pulse": "
|
|
14
|
+
"__SLineGauge": "___SLineGauge_30y2p_gg_",
|
|
15
|
+
"_loading": "__loading_30y2p_gg_",
|
|
16
|
+
"__SDonutContainer": "___SDonutContainer_30y2p_gg_",
|
|
17
|
+
"__STrendLine": "___STrendLine_30y2p_gg_",
|
|
18
|
+
"__STrendBar": "___STrendBar_30y2p_gg_",
|
|
19
|
+
"@pulse": "pulse_30y2p"
|
|
20
20
|
});
|
|
21
21
|
class TrendBarRoot extends Trend {
|
|
22
22
|
get defaultData() {
|
|
@@ -0,0 +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/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":";;;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,KAAK,MAAM,OAAO;AAEzB,SAASC,KAAK,QAAQ,SAAS;AAAC;AAAA,MAAAC,KAAA,8BAAAC,QAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAIhC,MAAMC,YAAY,SAASJ,KAAK,CAI9B;EASA,IAAIK,WAAWA,CAAA,EAAiC;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kC,IAAK;QACpD,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":[]}
|
|
@@ -8,16 +8,16 @@ import resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEn
|
|
|
8
8
|
import uniqueIDEnhancement from '@semcore/core/lib/utils/uniqueID';
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import { Trend } from './Trend';
|
|
11
|
-
/*!__reshadow-styles__:"
|
|
12
|
-
const style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".
|
|
11
|
+
/*!__reshadow-styles__:"../../styles/skeleton.shadow.css"*/
|
|
12
|
+
const style = (/*__reshadow_css_start__*/_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_"),
|
|
13
13
|
/*__reshadow_css_end__*/
|
|
14
14
|
{
|
|
15
|
-
"__SLineGauge": "
|
|
16
|
-
"_loading": "
|
|
17
|
-
"__SDonutContainer": "
|
|
18
|
-
"__STrendLine": "
|
|
19
|
-
"__STrendBar": "
|
|
20
|
-
"@pulse": "
|
|
15
|
+
"__SLineGauge": "___SLineGauge_30y2p_gg_",
|
|
16
|
+
"_loading": "__loading_30y2p_gg_",
|
|
17
|
+
"__SDonutContainer": "___SDonutContainer_30y2p_gg_",
|
|
18
|
+
"__STrendLine": "___STrendLine_30y2p_gg_",
|
|
19
|
+
"__STrendBar": "___STrendBar_30y2p_gg_",
|
|
20
|
+
"@pulse": "pulse_30y2p"
|
|
21
21
|
});
|
|
22
22
|
class TrendLineRoot extends Trend {
|
|
23
23
|
get defaultData() {
|
|
@@ -0,0 +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/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":";;;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,QAAQ,SAAS;AAAC;AAAA,MAAAC,KAAA,8BAAAC,QAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAIhC,MAAMC,aAAa,SAASJ,KAAK,CAI/B;EASA,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,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ACLC,YAAY,EAAGC,KAAmC,IAAK;QACrD,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":[]}
|
|
@@ -0,0 +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/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,SAASA,SAAS,QAAQ,eAAe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IAAIC,MAAM,GAAG,CAAC,EAAE;QAC3B,IAAI,CAACmB,QAAQ,CAAC;UAAEpB,KAAK;UAAEC;QAAO,CAAC,CAAC;MAClC;IACF;EACF;AACF","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["TrendBar","TrendHistogram","TrendLine","TrendArea"],"sources":["../../../../src/components/trend/index.ts"],"sourcesContent":["export { TrendBar, TrendHistogram } from './Bar';\nexport { TrendLine, TrendArea } from './Line';\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,cAAc,QAAQ,OAAO;AAChD,SAASC,SAAS,EAAEC,SAAS,QAAQ,QAAQ","ignoreList":[]}
|
package/lib/es6/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TrendLine, TrendArea, TrendBar, TrendHistogram } from './
|
|
3
|
-
|
|
1
|
+
import { ScoreDonut, ScoreSemiDonut, ScoreLine } from './components/score';
|
|
2
|
+
import { TrendLine, TrendArea, TrendBar, TrendHistogram } from './components/trend';
|
|
3
|
+
export default {
|
|
4
4
|
TrendLine,
|
|
5
5
|
TrendArea,
|
|
6
6
|
TrendBar,
|
|
@@ -9,5 +9,4 @@ const miniCharts = {
|
|
|
9
9
|
ScoreDonut,
|
|
10
10
|
ScoreLine
|
|
11
11
|
};
|
|
12
|
-
export default miniCharts;
|
|
13
12
|
//# sourceMappingURL=index.js.map
|
package/lib/es6/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["ScoreDonut","ScoreSemiDonut","ScoreLine","TrendLine","TrendArea","TrendBar","TrendHistogram"],"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,SAASA,UAAU,EAAEC,cAAc,EAAEC,SAAS,QAAQ,oBAAoB;AAC1E,SAASC,SAAS,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,cAAc,QAAQ,oBAAoB;AAGnF,eAAe;EACbH,SAAS;EACTC,SAAS;EACTC,QAAQ;EACRC,cAAc;EACdL,cAAc;EACdD,UAAU;EACVE;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/es6/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;
|
|
@@ -6,24 +6,24 @@ import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEn
|
|
|
6
6
|
import { cssVariableEnhance } from "@semcore/core/lib/utils/useCssVariable";
|
|
7
7
|
import React from "react";
|
|
8
8
|
import { ScoreDonutUtils } from "../../utils/ScoreDonutUtils.mjs";
|
|
9
|
-
/*!__reshadow-styles__:"
|
|
9
|
+
/*!__reshadow-styles__:"../../styles/donut.shadow.css"*/
|
|
10
10
|
const style = (
|
|
11
11
|
/*__reshadow_css_start__*/
|
|
12
12
|
(sstyled.insert(
|
|
13
13
|
/*__inner_css_start__*/
|
|
14
|
-
".
|
|
14
|
+
".___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}",
|
|
15
15
|
/*__inner_css_end__*/
|
|
16
|
-
"
|
|
16
|
+
"6nq9n_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_6nq9n_gg_",
|
|
20
|
+
"_loading": "__loading_6nq9n_gg_",
|
|
21
|
+
"__SDonutContainer": "___SDonutContainer_6nq9n_gg_",
|
|
22
|
+
"__STrendLine": "___STrendLine_6nq9n_gg_",
|
|
23
|
+
"__STrendBar": "___STrendBar_6nq9n_gg_",
|
|
24
|
+
"@pulse": "pulse_6nq9n",
|
|
25
|
+
"_animate": "__animate_6nq9n_gg_",
|
|
26
|
+
"_semi": "__semi_6nq9n_gg_"
|
|
27
27
|
})
|
|
28
28
|
);
|
|
29
29
|
class DonutRoot extends Component {
|
|
@@ -3,33 +3,33 @@ 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";
|
|
5
5
|
import React from "react";
|
|
6
|
-
/*!__reshadow-styles__:"
|
|
6
|
+
/*!__reshadow-styles__:"../../styles/line.shadow.css"*/
|
|
7
7
|
const style = (
|
|
8
8
|
/*__reshadow_css_start__*/
|
|
9
9
|
(sstyled.insert(
|
|
10
10
|
/*__inner_css_start__*/
|
|
11
|
-
".
|
|
11
|
+
".___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%)}}",
|
|
12
12
|
/*__inner_css_end__*/
|
|
13
|
-
"
|
|
13
|
+
"1bwtu_gg_"
|
|
14
14
|
), /*__reshadow_css_end__*/
|
|
15
15
|
{
|
|
16
|
-
"__SLineGauge": "
|
|
17
|
-
"_loading": "
|
|
18
|
-
"__SDonutContainer": "
|
|
19
|
-
"__STrendLine": "
|
|
20
|
-
"__STrendBar": "
|
|
21
|
-
"@pulse": "
|
|
22
|
-
"--base-bg-color": "--base-bg-
|
|
23
|
-
"__SLineValue": "
|
|
24
|
-
"_percent": "
|
|
25
|
-
"--percent": "--
|
|
26
|
-
"_color": "
|
|
27
|
-
"__SLineSegmentItem": "
|
|
28
|
-
"--color": "--
|
|
29
|
-
"_segments": "
|
|
30
|
-
"__SLineGaugeSegment": "
|
|
31
|
-
"__SAnimationLine": "
|
|
32
|
-
"@move-line": "move-
|
|
16
|
+
"__SLineGauge": "___SLineGauge_1bwtu_gg_",
|
|
17
|
+
"_loading": "__loading_1bwtu_gg_",
|
|
18
|
+
"__SDonutContainer": "___SDonutContainer_1bwtu_gg_",
|
|
19
|
+
"__STrendLine": "___STrendLine_1bwtu_gg_",
|
|
20
|
+
"__STrendBar": "___STrendBar_1bwtu_gg_",
|
|
21
|
+
"@pulse": "pulse_1bwtu",
|
|
22
|
+
"--base-bg-color": "--base-bg-color_1bwtu",
|
|
23
|
+
"__SLineValue": "___SLineValue_1bwtu_gg_",
|
|
24
|
+
"_percent": "__percent_1bwtu_gg_",
|
|
25
|
+
"--percent": "--percent_1bwtu",
|
|
26
|
+
"_color": "__color_1bwtu_gg_",
|
|
27
|
+
"__SLineSegmentItem": "___SLineSegmentItem_1bwtu_gg_",
|
|
28
|
+
"--color": "--color_1bwtu",
|
|
29
|
+
"_segments": "__segments_1bwtu_gg_",
|
|
30
|
+
"__SLineGaugeSegment": "___SLineGaugeSegment_1bwtu_gg_",
|
|
31
|
+
"__SAnimationLine": "___SAnimationLine_1bwtu_gg_",
|
|
32
|
+
"@move-line": "move-line_1bwtu"
|
|
33
33
|
})
|
|
34
34
|
);
|
|
35
35
|
class LineRoot extends Component {
|
|
@@ -77,6 +77,7 @@ class LineRoot extends Component {
|
|
|
77
77
|
}, _ref)
|
|
78
78
|
}), /* @__PURE__ */ React.createElement(SLineGaugeSegment, _ref3.cn("SLineGaugeSegment", {}), /* @__PURE__ */ React.createElement(Children, _ref3.cn("Children", {}))), animate && /* @__PURE__ */ React.createElement(SAnimationLine, _ref3.cn("SAnimationLine", {})));
|
|
79
79
|
}
|
|
80
|
+
if (value === void 0) return null;
|
|
80
81
|
const {
|
|
81
82
|
segments
|
|
82
83
|
} = this.asProps;
|
|
@@ -115,16 +116,13 @@ _defineProperty(LineRoot, "defaultProps", {
|
|
|
115
116
|
function Segment(props) {
|
|
116
117
|
var _ref2 = arguments[0], _ref6;
|
|
117
118
|
const {
|
|
118
|
-
styles
|
|
119
|
-
value
|
|
119
|
+
styles
|
|
120
120
|
} = props;
|
|
121
121
|
const SLineSegmentItem = Box;
|
|
122
|
-
if (!value) return null;
|
|
123
122
|
return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SLineSegmentItem, _ref6.cn("SLineSegmentItem", {
|
|
124
123
|
...assignProps({}, _ref2)
|
|
125
124
|
}));
|
|
126
125
|
}
|
|
127
|
-
Segment.displayName = "Segment";
|
|
128
126
|
const ScoreLine = createComponent(LineRoot, {
|
|
129
127
|
Segment
|
|
130
128
|
});
|
|
@@ -5,22 +5,22 @@ import { extractAriaProps } from "@semcore/core/lib/utils/ariaProps";
|
|
|
5
5
|
import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
|
|
6
6
|
import React from "react";
|
|
7
7
|
import { Trend } from "./Trend.mjs";
|
|
8
|
-
/*!__reshadow-styles__:"
|
|
8
|
+
/*!__reshadow-styles__:"../../styles/skeleton.shadow.css"*/
|
|
9
9
|
const style = (
|
|
10
10
|
/*__reshadow_css_start__*/
|
|
11
11
|
(sstyled.insert(
|
|
12
12
|
/*__inner_css_start__*/
|
|
13
|
-
".
|
|
13
|
+
".___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}}",
|
|
14
14
|
/*__inner_css_end__*/
|
|
15
|
-
"
|
|
15
|
+
"30y2p_gg_"
|
|
16
16
|
), /*__reshadow_css_end__*/
|
|
17
17
|
{
|
|
18
|
-
"__SLineGauge": "
|
|
19
|
-
"_loading": "
|
|
20
|
-
"__SDonutContainer": "
|
|
21
|
-
"__STrendLine": "
|
|
22
|
-
"__STrendBar": "
|
|
23
|
-
"@pulse": "
|
|
18
|
+
"__SLineGauge": "___SLineGauge_30y2p_gg_",
|
|
19
|
+
"_loading": "__loading_30y2p_gg_",
|
|
20
|
+
"__SDonutContainer": "___SDonutContainer_30y2p_gg_",
|
|
21
|
+
"__STrendLine": "___STrendLine_30y2p_gg_",
|
|
22
|
+
"__STrendBar": "___STrendBar_30y2p_gg_",
|
|
23
|
+
"@pulse": "pulse_30y2p"
|
|
24
24
|
})
|
|
25
25
|
);
|
|
26
26
|
class TrendBarRoot extends Trend {
|
|
@@ -6,22 +6,22 @@ import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEn
|
|
|
6
6
|
import uniqueIDEnhancement from "@semcore/core/lib/utils/uniqueID";
|
|
7
7
|
import React from "react";
|
|
8
8
|
import { Trend } from "./Trend.mjs";
|
|
9
|
-
/*!__reshadow-styles__:"
|
|
9
|
+
/*!__reshadow-styles__:"../../styles/skeleton.shadow.css"*/
|
|
10
10
|
const style = (
|
|
11
11
|
/*__reshadow_css_start__*/
|
|
12
12
|
(sstyled.insert(
|
|
13
13
|
/*__inner_css_start__*/
|
|
14
|
-
".
|
|
14
|
+
".___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}}",
|
|
15
15
|
/*__inner_css_end__*/
|
|
16
|
-
"
|
|
16
|
+
"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
|
);
|
|
27
27
|
class TrendLineRoot extends Trend {
|