@lobehub/charts 4.0.0 → 4.0.2
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/es/AccuracyBarChart/index.js +11 -17
- package/es/AccuracyBarChart/styles.d.ts +11 -11
- package/es/AccuracyBarChart/styles.js +8 -8
- package/es/AreaChart/index.js +9 -13
- package/es/AreaChart/styles.d.ts +6 -6
- package/es/AreaChart/styles.js +6 -6
- package/es/BarChart/index.js +9 -13
- package/es/BarChart/styles.d.ts +6 -6
- package/es/BarChart/styles.js +6 -6
- package/es/BarList/index.js +3 -5
- package/es/BarList/styles.d.ts +10 -10
- package/es/BarList/styles.js +10 -10
- package/es/DataBars/CategoryBar.js +4 -10
- package/es/DataBars/DeltaBar.js +5 -8
- package/es/DataBars/MarkerBar.js +5 -8
- package/es/DataBars/ProgressBar.js +4 -7
- package/es/DataBars/styles.d.ts +7 -7
- package/es/DataBars/styles.js +6 -6
- package/es/DonutChart/index.js +7 -11
- package/es/DonutChart/styles.d.ts +6 -6
- package/es/DonutChart/styles.js +6 -6
- package/es/FunnelChart/index.js +8 -12
- package/es/FunnelChart/styles.d.ts +6 -6
- package/es/FunnelChart/styles.js +6 -6
- package/es/Heatmaps/Calendar.js +133 -50
- package/es/Heatmaps/ChartLabels.js +95 -42
- package/es/Heatmaps/Footer.js +95 -50
- package/es/Heatmaps/index.js +124 -84
- package/es/Heatmaps/styles.d.ts +7 -7
- package/es/Heatmaps/styles.js +4 -4
- package/es/Legend/LegendItem.js +6 -11
- package/es/Legend/index.js +2 -5
- package/es/LineChart/index.js +7 -11
- package/es/LineChart/styles.d.ts +6 -6
- package/es/LineChart/styles.js +6 -6
- package/es/ScatterChart/ScatterChartTooltip.js +5 -10
- package/es/ScatterChart/ScatterChartTooltipRow.js +4 -7
- package/es/ScatterChart/index.js +5 -9
- package/es/ScatterChart/styles.d.ts +6 -6
- package/es/ScatterChart/styles.js +6 -6
- package/es/SparkChart/SparkAreaChart.js +4 -8
- package/es/SparkChart/SparkBarChart.js +2 -6
- package/es/SparkChart/SparkLineChart.js +2 -6
- package/es/Tracker/TrackerBlock.js +7 -11
- package/es/Tracker/index.js +2 -4
- package/es/Tracker/styles.d.ts +5 -5
- package/es/Tracker/styles.js +5 -5
- package/es/common/ChartTooltip/ChartTooltipFrame.d.ts +3 -3
- package/es/common/ChartTooltip/ChartTooltipFrame.js +4 -6
- package/es/common/ChartTooltip/ChartTooltipRow.js +4 -6
- package/es/common/ChartTooltip/index.js +5 -9
- package/es/common/CustomYAxisTick.js +2 -3
- package/es/common/NoData.js +3 -4
- package/package.json +4 -3
|
@@ -19,8 +19,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
19
19
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
20
20
|
import { Flexbox } from '@lobehub/ui';
|
|
21
21
|
import { Skeleton } from 'antd';
|
|
22
|
-
import { css } from 'antd-style';
|
|
23
|
-
import { readableColor } from 'polished';
|
|
22
|
+
import { css, cssVar, cx } from 'antd-style';
|
|
24
23
|
import { forwardRef, useMemo, useState } from 'react';
|
|
25
24
|
import { Bar, CartesianGrid, ErrorBar, Label, LabelList, Legend, BarChart as ReChartsBarChart, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts';
|
|
26
25
|
import ChartLegend from "../common/ChartLegend";
|
|
@@ -31,16 +30,12 @@ import { constructCategoryColors, deepEqual, getYAxisDomain } from "../common/ut
|
|
|
31
30
|
import { useThemeColorRange } from "../hooks/useThemeColorRange";
|
|
32
31
|
import { defaultValueFormatter } from "../utils";
|
|
33
32
|
import { getMaxLabelLength, getTextWidth } from "../utils/getMaxLabelLength";
|
|
34
|
-
import {
|
|
33
|
+
import { styles } from "./styles";
|
|
35
34
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
36
35
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
37
36
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
38
37
|
var AccuracyBarChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
39
38
|
var _categoryColors$get;
|
|
40
|
-
var _useStyles = useStyles(),
|
|
41
|
-
cx = _useStyles.cx,
|
|
42
|
-
theme = _useStyles.theme,
|
|
43
|
-
styles = _useStyles.styles;
|
|
44
39
|
var themeColorRange = useThemeColorRange();
|
|
45
40
|
var _props$data = props.data,
|
|
46
41
|
data = _props$data === void 0 ? [] : _props$data,
|
|
@@ -242,7 +237,7 @@ var AccuracyBarChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
242
237
|
offset: -20,
|
|
243
238
|
position: "insideBottom",
|
|
244
239
|
style: {
|
|
245
|
-
fill:
|
|
240
|
+
fill: cssVar.colorTextSecondary,
|
|
246
241
|
fontWeight: 500,
|
|
247
242
|
textAnchor: 'middle'
|
|
248
243
|
},
|
|
@@ -274,7 +269,7 @@ var AccuracyBarChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
274
269
|
offset: -20,
|
|
275
270
|
position: "insideBottom",
|
|
276
271
|
style: {
|
|
277
|
-
fill:
|
|
272
|
+
fill: cssVar.colorTextSecondary,
|
|
278
273
|
fontWeight: 500,
|
|
279
274
|
textAnchor: 'middle'
|
|
280
275
|
},
|
|
@@ -307,7 +302,7 @@ var AccuracyBarChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
307
302
|
offset: -15,
|
|
308
303
|
position: "insideLeft",
|
|
309
304
|
style: {
|
|
310
|
-
fill:
|
|
305
|
+
fill: cssVar.colorTextSecondary,
|
|
311
306
|
fontWeight: 500,
|
|
312
307
|
textAnchor: 'middle'
|
|
313
308
|
},
|
|
@@ -339,7 +334,7 @@ var AccuracyBarChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
339
334
|
offset: -15,
|
|
340
335
|
position: "insideLeft",
|
|
341
336
|
style: {
|
|
342
|
-
fill:
|
|
337
|
+
fill: cssVar.colorTextSecondary,
|
|
343
338
|
fontWeight: 500,
|
|
344
339
|
textAnchor: 'middle'
|
|
345
340
|
},
|
|
@@ -380,7 +375,7 @@ var AccuracyBarChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
380
375
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
381
376
|
children: [accuracyFormatter(Number(val)), /*#__PURE__*/_jsxs("span", {
|
|
382
377
|
style: {
|
|
383
|
-
color:
|
|
378
|
+
color: cssVar.colorTextSecondary
|
|
384
379
|
},
|
|
385
380
|
children: [' ', "\xB1 ", errorFormatter(Number(errVal))]
|
|
386
381
|
})]
|
|
@@ -389,7 +384,7 @@ var AccuracyBarChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
389
384
|
});
|
|
390
385
|
} : undefined,
|
|
391
386
|
cursor: {
|
|
392
|
-
fill:
|
|
387
|
+
fill: cssVar.colorFillTertiary
|
|
393
388
|
},
|
|
394
389
|
isAnimationActive: false,
|
|
395
390
|
position: {
|
|
@@ -411,7 +406,7 @@ var AccuracyBarChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
411
406
|
verticalAlign: "top"
|
|
412
407
|
}) : undefined, /*#__PURE__*/_jsxs(Bar, {
|
|
413
408
|
animationDuration: animationDuration,
|
|
414
|
-
className: cx(css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n fill: ", ";\n "])), (_categoryColors$get = categoryColors.get(category)) !== null && _categoryColors$get !== void 0 ? _categoryColors$get :
|
|
409
|
+
className: cx(css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n fill: ", ";\n "])), (_categoryColors$get = categoryColors.get(category)) !== null && _categoryColors$get !== void 0 ? _categoryColors$get : cssVar.colorPrimary)),
|
|
415
410
|
dataKey: category,
|
|
416
411
|
fill: '',
|
|
417
412
|
isAnimationActive: showAnimation,
|
|
@@ -423,7 +418,6 @@ var AccuracyBarChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
423
418
|
type: "linear",
|
|
424
419
|
children: [showPercentage && layout === 'vertical' ? /*#__PURE__*/_jsx(LabelList, {
|
|
425
420
|
content: function content(labelProps) {
|
|
426
|
-
var _categoryColors$get2;
|
|
427
421
|
var lx = labelProps.x,
|
|
428
422
|
ly = labelProps.y,
|
|
429
423
|
lh = labelProps.height,
|
|
@@ -438,7 +432,7 @@ var AccuracyBarChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
438
432
|
className: styles.percentageLabel,
|
|
439
433
|
dominantBaseline: "central",
|
|
440
434
|
style: {
|
|
441
|
-
fill:
|
|
435
|
+
fill: cssVar.colorTextLightSolid
|
|
442
436
|
},
|
|
443
437
|
x: Number(lx) + 8,
|
|
444
438
|
y: Number(ly) + Number(lh) / 2,
|
|
@@ -451,7 +445,7 @@ var AccuracyBarChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
451
445
|
}) : null, showErrorBars ? /*#__PURE__*/_jsx(ErrorBar, {
|
|
452
446
|
dataKey: errorKey,
|
|
453
447
|
direction: layout === 'vertical' ? 'x' : 'y',
|
|
454
|
-
stroke:
|
|
448
|
+
stroke: cssVar.colorTextSecondary
|
|
455
449
|
}) : null]
|
|
456
450
|
}, category)]
|
|
457
451
|
}) : /*#__PURE__*/_jsx(NoData, {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
accuracyText:
|
|
3
|
-
accuracyTextLight:
|
|
4
|
-
emphasis:
|
|
5
|
-
gridLines:
|
|
6
|
-
label:
|
|
7
|
-
leftValue:
|
|
8
|
-
leftValueContainer:
|
|
9
|
-
percentageLabel:
|
|
10
|
-
strongLabel:
|
|
11
|
-
}
|
|
1
|
+
export declare const styles: {
|
|
2
|
+
accuracyText: string;
|
|
3
|
+
accuracyTextLight: string;
|
|
4
|
+
emphasis: string;
|
|
5
|
+
gridLines: string;
|
|
6
|
+
label: string;
|
|
7
|
+
leftValue: string;
|
|
8
|
+
leftValueContainer: string;
|
|
9
|
+
percentageLabel: string;
|
|
10
|
+
strongLabel: string;
|
|
11
|
+
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
-
import {
|
|
4
|
-
export var
|
|
3
|
+
import { createStaticStyles } from 'antd-style';
|
|
4
|
+
export var styles = createStaticStyles(function (_ref) {
|
|
5
5
|
var css = _ref.css,
|
|
6
|
-
|
|
6
|
+
cssVar = _ref.cssVar;
|
|
7
7
|
return {
|
|
8
|
-
accuracyText: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-size: 11px;\n font-weight: 500;\n\n dominant-baseline: central;\n text-anchor: middle;\n fill: ", ";\n "])),
|
|
9
|
-
accuracyTextLight: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n font-size: 11px;\n font-weight: 500;\n\n dominant-baseline: central;\n text-anchor: middle;\n fill: ", ";\n "])),
|
|
8
|
+
accuracyText: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-size: 11px;\n font-weight: 500;\n\n dominant-baseline: central;\n text-anchor: middle;\n fill: ", ";\n "])), cssVar.colorText),
|
|
9
|
+
accuracyTextLight: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n font-size: 11px;\n font-weight: 500;\n\n dominant-baseline: central;\n text-anchor: middle;\n fill: ", ";\n "])), cssVar.colorTextLightSolid),
|
|
10
10
|
emphasis: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n "]))),
|
|
11
|
-
gridLines: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n stroke: ", ";\n stroke-width: 1;\n "])),
|
|
12
|
-
label: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n font-size: 12px;\n line-height: 16px;\n fill: ", ";\n "])),
|
|
11
|
+
gridLines: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n stroke: ", ";\n stroke-width: 1;\n "])), cssVar.colorBorderSecondary),
|
|
12
|
+
label: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n font-size: 12px;\n line-height: 16px;\n fill: ", ";\n "])), cssVar.colorTextDescription),
|
|
13
13
|
leftValue: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n display: flex;\n flex: 1;\n align-items: center;\n justify-content: flex-end;\n\n padding-right: 8px;\n "]))),
|
|
14
14
|
leftValueContainer: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n pointer-events: none;\n\n position: absolute;\n z-index: 10;\n top: 0;\n bottom: 0;\n left: 0;\n\n display: flex;\n flex-direction: column;\n\n width: 80px;\n "]))),
|
|
15
15
|
percentageLabel: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n padding: 2px 4px;\n border-radius: 4px;\n font-size: 12px;\n "]))),
|
|
16
|
-
strongLabel: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n font-size: 12px;\n font-weight: 500;\n line-height: 16px;\n fill: ", ";\n "])),
|
|
16
|
+
strongLabel: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n font-size: 12px;\n font-weight: 500;\n line-height: 16px;\n fill: ", ";\n "])), cssVar.colorTextSecondary)
|
|
17
17
|
};
|
|
18
18
|
});
|
package/es/AreaChart/index.js
CHANGED
|
@@ -19,7 +19,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
19
19
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
20
20
|
import { Flexbox } from '@lobehub/ui';
|
|
21
21
|
import { Skeleton } from 'antd';
|
|
22
|
-
import { css } from 'antd-style';
|
|
22
|
+
import { css, cssVar, cx } from 'antd-style';
|
|
23
23
|
import { Fragment, forwardRef, useMemo, useState } from 'react';
|
|
24
24
|
import { Area, CartesianGrid, Dot, Label, Legend, Line, AreaChart as ReChartsAreaChart, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts';
|
|
25
25
|
import ChartLegend from "../common/ChartLegend";
|
|
@@ -30,14 +30,10 @@ import { constructCategoryColors, getYAxisDomain, hasOnlyOneValueForThisKey } fr
|
|
|
30
30
|
import { useThemeColorRange } from "../hooks/useThemeColorRange";
|
|
31
31
|
import { defaultValueFormatter } from "../utils";
|
|
32
32
|
import { getMaxLabelLength } from "../utils/getMaxLabelLength";
|
|
33
|
-
import {
|
|
33
|
+
import { styles } from "./styles";
|
|
34
34
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
35
35
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
36
36
|
var AreaChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
37
|
-
var _useStyles = useStyles(),
|
|
38
|
-
cx = _useStyles.cx,
|
|
39
|
-
theme = _useStyles.theme,
|
|
40
|
-
styles = _useStyles.styles;
|
|
41
37
|
var themeColorRange = useThemeColorRange();
|
|
42
38
|
var _props$data = props.data,
|
|
43
39
|
data = _props$data === void 0 ? [] : _props$data,
|
|
@@ -268,7 +264,7 @@ var AreaChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
268
264
|
payload: (_ref2 = stack ? payload === null || payload === void 0 ? void 0 : payload.reverse() : payload) === null || _ref2 === void 0 ? void 0 : _ref2.map(function (payloadItem) {
|
|
269
265
|
var _categoryColors$get;
|
|
270
266
|
return _objectSpread(_objectSpread({}, payloadItem), {}, {
|
|
271
|
-
color: (_categoryColors$get = categoryColors.get(payloadItem.dataKey)) !== null && _categoryColors$get !== void 0 ? _categoryColors$get :
|
|
267
|
+
color: (_categoryColors$get = categoryColors.get(payloadItem.dataKey)) !== null && _categoryColors$get !== void 0 ? _categoryColors$get : cssVar.colorPrimary
|
|
272
268
|
});
|
|
273
269
|
}),
|
|
274
270
|
valueFormatter: valueFormatter
|
|
@@ -282,7 +278,7 @@ var AreaChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
282
278
|
});
|
|
283
279
|
} : undefined,
|
|
284
280
|
cursor: {
|
|
285
|
-
stroke:
|
|
281
|
+
stroke: cssVar.colorTextSecondary,
|
|
286
282
|
strokeWidth: 1
|
|
287
283
|
},
|
|
288
284
|
isAnimationActive: false,
|
|
@@ -307,7 +303,7 @@ var AreaChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
307
303
|
var _categoryColors$get2, _categoryColors$get3;
|
|
308
304
|
return /*#__PURE__*/_jsx("defs", {
|
|
309
305
|
children: showGradient ? /*#__PURE__*/_jsxs("linearGradient", {
|
|
310
|
-
className: cx(css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n "])), (_categoryColors$get2 = categoryColors.get(category)) !== null && _categoryColors$get2 !== void 0 ? _categoryColors$get2 :
|
|
306
|
+
className: cx(css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n "])), (_categoryColors$get2 = categoryColors.get(category)) !== null && _categoryColors$get2 !== void 0 ? _categoryColors$get2 : cssVar.colorPrimary)),
|
|
311
307
|
id: categoryColors.get(category),
|
|
312
308
|
x1: "0",
|
|
313
309
|
x2: "0",
|
|
@@ -323,7 +319,7 @@ var AreaChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
323
319
|
stopOpacity: 0
|
|
324
320
|
})]
|
|
325
321
|
}) : /*#__PURE__*/_jsx("linearGradient", {
|
|
326
|
-
className: cx(css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n color: ", ";\n "])), (_categoryColors$get3 = categoryColors.get(category)) !== null && _categoryColors$get3 !== void 0 ? _categoryColors$get3 :
|
|
322
|
+
className: cx(css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n color: ", ";\n "])), (_categoryColors$get3 = categoryColors.get(category)) !== null && _categoryColors$get3 !== void 0 ? _categoryColors$get3 : cssVar.colorPrimary)),
|
|
327
323
|
id: categoryColors.get(category),
|
|
328
324
|
x1: "0",
|
|
329
325
|
x2: "0",
|
|
@@ -348,7 +344,7 @@ var AreaChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
348
344
|
strokeWidth = props.strokeWidth,
|
|
349
345
|
dataKey = props.dataKey;
|
|
350
346
|
return /*#__PURE__*/_jsx(Dot, {
|
|
351
|
-
className: cx(css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n fill: ", ";\n "])), (_categoryColors$get4 = categoryColors.get(dataKey)) !== null && _categoryColors$get4 !== void 0 ? _categoryColors$get4 :
|
|
347
|
+
className: cx(css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n fill: ", ";\n "])), (_categoryColors$get4 = categoryColors.get(dataKey)) !== null && _categoryColors$get4 !== void 0 ? _categoryColors$get4 : cssVar.colorPrimary)),
|
|
352
348
|
cx: dotCx,
|
|
353
349
|
cy: dotCy,
|
|
354
350
|
fill: "",
|
|
@@ -363,7 +359,7 @@ var AreaChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
363
359
|
});
|
|
364
360
|
},
|
|
365
361
|
animationDuration: animationDuration,
|
|
366
|
-
className: cx(css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n stroke: ", ";\n "])), (_categoryColors$get5 = categoryColors.get(category)) !== null && _categoryColors$get5 !== void 0 ? _categoryColors$get5 :
|
|
362
|
+
className: cx(css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n stroke: ", ";\n "])), (_categoryColors$get5 = categoryColors.get(category)) !== null && _categoryColors$get5 !== void 0 ? _categoryColors$get5 : cssVar.colorPrimary)),
|
|
367
363
|
connectNulls: connectNulls,
|
|
368
364
|
dataKey: category,
|
|
369
365
|
dot: function dot(props) {
|
|
@@ -378,7 +374,7 @@ var AreaChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
378
374
|
if (hasOnlyOneValueForThisKey(data, category) && !(activeDot || activeLegend && activeLegend !== category) || (activeDot === null || activeDot === void 0 ? void 0 : activeDot.index) === index && (activeDot === null || activeDot === void 0 ? void 0 : activeDot.dataKey) === category) {
|
|
379
375
|
var _categoryColors$get6;
|
|
380
376
|
return /*#__PURE__*/_jsx(Dot, {
|
|
381
|
-
className: cx(css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n fill: ", ";\n "])), (_categoryColors$get6 = categoryColors.get(dataKey)) !== null && _categoryColors$get6 !== void 0 ? _categoryColors$get6 :
|
|
377
|
+
className: cx(css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n fill: ", ";\n "])), (_categoryColors$get6 = categoryColors.get(dataKey)) !== null && _categoryColors$get6 !== void 0 ? _categoryColors$get6 : cssVar.colorPrimary)),
|
|
382
378
|
cx: dotCx,
|
|
383
379
|
cy: dotCy,
|
|
384
380
|
fill: "",
|
package/es/AreaChart/styles.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
emphasis:
|
|
3
|
-
gridLines:
|
|
4
|
-
label:
|
|
5
|
-
strongLabel:
|
|
6
|
-
}
|
|
1
|
+
export declare const styles: {
|
|
2
|
+
emphasis: string;
|
|
3
|
+
gridLines: string;
|
|
4
|
+
label: string;
|
|
5
|
+
strongLabel: string;
|
|
6
|
+
};
|
package/es/AreaChart/styles.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
-
import {
|
|
4
|
-
export var
|
|
3
|
+
import { createStaticStyles } from 'antd-style';
|
|
4
|
+
export var styles = createStaticStyles(function (_ref) {
|
|
5
5
|
var css = _ref.css,
|
|
6
|
-
|
|
6
|
+
cssVar = _ref.cssVar;
|
|
7
7
|
return {
|
|
8
8
|
emphasis: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n "]))),
|
|
9
|
-
gridLines: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n stroke: ", ";\n stroke-width: 1;\n "])),
|
|
10
|
-
label: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n font-size: 12px;\n line-height: 16px;\n fill: ", ";\n "])),
|
|
11
|
-
strongLabel: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n font-size: 12px;\n font-weight: 500;\n line-height: 16px;\n fill: ", ";\n "])),
|
|
9
|
+
gridLines: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n stroke: ", ";\n stroke-width: 1;\n "])), cssVar.colorBorderSecondary),
|
|
10
|
+
label: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n font-size: 12px;\n line-height: 16px;\n fill: ", ";\n "])), cssVar.colorTextDescription),
|
|
11
|
+
strongLabel: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n font-size: 12px;\n font-weight: 500;\n line-height: 16px;\n fill: ", ";\n "])), cssVar.colorTextSecondary)
|
|
12
12
|
};
|
|
13
13
|
});
|
package/es/BarChart/index.js
CHANGED
|
@@ -19,7 +19,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
19
19
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
20
20
|
import { Flexbox } from '@lobehub/ui';
|
|
21
21
|
import { Skeleton } from 'antd';
|
|
22
|
-
import { css } from 'antd-style';
|
|
22
|
+
import { css, cssVar, cx } from 'antd-style';
|
|
23
23
|
import { forwardRef, useMemo, useState } from 'react';
|
|
24
24
|
import { Bar, CartesianGrid, Label, Legend, BarChart as ReChartsBarChart, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts';
|
|
25
25
|
import ChartLegend from "../common/ChartLegend";
|
|
@@ -30,14 +30,10 @@ import { constructCategoryColors, deepEqual, getYAxisDomain } from "../common/ut
|
|
|
30
30
|
import { useThemeColorRange } from "../hooks/useThemeColorRange";
|
|
31
31
|
import { defaultValueFormatter } from "../utils";
|
|
32
32
|
import { getMaxLabelLength } from "../utils/getMaxLabelLength";
|
|
33
|
-
import {
|
|
33
|
+
import { styles } from "./styles";
|
|
34
34
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
35
35
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
36
36
|
var BarChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
37
|
-
var _useStyles = useStyles(),
|
|
38
|
-
cx = _useStyles.cx,
|
|
39
|
-
theme = _useStyles.theme,
|
|
40
|
-
styles = _useStyles.styles;
|
|
41
37
|
var themeColorRange = useThemeColorRange();
|
|
42
38
|
var _props$data = props.data,
|
|
43
39
|
data = _props$data === void 0 ? [] : _props$data,
|
|
@@ -222,7 +218,7 @@ var BarChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
222
218
|
offset: -20,
|
|
223
219
|
position: "insideBottom",
|
|
224
220
|
style: {
|
|
225
|
-
fill:
|
|
221
|
+
fill: cssVar.colorTextSecondary,
|
|
226
222
|
fontWeight: 500,
|
|
227
223
|
textAnchor: 'middle'
|
|
228
224
|
},
|
|
@@ -254,7 +250,7 @@ var BarChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
254
250
|
offset: -20,
|
|
255
251
|
position: "insideBottom",
|
|
256
252
|
style: {
|
|
257
|
-
fill:
|
|
253
|
+
fill: cssVar.colorTextSecondary,
|
|
258
254
|
fontWeight: 500,
|
|
259
255
|
textAnchor: 'middle'
|
|
260
256
|
},
|
|
@@ -287,7 +283,7 @@ var BarChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
287
283
|
offset: -15,
|
|
288
284
|
position: "insideLeft",
|
|
289
285
|
style: {
|
|
290
|
-
fill:
|
|
286
|
+
fill: cssVar.colorTextSecondary,
|
|
291
287
|
fontWeight: 500,
|
|
292
288
|
textAnchor: 'middle'
|
|
293
289
|
},
|
|
@@ -319,7 +315,7 @@ var BarChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
319
315
|
offset: -15,
|
|
320
316
|
position: "insideLeft",
|
|
321
317
|
style: {
|
|
322
|
-
fill:
|
|
318
|
+
fill: cssVar.colorTextSecondary,
|
|
323
319
|
fontWeight: 500,
|
|
324
320
|
textAnchor: 'middle'
|
|
325
321
|
},
|
|
@@ -338,7 +334,7 @@ var BarChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
338
334
|
payload: (_ref2 = stack ? payload === null || payload === void 0 ? void 0 : payload.reverse() : payload) === null || _ref2 === void 0 ? void 0 : _ref2.map(function (payloadItem) {
|
|
339
335
|
var _categoryColors$get;
|
|
340
336
|
return _objectSpread(_objectSpread({}, payloadItem), {}, {
|
|
341
|
-
color: (_categoryColors$get = categoryColors.get(payloadItem.dataKey)) !== null && _categoryColors$get !== void 0 ? _categoryColors$get :
|
|
337
|
+
color: (_categoryColors$get = categoryColors.get(payloadItem.dataKey)) !== null && _categoryColors$get !== void 0 ? _categoryColors$get : cssVar.colorPrimary
|
|
342
338
|
});
|
|
343
339
|
}),
|
|
344
340
|
valueFormatter: valueFormatter
|
|
@@ -352,7 +348,7 @@ var BarChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
352
348
|
});
|
|
353
349
|
} : undefined,
|
|
354
350
|
cursor: {
|
|
355
|
-
fill:
|
|
351
|
+
fill: cssVar.colorFillTertiary
|
|
356
352
|
},
|
|
357
353
|
isAnimationActive: false,
|
|
358
354
|
position: {
|
|
@@ -376,7 +372,7 @@ var BarChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
376
372
|
var _categoryColors$get2;
|
|
377
373
|
return /*#__PURE__*/_jsx(Bar, {
|
|
378
374
|
animationDuration: animationDuration,
|
|
379
|
-
className: cx(css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n fill: ", ";\n "])), (_categoryColors$get2 = categoryColors.get(category)) !== null && _categoryColors$get2 !== void 0 ? _categoryColors$get2 :
|
|
375
|
+
className: cx(css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n fill: ", ";\n "])), (_categoryColors$get2 = categoryColors.get(category)) !== null && _categoryColors$get2 !== void 0 ? _categoryColors$get2 : cssVar.colorPrimary)),
|
|
380
376
|
dataKey: category,
|
|
381
377
|
fill: '',
|
|
382
378
|
isAnimationActive: showAnimation,
|
package/es/BarChart/styles.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
emphasis:
|
|
3
|
-
gridLines:
|
|
4
|
-
label:
|
|
5
|
-
strongLabel:
|
|
6
|
-
}
|
|
1
|
+
export declare const styles: {
|
|
2
|
+
emphasis: string;
|
|
3
|
+
gridLines: string;
|
|
4
|
+
label: string;
|
|
5
|
+
strongLabel: string;
|
|
6
|
+
};
|
package/es/BarChart/styles.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
-
import {
|
|
4
|
-
export var
|
|
3
|
+
import { createStaticStyles } from 'antd-style';
|
|
4
|
+
export var styles = createStaticStyles(function (_ref) {
|
|
5
5
|
var css = _ref.css,
|
|
6
|
-
|
|
6
|
+
cssVar = _ref.cssVar;
|
|
7
7
|
return {
|
|
8
8
|
emphasis: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n "]))),
|
|
9
|
-
gridLines: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n stroke: ", ";\n stroke-width: 1;\n "])),
|
|
10
|
-
label: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n font-size: 12px;\n line-height: 16px;\n fill: ", ";\n "])),
|
|
11
|
-
strongLabel: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n font-size: 12px;\n font-weight: 500;\n line-height: 16px;\n fill: ", ";\n "])),
|
|
9
|
+
gridLines: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n stroke: ", ";\n stroke-width: 1;\n "])), cssVar.colorBorderSecondary),
|
|
10
|
+
label: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n font-size: 12px;\n line-height: 16px;\n fill: ", ";\n "])), cssVar.colorTextDescription),
|
|
11
|
+
strongLabel: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n font-size: 12px;\n font-weight: 500;\n line-height: 16px;\n fill: ", ";\n "])), cssVar.colorTextSecondary)
|
|
12
12
|
};
|
|
13
13
|
});
|
package/es/BarList/index.js
CHANGED
|
@@ -17,18 +17,16 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
17
17
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
18
18
|
import { A, Flexbox } from '@lobehub/ui';
|
|
19
19
|
import { Skeleton } from 'antd';
|
|
20
|
+
import { cx } from 'antd-style';
|
|
20
21
|
import React, { forwardRef, useMemo } from 'react';
|
|
21
22
|
import NoData from "../common/NoData";
|
|
22
23
|
import { useThemeColorRange } from "../hooks/useThemeColorRange";
|
|
23
24
|
import { defaultValueFormatter } from "../utils";
|
|
24
|
-
import {
|
|
25
|
+
import { styles } from "./styles";
|
|
25
26
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
27
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
28
|
+
var prefixCls = 'ant';
|
|
27
29
|
var BarList = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
28
|
-
var _useStyles = useStyles(),
|
|
29
|
-
cx = _useStyles.cx,
|
|
30
|
-
styles = _useStyles.styles,
|
|
31
|
-
prefixCls = _useStyles.prefixCls;
|
|
32
30
|
var themeColorRange = useThemeColorRange();
|
|
33
31
|
var _props$data = props.data,
|
|
34
32
|
data = _props$data === void 0 ? [] : _props$data,
|
package/es/BarList/styles.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
bar:
|
|
3
|
-
barContainer:
|
|
4
|
-
barHover:
|
|
5
|
-
emphasis:
|
|
6
|
-
label:
|
|
7
|
-
sourceALabel:
|
|
8
|
-
sourceLabel:
|
|
9
|
-
strongLabel:
|
|
10
|
-
}
|
|
1
|
+
export declare const styles: {
|
|
2
|
+
bar: string;
|
|
3
|
+
barContainer: string;
|
|
4
|
+
barHover: string;
|
|
5
|
+
emphasis: string;
|
|
6
|
+
label: string;
|
|
7
|
+
sourceALabel: string;
|
|
8
|
+
sourceLabel: string;
|
|
9
|
+
strongLabel: string;
|
|
10
|
+
};
|
package/es/BarList/styles.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import { createStaticStyles } from 'antd-style';
|
|
4
|
+
var prefixCls = 'ant';
|
|
5
|
+
export var styles = createStaticStyles(function (_ref) {
|
|
6
|
+
var css = _ref.css,
|
|
7
|
+
cssVar = _ref.cssVar;
|
|
8
8
|
return {
|
|
9
|
-
bar: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n\n max-width: 100%;\n height: 100%;\n border-radius: ", "
|
|
9
|
+
bar: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n\n max-width: 100%;\n height: 100%;\n border-radius: ", ";\n\n opacity: 0.25;\n\n transition: all 0.25s ", ";\n "])), cssVar.borderRadius, cssVar.motionEaseInOut),
|
|
10
10
|
barContainer: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n "]))),
|
|
11
11
|
barHover: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n &:hover {\n .", "-chart-bar-item {\n opacity: 0.4;\n }\n }\n "])), prefixCls),
|
|
12
12
|
emphasis: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n "]))),
|
|
13
|
-
label: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n font-size: 12px;\n line-height: 16px;\n color: ", ";\n "])),
|
|
14
|
-
sourceALabel: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n font-size: 14px;\n line-height: 16px;\n color: ", " !important;\n\n &:hover {\n color: ", " !important;\n }\n "])),
|
|
15
|
-
sourceLabel: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n font-size: 14px;\n line-height: 16px;\n color: ", ";\n "])),
|
|
16
|
-
strongLabel: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n font-size: 14px;\n font-weight: 500;\n line-height: 16px;\n color: ", ";\n "])),
|
|
13
|
+
label: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n font-size: 12px;\n line-height: 16px;\n color: ", ";\n "])), cssVar.colorTextDescription),
|
|
14
|
+
sourceALabel: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n font-size: 14px;\n line-height: 16px;\n color: ", " !important;\n\n &:hover {\n color: ", " !important;\n }\n "])), cssVar.colorText, cssVar.colorLinkHover),
|
|
15
|
+
sourceLabel: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n font-size: 14px;\n line-height: 16px;\n color: ", ";\n "])), cssVar.colorText),
|
|
16
|
+
strongLabel: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n font-size: 14px;\n font-weight: 500;\n line-height: 16px;\n color: ", ";\n "])), cssVar.colorText)
|
|
17
17
|
};
|
|
18
18
|
});
|
|
@@ -17,10 +17,11 @@ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol
|
|
|
17
17
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
18
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
19
19
|
import { Flexbox, Tooltip } from '@lobehub/ui';
|
|
20
|
+
import { cssVar, cx } from 'antd-style';
|
|
20
21
|
import { forwardRef, memo, useMemo } from 'react';
|
|
21
22
|
import { useThemeColorRange } from "../hooks/useThemeColorRange";
|
|
22
23
|
import { defaultValueFormatter, sumNumericArray } from "../utils";
|
|
23
|
-
import {
|
|
24
|
+
import { styles } from "./styles";
|
|
24
25
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
26
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
27
|
var getMarkerBgColor = function getMarkerBgColor(markerValue, values, colors) {
|
|
@@ -50,9 +51,6 @@ var getPositionLeft = function getPositionLeft(value, maxValue) {
|
|
|
50
51
|
var BarLabels = /*#__PURE__*/memo(function (_ref) {
|
|
51
52
|
var values = _ref.values,
|
|
52
53
|
valueFormatter = _ref.valueFormatter;
|
|
53
|
-
var _useStyles = useStyles(),
|
|
54
|
-
cx = _useStyles.cx,
|
|
55
|
-
styles = _useStyles.styles;
|
|
56
54
|
var sumValues = useMemo(function () {
|
|
57
55
|
return sumNumericArray(values);
|
|
58
56
|
}, [values]);
|
|
@@ -108,10 +106,6 @@ var BarLabels = /*#__PURE__*/memo(function (_ref) {
|
|
|
108
106
|
});
|
|
109
107
|
});
|
|
110
108
|
var CategoryBar = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
111
|
-
var _useStyles2 = useStyles(),
|
|
112
|
-
cx = _useStyles2.cx,
|
|
113
|
-
styles = _useStyles2.styles,
|
|
114
|
-
theme = _useStyles2.theme;
|
|
115
109
|
var themeColorRange = useThemeColorRange();
|
|
116
110
|
var _props$values = props.values,
|
|
117
111
|
values = _props$values === void 0 ? [] : _props$values,
|
|
@@ -175,7 +169,7 @@ var CategoryBar = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
175
169
|
width: '100%',
|
|
176
170
|
children: values.map(function (value, idx) {
|
|
177
171
|
var _colorGroup$idx;
|
|
178
|
-
var baseColor = (_colorGroup$idx = colorGroup[idx]) !== null && _colorGroup$idx !== void 0 ? _colorGroup$idx :
|
|
172
|
+
var baseColor = (_colorGroup$idx = colorGroup[idx]) !== null && _colorGroup$idx !== void 0 ? _colorGroup$idx : cssVar.colorPrimary;
|
|
179
173
|
var percentage = value / maxValue * 100;
|
|
180
174
|
return /*#__PURE__*/_jsx(Flexbox, {
|
|
181
175
|
height: '100%',
|
|
@@ -193,7 +187,7 @@ var CategoryBar = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
193
187
|
children: /*#__PURE__*/_jsx("div", {
|
|
194
188
|
className: styles.marker,
|
|
195
189
|
style: {
|
|
196
|
-
background: markerBgColor ||
|
|
190
|
+
background: markerBgColor || cssVar.colorPrimary,
|
|
197
191
|
height: size + 8
|
|
198
192
|
}
|
|
199
193
|
})
|
package/es/DataBars/DeltaBar.js
CHANGED
|
@@ -10,20 +10,17 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
10
10
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
11
11
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
12
12
|
import { Flexbox, Tooltip } from '@lobehub/ui';
|
|
13
|
+
import { cssVar, cx } from 'antd-style';
|
|
13
14
|
import { forwardRef } from 'react';
|
|
14
15
|
import { DeltaTypes } from "../types/charts";
|
|
15
16
|
import { mapInputsToDeltaType } from "../utils";
|
|
16
|
-
import {
|
|
17
|
+
import { styles } from "./styles";
|
|
17
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
19
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
20
|
var getDeltaType = function getDeltaType(value) {
|
|
20
21
|
return value >= 0 ? DeltaTypes.Increase : DeltaTypes.Decrease;
|
|
21
22
|
};
|
|
22
23
|
var DeltaBar = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
23
|
-
var _useStyles = useStyles(),
|
|
24
|
-
cx = _useStyles.cx,
|
|
25
|
-
styles = _useStyles.styles,
|
|
26
|
-
theme = _useStyles.theme;
|
|
27
24
|
var value = props.value,
|
|
28
25
|
bgColors = props.bgColors,
|
|
29
26
|
color = props.color,
|
|
@@ -40,7 +37,7 @@ var DeltaBar = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
40
37
|
style = props.style,
|
|
41
38
|
rest = _objectWithoutProperties(props, _excluded);
|
|
42
39
|
var deltaType = mapInputsToDeltaType(getDeltaType(value), isIncreasePositive);
|
|
43
|
-
var colors = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, DeltaTypes.Increase,
|
|
40
|
+
var colors = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, DeltaTypes.Increase, cssVar.colorSuccess), DeltaTypes.ModerateIncrease, cssVar.colorSuccess), DeltaTypes.Decrease, cssVar.colorError), DeltaTypes.ModerateDecrease, cssVar.colorError), DeltaTypes.Unchanged, cssVar.colorWarning);
|
|
44
41
|
return /*#__PURE__*/_jsx(Tooltip, {
|
|
45
42
|
title: tooltip,
|
|
46
43
|
children: /*#__PURE__*/_jsxs(Flexbox, _objectSpread(_objectSpread({
|
|
@@ -57,7 +54,7 @@ var DeltaBar = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
57
54
|
children: [/*#__PURE__*/_jsx(Flexbox, {
|
|
58
55
|
height: '100%',
|
|
59
56
|
style: {
|
|
60
|
-
background: bgColors ||
|
|
57
|
+
background: bgColors || cssVar.colorFillTertiary,
|
|
61
58
|
borderRadius: size / 2,
|
|
62
59
|
inset: 0,
|
|
63
60
|
opacity: bgColors ? 0.2 : 1,
|
|
@@ -88,7 +85,7 @@ var DeltaBar = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
88
85
|
className: styles.marker,
|
|
89
86
|
flex: 'none',
|
|
90
87
|
style: {
|
|
91
|
-
background: color ||
|
|
88
|
+
background: color || cssVar.colorPrimary,
|
|
92
89
|
height: size + 8,
|
|
93
90
|
zIndex: 2
|
|
94
91
|
}
|