@coinbase/cds-web-visualization 3.4.0-beta.9 → 3.4.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 +126 -0
- package/dts/chart/CartesianChart.d.ts +40 -4
- package/dts/chart/CartesianChart.d.ts.map +1 -1
- package/dts/chart/ChartProvider.d.ts +3 -0
- package/dts/chart/ChartProvider.d.ts.map +1 -1
- package/dts/chart/Path.d.ts +51 -12
- package/dts/chart/Path.d.ts.map +1 -1
- package/dts/chart/PeriodSelector.d.ts +25 -4
- package/dts/chart/PeriodSelector.d.ts.map +1 -1
- package/dts/chart/area/Area.d.ts +13 -11
- package/dts/chart/area/Area.d.ts.map +1 -1
- package/dts/chart/area/AreaChart.d.ts +18 -5
- package/dts/chart/area/AreaChart.d.ts.map +1 -1
- package/dts/chart/area/DottedArea.d.ts.map +1 -1
- package/dts/chart/area/GradientArea.d.ts.map +1 -1
- package/dts/chart/area/SolidArea.d.ts.map +1 -1
- package/dts/chart/axis/Axis.d.ts +29 -29
- package/dts/chart/axis/Axis.d.ts.map +1 -1
- package/dts/chart/axis/XAxis.d.ts +6 -0
- package/dts/chart/axis/XAxis.d.ts.map +1 -1
- package/dts/chart/axis/YAxis.d.ts +2 -1
- package/dts/chart/axis/YAxis.d.ts.map +1 -1
- package/dts/chart/bar/Bar.d.ts +51 -51
- package/dts/chart/bar/Bar.d.ts.map +1 -1
- package/dts/chart/bar/BarChart.d.ts +29 -6
- package/dts/chart/bar/BarChart.d.ts.map +1 -1
- package/dts/chart/bar/BarPlot.d.ts +2 -1
- package/dts/chart/bar/BarPlot.d.ts.map +1 -1
- package/dts/chart/bar/BarStack.d.ts +58 -20
- package/dts/chart/bar/BarStack.d.ts.map +1 -1
- package/dts/chart/bar/BarStackGroup.d.ts +2 -1
- package/dts/chart/bar/BarStackGroup.d.ts.map +1 -1
- package/dts/chart/bar/DefaultBar.d.ts.map +1 -1
- package/dts/chart/bar/DefaultBarStack.d.ts.map +1 -1
- package/dts/chart/gradient/Gradient.d.ts +7 -0
- package/dts/chart/gradient/Gradient.d.ts.map +1 -1
- package/dts/chart/index.d.ts +1 -0
- package/dts/chart/index.d.ts.map +1 -1
- package/dts/chart/legend/DefaultLegendEntry.d.ts +21 -0
- package/dts/chart/legend/DefaultLegendEntry.d.ts.map +1 -0
- package/dts/chart/legend/DefaultLegendShape.d.ts +7 -0
- package/dts/chart/legend/DefaultLegendShape.d.ts.map +1 -0
- package/dts/chart/legend/Legend.d.ts +169 -0
- package/dts/chart/legend/Legend.d.ts.map +1 -0
- package/dts/chart/legend/index.d.ts +4 -0
- package/dts/chart/legend/index.d.ts.map +1 -0
- package/dts/chart/line/DottedLine.d.ts.map +1 -1
- package/dts/chart/line/Line.d.ts +45 -24
- package/dts/chart/line/Line.d.ts.map +1 -1
- package/dts/chart/line/LineChart.d.ts +5 -3
- package/dts/chart/line/LineChart.d.ts.map +1 -1
- package/dts/chart/line/ReferenceLine.d.ts +9 -0
- package/dts/chart/line/ReferenceLine.d.ts.map +1 -1
- package/dts/chart/line/SolidLine.d.ts.map +1 -1
- package/dts/chart/point/Point.d.ts +26 -2
- package/dts/chart/point/Point.d.ts.map +1 -1
- package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts +34 -17
- package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts.map +1 -1
- package/dts/chart/scrubber/DefaultScrubberBeaconLabel.d.ts.map +1 -1
- package/dts/chart/scrubber/DefaultScrubberLabel.d.ts +2 -1
- package/dts/chart/scrubber/DefaultScrubberLabel.d.ts.map +1 -1
- package/dts/chart/scrubber/Scrubber.d.ts +148 -46
- package/dts/chart/scrubber/Scrubber.d.ts.map +1 -1
- package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts +10 -0
- package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts.map +1 -1
- package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts +25 -1
- package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts.map +1 -1
- package/dts/chart/scrubber/ScrubberProvider.d.ts.map +1 -1
- package/dts/chart/text/ChartText.d.ts.map +1 -1
- package/dts/chart/utils/axis.d.ts +48 -9
- package/dts/chart/utils/axis.d.ts.map +1 -1
- package/dts/chart/utils/bar.d.ts +188 -0
- package/dts/chart/utils/bar.d.ts.map +1 -1
- package/dts/chart/utils/chart.d.ts +32 -0
- package/dts/chart/utils/chart.d.ts.map +1 -1
- package/dts/chart/utils/context.d.ts +20 -4
- package/dts/chart/utils/context.d.ts.map +1 -1
- package/dts/chart/utils/gradient.d.ts +3 -1
- package/dts/chart/utils/gradient.d.ts.map +1 -1
- package/dts/chart/utils/path.d.ts +26 -0
- package/dts/chart/utils/path.d.ts.map +1 -1
- package/dts/chart/utils/point.d.ts +18 -7
- package/dts/chart/utils/point.d.ts.map +1 -1
- package/dts/chart/utils/scale.d.ts +11 -0
- package/dts/chart/utils/scale.d.ts.map +1 -1
- package/dts/chart/utils/scrubber.d.ts +2 -1
- package/dts/chart/utils/scrubber.d.ts.map +1 -1
- package/dts/chart/utils/transition.d.ts +50 -14
- package/dts/chart/utils/transition.d.ts.map +1 -1
- package/dts/sparkline/Sparkline.d.ts +2 -1
- package/dts/sparkline/Sparkline.d.ts.map +1 -1
- package/dts/sparkline/SparklineArea.d.ts +2 -1
- package/dts/sparkline/SparklineArea.d.ts.map +1 -1
- package/dts/sparkline/SparklineGradient.d.ts +2 -1
- package/dts/sparkline/SparklineGradient.d.ts.map +1 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractive.d.ts +2 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractive.d.ts.map +1 -1
- package/esm/chart/CartesianChart.js +154 -90
- package/esm/chart/ChartProvider.js +2 -2
- package/esm/chart/Path.js +35 -19
- package/esm/chart/PeriodSelector.js +33 -15
- package/esm/chart/area/Area.js +21 -9
- package/esm/chart/area/AreaChart.js +28 -25
- package/esm/chart/area/DottedArea.js +18 -9
- package/esm/chart/area/GradientArea.js +16 -8
- package/esm/chart/area/SolidArea.js +8 -3
- package/esm/chart/axis/Axis.js +3 -17
- package/esm/chart/axis/XAxis.js +153 -50
- package/esm/chart/axis/YAxis.js +146 -36
- package/esm/chart/bar/Bar.js +16 -8
- package/esm/chart/bar/BarChart.js +38 -33
- package/esm/chart/bar/BarPlot.js +20 -25
- package/esm/chart/bar/BarStack.js +109 -505
- package/esm/chart/bar/BarStackGroup.js +36 -27
- package/esm/chart/bar/DefaultBar.js +34 -26
- package/esm/chart/bar/DefaultBarStack.js +31 -18
- package/esm/chart/gradient/Gradient.js +3 -2
- package/esm/chart/index.js +1 -0
- package/esm/chart/legend/DefaultLegendEntry.css +1 -0
- package/esm/chart/legend/DefaultLegendEntry.js +50 -0
- package/esm/chart/legend/DefaultLegendShape.css +5 -0
- package/esm/chart/legend/DefaultLegendShape.js +47 -0
- package/esm/chart/legend/Legend.js +76 -0
- package/esm/chart/legend/index.js +3 -0
- package/esm/chart/line/DottedLine.js +7 -2
- package/esm/chart/line/Line.js +41 -42
- package/esm/chart/line/LineChart.js +18 -13
- package/esm/chart/line/ReferenceLine.js +6 -2
- package/esm/chart/line/SolidLine.js +8 -3
- package/esm/chart/point/Point.js +41 -24
- package/esm/chart/scrubber/DefaultScrubberBeacon.js +64 -65
- package/esm/chart/scrubber/DefaultScrubberBeaconLabel.js +25 -14
- package/esm/chart/scrubber/DefaultScrubberLabel.js +26 -8
- package/esm/chart/scrubber/Scrubber.js +54 -43
- package/esm/chart/scrubber/ScrubberBeaconGroup.js +60 -35
- package/esm/chart/scrubber/ScrubberBeaconLabelGroup.js +31 -8
- package/esm/chart/scrubber/ScrubberProvider.js +44 -39
- package/esm/chart/text/ChartText.js +3 -2
- package/esm/chart/utils/axis.js +90 -43
- package/esm/chart/utils/bar.js +863 -0
- package/esm/chart/utils/chart.js +34 -7
- package/esm/chart/utils/context.js +7 -0
- package/esm/chart/utils/gradient.js +6 -4
- package/esm/chart/utils/path.js +88 -61
- package/esm/chart/utils/point.js +57 -30
- package/esm/chart/utils/scale.js +13 -2
- package/esm/chart/utils/scrubber.js +9 -4
- package/esm/chart/utils/transition.js +68 -41
- package/esm/sparkline/Sparkline.js +2 -1
- package/esm/sparkline/SparklineArea.js +2 -1
- package/esm/sparkline/SparklineGradient.js +2 -1
- package/esm/sparkline/__figma__/Sparkline.figma.js +1 -1
- package/esm/sparkline/sparkline-interactive/SparklineInteractive.js +2 -1
- package/esm/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.js +1 -1
- package/esm/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.js +1 -1
- package/package.json +8 -7
package/esm/chart/Path.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const _excluded = ["d", "
|
|
2
|
-
_excluded2 = ["animate", "clipRect", "clipOffset", "d", "transition"];
|
|
1
|
+
const _excluded = ["d", "initialPath", "transitions"],
|
|
2
|
+
_excluded2 = ["animate", "clipRect", "clipOffset", "d", "transitions", "transition"];
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -9,23 +9,28 @@ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i
|
|
|
9
9
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
10
10
|
import { memo, useId, useMemo } from 'react';
|
|
11
11
|
import { m as motion } from 'framer-motion';
|
|
12
|
-
import {
|
|
12
|
+
import { defaultPathEnterTransition } from './utils/path';
|
|
13
|
+
import { defaultTransition, getTransition, usePathTransition } from './utils/transition';
|
|
13
14
|
import { useCartesianChartContext } from './ChartProvider';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Duration in seconds for path enter transition.
|
|
18
|
+
* @deprecated Use `transitions.enter` on the Path component instead. This will be removed in a future major release.
|
|
19
|
+
* @deprecationExpectedRemoval v4
|
|
17
20
|
*/
|
|
18
21
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
22
|
export const pathEnterTransitionDuration = 0.5;
|
|
20
23
|
const AnimatedPath = /*#__PURE__*/memo(_ref => {
|
|
21
24
|
let {
|
|
22
25
|
d = '',
|
|
23
|
-
|
|
26
|
+
initialPath,
|
|
27
|
+
transitions
|
|
24
28
|
} = _ref,
|
|
25
29
|
pathProps = _objectWithoutProperties(_ref, _excluded);
|
|
26
30
|
const interpolatedPath = usePathTransition({
|
|
27
31
|
currentPath: d,
|
|
28
|
-
|
|
32
|
+
initialPath,
|
|
33
|
+
transitions
|
|
29
34
|
});
|
|
30
35
|
return /*#__PURE__*/_jsx(motion.path, _objectSpread({
|
|
31
36
|
d: interpolatedPath
|
|
@@ -37,6 +42,7 @@ export const Path = /*#__PURE__*/memo(_ref2 => {
|
|
|
37
42
|
clipRect,
|
|
38
43
|
clipOffset = 0,
|
|
39
44
|
d = '',
|
|
45
|
+
transitions,
|
|
40
46
|
transition
|
|
41
47
|
} = _ref2,
|
|
42
48
|
pathProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
@@ -44,6 +50,10 @@ export const Path = /*#__PURE__*/memo(_ref2 => {
|
|
|
44
50
|
const context = useCartesianChartContext();
|
|
45
51
|
const rect = clipRect !== undefined ? clipRect : context.drawingArea;
|
|
46
52
|
const animate = animateProp !== null && animateProp !== void 0 ? animateProp : context.animate;
|
|
53
|
+
const clipPath = rect !== null ? "url(#".concat(clipPathId, ")") : undefined;
|
|
54
|
+
const enterTransition = useMemo(() => getTransition(transitions === null || transitions === void 0 ? void 0 : transitions.enter, animate, defaultPathEnterTransition), [animate, transitions === null || transitions === void 0 ? void 0 : transitions.enter]);
|
|
55
|
+
const updateTransition = useMemo(() => getTransition((transitions === null || transitions === void 0 ? void 0 : transitions.update) !== undefined ? transitions.update : transition, animate, defaultTransition), [animate, transitions === null || transitions === void 0 ? void 0 : transitions.update, transition]);
|
|
56
|
+
const shouldAnimateClip = animate && enterTransition !== null;
|
|
47
57
|
|
|
48
58
|
// The clip offset provides extra padding to prevent path from being cut off
|
|
49
59
|
// Area charts typically use offset=0 for exact clipping, while lines use offset=2 for breathing room
|
|
@@ -51,44 +61,50 @@ export const Path = /*#__PURE__*/memo(_ref2 => {
|
|
|
51
61
|
|
|
52
62
|
const clipPathAnimation = useMemo(() => {
|
|
53
63
|
if (rect === null) return;
|
|
64
|
+
const categoryAxisIsX = context.layout !== 'horizontal';
|
|
65
|
+
const fullWidth = rect.width + totalOffset;
|
|
66
|
+
const fullHeight = rect.height + totalOffset;
|
|
54
67
|
return {
|
|
55
68
|
hidden: {
|
|
56
|
-
width: 0
|
|
69
|
+
width: categoryAxisIsX ? 0 : fullWidth,
|
|
70
|
+
height: categoryAxisIsX ? fullHeight : 0
|
|
57
71
|
},
|
|
58
72
|
visible: {
|
|
59
|
-
width:
|
|
73
|
+
width: fullWidth,
|
|
74
|
+
height: fullHeight,
|
|
60
75
|
transition: {
|
|
61
76
|
type: 'timing',
|
|
62
77
|
duration: pathEnterTransitionDuration
|
|
63
78
|
}
|
|
64
79
|
}
|
|
65
80
|
};
|
|
66
|
-
}, [rect, totalOffset]);
|
|
81
|
+
}, [rect, totalOffset, context.layout]);
|
|
67
82
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
68
83
|
children: [rect !== null && /*#__PURE__*/_jsx("defs", {
|
|
69
84
|
children: /*#__PURE__*/_jsx("clipPath", {
|
|
70
85
|
id: clipPathId,
|
|
71
|
-
children:
|
|
86
|
+
children: shouldAnimateClip ? /*#__PURE__*/_jsx(motion.rect, {
|
|
87
|
+
animate: "visible",
|
|
72
88
|
height: rect.height + totalOffset,
|
|
89
|
+
initial: "hidden",
|
|
90
|
+
variants: clipPathAnimation,
|
|
73
91
|
width: rect.width + totalOffset,
|
|
74
92
|
x: rect.x - clipOffset,
|
|
75
93
|
y: rect.y - clipOffset
|
|
76
|
-
}) : /*#__PURE__*/_jsx(
|
|
77
|
-
animate: "visible",
|
|
94
|
+
}) : /*#__PURE__*/_jsx("rect", {
|
|
78
95
|
height: rect.height + totalOffset,
|
|
79
|
-
|
|
80
|
-
variants: clipPathAnimation,
|
|
96
|
+
width: rect.width + totalOffset,
|
|
81
97
|
x: rect.x - clipOffset,
|
|
82
98
|
y: rect.y - clipOffset
|
|
83
99
|
})
|
|
84
100
|
})
|
|
85
|
-
}),
|
|
86
|
-
clipPath:
|
|
87
|
-
d: d
|
|
88
|
-
}, pathProps)) : /*#__PURE__*/_jsx(AnimatedPath, _objectSpread({
|
|
89
|
-
clipPath: "url(#".concat(clipPathId, ")"),
|
|
101
|
+
}), /*#__PURE__*/_jsx(AnimatedPath, _objectSpread({
|
|
102
|
+
clipPath: clipPath,
|
|
90
103
|
d: d,
|
|
91
|
-
|
|
104
|
+
transitions: {
|
|
105
|
+
enter: enterTransition,
|
|
106
|
+
update: updateTransition
|
|
107
|
+
}
|
|
92
108
|
}, pathProps))]
|
|
93
109
|
});
|
|
94
110
|
});
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
const _excluded = ["
|
|
2
|
-
_excluded2 = ["
|
|
3
|
-
|
|
4
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
1
|
+
const _excluded = ["activeTabRect", "background", "position", "borderRadius", "style"],
|
|
2
|
+
_excluded2 = ["as", "color", "label", "display", "alignItems", "font", "hideDot"],
|
|
3
|
+
_excluded3 = ["background", "activeBackground", "width", "justifyContent", "TabComponent", "TabsActiveIndicatorComponent", "className", "classNames", "style", "styles"];
|
|
5
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
6
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
8
7
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
9
8
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
10
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
10
11
|
import React, { forwardRef, memo, useMemo } from 'react';
|
|
12
|
+
import { cx } from '@coinbase/cds-web';
|
|
11
13
|
import { Box } from '@coinbase/cds-web/layout';
|
|
12
14
|
import { SegmentedTabs, tabsTransitionConfig } from '@coinbase/cds-web/tabs';
|
|
13
15
|
import { SegmentedTab } from '@coinbase/cds-web/tabs/SegmentedTab';
|
|
@@ -19,12 +21,13 @@ const MotionBox = motion(Box);
|
|
|
19
21
|
// Animated active indicator to support smooth transition of background color
|
|
20
22
|
export const PeriodSelectorActiveIndicator = /*#__PURE__*/memo(_ref => {
|
|
21
23
|
let {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
activeTabRect,
|
|
25
|
+
background = 'bgPrimaryWash',
|
|
26
|
+
position = 'absolute',
|
|
27
|
+
borderRadius = 1000,
|
|
28
|
+
style
|
|
29
|
+
} = _ref,
|
|
30
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
28
31
|
const {
|
|
29
32
|
width,
|
|
30
33
|
height,
|
|
@@ -35,12 +38,13 @@ export const PeriodSelectorActiveIndicator = /*#__PURE__*/memo(_ref => {
|
|
|
35
38
|
x
|
|
36
39
|
}), [width, x]);
|
|
37
40
|
if (!width) return null;
|
|
38
|
-
return /*#__PURE__*/_jsx(MotionBox, {
|
|
41
|
+
return /*#__PURE__*/_jsx(MotionBox, _objectSpread({
|
|
39
42
|
animate: activeAnimation,
|
|
40
43
|
borderRadius: borderRadius,
|
|
41
44
|
"data-testid": "period-selector-active-indicator",
|
|
42
45
|
height: height,
|
|
43
46
|
initial: false,
|
|
47
|
+
left: 0,
|
|
44
48
|
position: position,
|
|
45
49
|
role: "none",
|
|
46
50
|
style: _objectSpread({
|
|
@@ -48,7 +52,7 @@ export const PeriodSelectorActiveIndicator = /*#__PURE__*/memo(_ref => {
|
|
|
48
52
|
transition: 'background-color 0.2s ease'
|
|
49
53
|
}, style),
|
|
50
54
|
transition: tabsTransitionConfig
|
|
51
|
-
});
|
|
55
|
+
}, props));
|
|
52
56
|
});
|
|
53
57
|
export const liveTabLabelDefaultElement = 'span';
|
|
54
58
|
// is this bad to use var(--space-1) for height and width?
|
|
@@ -63,7 +67,7 @@ export const LiveTabLabel = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref2, re
|
|
|
63
67
|
font = 'label1',
|
|
64
68
|
hideDot
|
|
65
69
|
} = _ref2,
|
|
66
|
-
props = _objectWithoutProperties(_ref2,
|
|
70
|
+
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
67
71
|
const Component = as !== null && as !== void 0 ? as : liveTabLabelDefaultElement;
|
|
68
72
|
return /*#__PURE__*/_jsxs(Text, _objectSpread(_objectSpread({
|
|
69
73
|
ref: ref,
|
|
@@ -96,16 +100,30 @@ export const PeriodSelector = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref3,
|
|
|
96
100
|
width = '100%',
|
|
97
101
|
justifyContent = 'space-between',
|
|
98
102
|
TabComponent = PeriodSelectorTab,
|
|
99
|
-
TabsActiveIndicatorComponent = PeriodSelectorActiveIndicator
|
|
103
|
+
TabsActiveIndicatorComponent = PeriodSelectorActiveIndicator,
|
|
104
|
+
className,
|
|
105
|
+
classNames,
|
|
106
|
+
style,
|
|
107
|
+
styles
|
|
100
108
|
} = _ref3,
|
|
101
|
-
props = _objectWithoutProperties(_ref3,
|
|
109
|
+
props = _objectWithoutProperties(_ref3, _excluded3);
|
|
102
110
|
return /*#__PURE__*/_jsx(SegmentedTabs, _objectSpread({
|
|
103
111
|
ref: ref,
|
|
104
112
|
TabComponent: TabComponent,
|
|
105
113
|
TabsActiveIndicatorComponent: TabsActiveIndicatorComponent,
|
|
106
114
|
activeBackground: activeBackground,
|
|
107
115
|
background: background,
|
|
116
|
+
className: cx(className, classNames === null || classNames === void 0 ? void 0 : classNames.root),
|
|
117
|
+
classNames: {
|
|
118
|
+
tab: classNames === null || classNames === void 0 ? void 0 : classNames.tab,
|
|
119
|
+
activeIndicator: classNames === null || classNames === void 0 ? void 0 : classNames.activeIndicator
|
|
120
|
+
},
|
|
108
121
|
justifyContent: justifyContent,
|
|
122
|
+
style: styles !== null && styles !== void 0 && styles.root ? _objectSpread(_objectSpread({}, style), styles.root) : style,
|
|
123
|
+
styles: {
|
|
124
|
+
tab: styles === null || styles === void 0 ? void 0 : styles.tab,
|
|
125
|
+
activeIndicator: styles === null || styles === void 0 ? void 0 : styles.activeIndicator
|
|
126
|
+
},
|
|
109
127
|
width: width
|
|
110
128
|
}, props));
|
|
111
129
|
}));
|
package/esm/chart/area/Area.js
CHANGED
|
@@ -16,37 +16,47 @@ export const Area = /*#__PURE__*/memo(_ref => {
|
|
|
16
16
|
baseline,
|
|
17
17
|
connectNulls,
|
|
18
18
|
gradient: gradientProp,
|
|
19
|
+
transitions,
|
|
19
20
|
transition,
|
|
20
21
|
animate
|
|
21
22
|
} = _ref;
|
|
22
23
|
const {
|
|
24
|
+
layout,
|
|
23
25
|
getSeries,
|
|
24
26
|
getSeriesData,
|
|
25
27
|
getXScale,
|
|
26
28
|
getYScale,
|
|
27
|
-
getXAxis
|
|
29
|
+
getXAxis,
|
|
30
|
+
getYAxis
|
|
28
31
|
} = useCartesianChartContext();
|
|
29
32
|
const matchedSeries = useMemo(() => getSeries(seriesId), [seriesId, getSeries]);
|
|
30
33
|
const gradient = useMemo(() => gradientProp !== null && gradientProp !== void 0 ? gradientProp : matchedSeries === null || matchedSeries === void 0 ? void 0 : matchedSeries.gradient, [gradientProp, matchedSeries === null || matchedSeries === void 0 ? void 0 : matchedSeries.gradient]);
|
|
31
34
|
const fill = useMemo(() => fillProp !== null && fillProp !== void 0 ? fillProp : matchedSeries === null || matchedSeries === void 0 ? void 0 : matchedSeries.color, [fillProp, matchedSeries === null || matchedSeries === void 0 ? void 0 : matchedSeries.color]);
|
|
32
35
|
const sourceData = useMemo(() => getSeriesData(seriesId), [seriesId, getSeriesData]);
|
|
33
|
-
const xAxis = getXAxis();
|
|
34
|
-
const xScale = getXScale();
|
|
36
|
+
const xAxis = getXAxis(matchedSeries === null || matchedSeries === void 0 ? void 0 : matchedSeries.xAxisId);
|
|
37
|
+
const xScale = getXScale(matchedSeries === null || matchedSeries === void 0 ? void 0 : matchedSeries.xAxisId);
|
|
35
38
|
const yScale = getYScale(matchedSeries === null || matchedSeries === void 0 ? void 0 : matchedSeries.yAxisId);
|
|
39
|
+
const yAxis = getYAxis(matchedSeries === null || matchedSeries === void 0 ? void 0 : matchedSeries.yAxisId);
|
|
40
|
+
const categoryAxisIsX = useMemo(() => {
|
|
41
|
+
return layout !== 'horizontal';
|
|
42
|
+
}, [layout]);
|
|
43
|
+
const categoryAxis = useMemo(() => {
|
|
44
|
+
return categoryAxisIsX ? xAxis : yAxis;
|
|
45
|
+
}, [categoryAxisIsX, xAxis, yAxis]);
|
|
36
46
|
const area = useMemo(() => {
|
|
37
47
|
if (!sourceData || sourceData.length === 0 || !xScale || !yScale) return '';
|
|
38
|
-
|
|
39
|
-
// Get numeric x-axis data if available
|
|
40
|
-
const xData = xAxis !== null && xAxis !== void 0 && xAxis.data && Array.isArray(xAxis.data) && typeof xAxis.data[0] === 'number' ? xAxis.data : undefined;
|
|
48
|
+
const indexData = categoryAxis !== null && categoryAxis !== void 0 && categoryAxis.data && Array.isArray(categoryAxis.data) && typeof categoryAxis.data[0] === 'number' ? categoryAxis.data : undefined;
|
|
41
49
|
return getAreaPath({
|
|
42
50
|
data: sourceData,
|
|
43
51
|
xScale,
|
|
44
52
|
yScale,
|
|
45
53
|
curve,
|
|
46
|
-
xData,
|
|
47
|
-
|
|
54
|
+
xData: categoryAxisIsX ? indexData : undefined,
|
|
55
|
+
yData: !categoryAxisIsX ? indexData : undefined,
|
|
56
|
+
connectNulls,
|
|
57
|
+
layout
|
|
48
58
|
});
|
|
49
|
-
}, [sourceData, xScale, yScale, curve,
|
|
59
|
+
}, [sourceData, xScale, yScale, curve, categoryAxis, categoryAxisIsX, connectNulls, layout]);
|
|
50
60
|
const AreaComponent = useMemo(() => {
|
|
51
61
|
if (AreaComponentProp) {
|
|
52
62
|
return AreaComponentProp;
|
|
@@ -70,6 +80,8 @@ export const Area = /*#__PURE__*/memo(_ref => {
|
|
|
70
80
|
fillOpacity: fillOpacity,
|
|
71
81
|
gradient: gradient,
|
|
72
82
|
transition: transition,
|
|
83
|
+
transitions: transitions,
|
|
84
|
+
xAxisId: matchedSeries === null || matchedSeries === void 0 ? void 0 : matchedSeries.xAxisId,
|
|
73
85
|
yAxisId: matchedSeries === null || matchedSeries === void 0 ? void 0 : matchedSeries.yAxisId
|
|
74
86
|
});
|
|
75
87
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const _excluded = ["series", "stacked", "AreaComponent", "curve", "fillOpacity", "type", "connectNulls", "transition", "LineComponent", "strokeWidth", "showXAxis", "showYAxis", "showLines", "lineType", "xAxis", "yAxis", "inset", "children"],
|
|
2
|
-
_excluded2 = ["scaleType", "data", "categoryPadding", "domain", "domainLimit", "range"],
|
|
1
|
+
const _excluded = ["series", "stacked", "AreaComponent", "curve", "fillOpacity", "type", "connectNulls", "transitions", "transition", "LineComponent", "strokeWidth", "showXAxis", "showYAxis", "showLines", "lineType", "xAxis", "yAxis", "inset", "children"],
|
|
2
|
+
_excluded2 = ["scaleType", "data", "categoryPadding", "domain", "domainLimit", "range", "id"],
|
|
3
3
|
_excluded3 = ["scaleType", "data", "categoryPadding", "domain", "domainLimit", "range", "id"],
|
|
4
|
-
_excluded4 = ["id", "data", "label", "color", "yAxisId", "opacity", "LineComponent", "stackId", "
|
|
5
|
-
_excluded5 = ["id", "data", "label", "color", "yAxisId", "fill", "fillOpacity", "stackId", "
|
|
4
|
+
_excluded4 = ["id", "data", "label", "color", "yAxisId", "opacity", "LineComponent", "stackId", "legendShape"],
|
|
5
|
+
_excluded5 = ["id", "data", "label", "color", "yAxisId", "fill", "fillOpacity", "stackId", "legendShape", "type"];
|
|
6
6
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
8
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -14,7 +14,7 @@ import { forwardRef, memo, useMemo } from 'react';
|
|
|
14
14
|
import { XAxis, YAxis } from '../axis';
|
|
15
15
|
import { CartesianChart } from '../CartesianChart';
|
|
16
16
|
import { Line } from '../line/Line';
|
|
17
|
-
import {
|
|
17
|
+
import { defaultStackId } from '../utils';
|
|
18
18
|
import { Area } from './Area';
|
|
19
19
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
20
|
export const AreaChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
|
|
@@ -26,6 +26,7 @@ export const AreaChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) =
|
|
|
26
26
|
fillOpacity,
|
|
27
27
|
type,
|
|
28
28
|
connectNulls,
|
|
29
|
+
transitions,
|
|
29
30
|
transition,
|
|
30
31
|
LineComponent,
|
|
31
32
|
strokeWidth,
|
|
@@ -39,8 +40,6 @@ export const AreaChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) =
|
|
|
39
40
|
children
|
|
40
41
|
} = _ref,
|
|
41
42
|
chartProps = _objectWithoutProperties(_ref, _excluded);
|
|
42
|
-
const calculatedInset = useMemo(() => getChartInset(inset, defaultChartInset), [inset]);
|
|
43
|
-
|
|
44
43
|
// Convert AreaSeries to Series for Chart context
|
|
45
44
|
const chartSeries = useMemo(() => {
|
|
46
45
|
return series === null || series === void 0 ? void 0 : series.map(s => ({
|
|
@@ -48,6 +47,7 @@ export const AreaChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) =
|
|
|
48
47
|
data: s.data,
|
|
49
48
|
label: s.label,
|
|
50
49
|
color: s.color,
|
|
50
|
+
xAxisId: s.xAxisId,
|
|
51
51
|
yAxisId: s.yAxisId,
|
|
52
52
|
stackId: s.stackId,
|
|
53
53
|
gradient: s.gradient
|
|
@@ -72,7 +72,8 @@ export const AreaChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) =
|
|
|
72
72
|
categoryPadding: xCategoryPadding,
|
|
73
73
|
domain: xDomain,
|
|
74
74
|
domainLimit: xDomainLimit,
|
|
75
|
-
range: xRange
|
|
75
|
+
range: xRange,
|
|
76
|
+
id: xAxisId
|
|
76
77
|
} = _ref2,
|
|
77
78
|
xAxisVisualProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
78
79
|
const _ref3 = yAxis || {},
|
|
@@ -86,6 +87,13 @@ export const AreaChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) =
|
|
|
86
87
|
id: yAxisId
|
|
87
88
|
} = _ref3,
|
|
88
89
|
yAxisVisualProps = _objectWithoutProperties(_ref3, _excluded3);
|
|
90
|
+
const hasNegativeValues = useMemo(() => {
|
|
91
|
+
if (!series) return false;
|
|
92
|
+
return series.some(s => {
|
|
93
|
+
var _s$data;
|
|
94
|
+
return (_s$data = s.data) === null || _s$data === void 0 ? void 0 : _s$data.some(value => typeof value === 'number' && value < 0 || Array.isArray(value) && value.some(v => typeof v === 'number' && v < 0));
|
|
95
|
+
});
|
|
96
|
+
}, [series]);
|
|
89
97
|
const xAxisConfig = {
|
|
90
98
|
scaleType: xScaleType,
|
|
91
99
|
data: xData,
|
|
@@ -94,13 +102,6 @@ export const AreaChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) =
|
|
|
94
102
|
domainLimit: xDomainLimit,
|
|
95
103
|
range: xRange
|
|
96
104
|
};
|
|
97
|
-
const hasNegativeValues = useMemo(() => {
|
|
98
|
-
if (!series) return false;
|
|
99
|
-
return series.some(s => {
|
|
100
|
-
var _s$data;
|
|
101
|
-
return (_s$data = s.data) === null || _s$data === void 0 ? void 0 : _s$data.some(value => typeof value === 'number' && value < 0 || Array.isArray(value) && value.some(v => typeof v === 'number' && v < 0));
|
|
102
|
-
});
|
|
103
|
-
}, [series]);
|
|
104
105
|
|
|
105
106
|
// Set default min domain to 0 for area chart, but only if there are no negative values
|
|
106
107
|
const yAxisConfig = {
|
|
@@ -115,11 +116,13 @@ export const AreaChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) =
|
|
|
115
116
|
};
|
|
116
117
|
return /*#__PURE__*/_jsxs(CartesianChart, _objectSpread(_objectSpread({}, chartProps), {}, {
|
|
117
118
|
ref: ref,
|
|
118
|
-
inset:
|
|
119
|
+
inset: inset,
|
|
119
120
|
series: seriesToRender,
|
|
120
121
|
xAxis: xAxisConfig,
|
|
121
122
|
yAxis: yAxisConfig,
|
|
122
|
-
children: [showXAxis && /*#__PURE__*/_jsx(XAxis, _objectSpread({
|
|
123
|
+
children: [showXAxis && /*#__PURE__*/_jsx(XAxis, _objectSpread({
|
|
124
|
+
axisId: xAxisId
|
|
125
|
+
}, xAxisVisualProps)), showYAxis && /*#__PURE__*/_jsx(YAxis, _objectSpread({
|
|
123
126
|
axisId: yAxisId
|
|
124
127
|
}, yAxisVisualProps)), series === null || series === void 0 ? void 0 : series.map(_ref4 => {
|
|
125
128
|
let {
|
|
@@ -131,7 +134,7 @@ export const AreaChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) =
|
|
|
131
134
|
opacity,
|
|
132
135
|
LineComponent,
|
|
133
136
|
stackId,
|
|
134
|
-
|
|
137
|
+
legendShape
|
|
135
138
|
} = _ref4,
|
|
136
139
|
areaPropsFromSeries = _objectWithoutProperties(_ref4, _excluded4);
|
|
137
140
|
return /*#__PURE__*/_jsx(Area, _objectSpread({
|
|
@@ -140,7 +143,8 @@ export const AreaChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) =
|
|
|
140
143
|
curve: curve,
|
|
141
144
|
fillOpacity: fillOpacity,
|
|
142
145
|
seriesId: id,
|
|
143
|
-
transition:
|
|
146
|
+
transition: transition,
|
|
147
|
+
transitions: transitions,
|
|
144
148
|
type: type
|
|
145
149
|
}, areaPropsFromSeries), id);
|
|
146
150
|
}), showLines && (series === null || series === void 0 ? void 0 : series.map(_ref5 => {
|
|
@@ -153,10 +157,8 @@ export const AreaChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) =
|
|
|
153
157
|
fill,
|
|
154
158
|
fillOpacity,
|
|
155
159
|
stackId,
|
|
156
|
-
|
|
157
|
-
// Area type (don't pass to Line)
|
|
158
|
-
lineType: seriesLineType,
|
|
159
|
-
transition: seriesTransition
|
|
160
|
+
legendShape,
|
|
161
|
+
type // Area type (don't pass to Line)
|
|
160
162
|
} = _ref5,
|
|
161
163
|
otherPropsFromSeries = _objectWithoutProperties(_ref5, _excluded5);
|
|
162
164
|
return /*#__PURE__*/_jsx(Line, _objectSpread({
|
|
@@ -165,8 +167,9 @@ export const AreaChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) =
|
|
|
165
167
|
curve: curve,
|
|
166
168
|
seriesId: id,
|
|
167
169
|
strokeWidth: strokeWidth,
|
|
168
|
-
transition:
|
|
169
|
-
|
|
170
|
+
transition: transition,
|
|
171
|
+
transitions: transitions,
|
|
172
|
+
type: lineType
|
|
170
173
|
}, otherPropsFromSeries), id);
|
|
171
174
|
})), children]
|
|
172
175
|
}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["d", "fill", "patternSize", "dotSize", "peakOpacity", "baselineOpacity", "baseline", "yAxisId", "gradient", "animate", "transition"];
|
|
1
|
+
const _excluded = ["d", "fill", "patternSize", "dotSize", "peakOpacity", "baselineOpacity", "baseline", "xAxisId", "yAxisId", "gradient", "animate", "transitions", "transition"];
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -18,6 +18,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
18
18
|
* on the fill color and peak/baseline opacities.
|
|
19
19
|
*/
|
|
20
20
|
export const DottedArea = /*#__PURE__*/memo(_ref => {
|
|
21
|
+
var _transitions$update;
|
|
21
22
|
let {
|
|
22
23
|
d,
|
|
23
24
|
fill = 'var(--color-fgPrimary)',
|
|
@@ -26,26 +27,31 @@ export const DottedArea = /*#__PURE__*/memo(_ref => {
|
|
|
26
27
|
peakOpacity = 1,
|
|
27
28
|
baselineOpacity = 0,
|
|
28
29
|
baseline,
|
|
30
|
+
xAxisId,
|
|
29
31
|
yAxisId,
|
|
30
32
|
gradient: gradientProp,
|
|
31
33
|
animate,
|
|
34
|
+
transitions,
|
|
32
35
|
transition
|
|
33
36
|
} = _ref,
|
|
34
37
|
pathProps = _objectWithoutProperties(_ref, _excluded);
|
|
35
38
|
const {
|
|
39
|
+
layout,
|
|
40
|
+
getXAxis,
|
|
36
41
|
getYAxis
|
|
37
42
|
} = useCartesianChartContext();
|
|
38
43
|
const patternId = useId();
|
|
39
44
|
const gradientId = useId();
|
|
40
45
|
const maskId = useId();
|
|
41
46
|
const dotCenterPosition = patternSize / 2;
|
|
42
|
-
const
|
|
47
|
+
const valueAxisConfig = layout !== 'horizontal' ? getYAxis(yAxisId) : getXAxis(xAxisId);
|
|
48
|
+
const gradientAxis = layout !== 'horizontal' ? 'y' : 'x';
|
|
43
49
|
const gradient = useMemo(() => {
|
|
44
50
|
if (gradientProp) return gradientProp;
|
|
45
|
-
if (!
|
|
46
|
-
const baselineValue = getBaseline(
|
|
47
|
-
return createGradient(
|
|
48
|
-
}, [gradientProp,
|
|
51
|
+
if (!valueAxisConfig) return;
|
|
52
|
+
const baselineValue = getBaseline(valueAxisConfig.domain, baseline);
|
|
53
|
+
return createGradient(valueAxisConfig.domain, baselineValue, fill, peakOpacity, baselineOpacity, gradientAxis);
|
|
54
|
+
}, [gradientProp, valueAxisConfig, fill, baseline, peakOpacity, baselineOpacity, gradientAxis]);
|
|
49
55
|
return /*#__PURE__*/_jsxs("g", {
|
|
50
56
|
children: [/*#__PURE__*/_jsxs("defs", {
|
|
51
57
|
children: [/*#__PURE__*/_jsx("pattern", {
|
|
@@ -67,13 +73,15 @@ export const DottedArea = /*#__PURE__*/memo(_ref => {
|
|
|
67
73
|
animate: animate,
|
|
68
74
|
d: d,
|
|
69
75
|
fill: "url(#".concat(patternId, ")"),
|
|
70
|
-
transition: transition
|
|
76
|
+
transition: transition,
|
|
77
|
+
transitions: transitions
|
|
71
78
|
})
|
|
72
79
|
}), gradient && /*#__PURE__*/_jsx(Gradient, {
|
|
73
80
|
animate: animate,
|
|
74
81
|
gradient: gradient,
|
|
75
82
|
id: gradientId,
|
|
76
|
-
transition: transition,
|
|
83
|
+
transition: (_transitions$update = transitions === null || transitions === void 0 ? void 0 : transitions.update) !== null && _transitions$update !== void 0 ? _transitions$update : transition,
|
|
84
|
+
xAxisId: xAxisId,
|
|
77
85
|
yAxisId: yAxisId
|
|
78
86
|
})]
|
|
79
87
|
}), /*#__PURE__*/_jsx(Path, _objectSpread({
|
|
@@ -81,7 +89,8 @@ export const DottedArea = /*#__PURE__*/memo(_ref => {
|
|
|
81
89
|
d: d,
|
|
82
90
|
fill: gradient ? "url(#".concat(gradientId, ")") : fill,
|
|
83
91
|
mask: "url(#".concat(maskId, ")"),
|
|
84
|
-
transition: transition
|
|
92
|
+
transition: transition,
|
|
93
|
+
transitions: transitions
|
|
85
94
|
}, pathProps))]
|
|
86
95
|
});
|
|
87
96
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["d", "fill", "fillOpacity", "peakOpacity", "baselineOpacity", "baseline", "yAxisId", "gradient", "animate", "transition"];
|
|
1
|
+
const _excluded = ["d", "fill", "fillOpacity", "peakOpacity", "baselineOpacity", "baseline", "xAxisId", "yAxisId", "gradient", "animate", "transitions", "transition"];
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -21,6 +21,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
21
21
|
* - For all-positive or all-negative data: Creates a simple gradient from baseline to peak.
|
|
22
22
|
*/
|
|
23
23
|
export const GradientArea = /*#__PURE__*/memo(_ref => {
|
|
24
|
+
var _transitions$update;
|
|
24
25
|
let {
|
|
25
26
|
d,
|
|
26
27
|
fill = 'var(--color-fgPrimary)',
|
|
@@ -28,30 +29,36 @@ export const GradientArea = /*#__PURE__*/memo(_ref => {
|
|
|
28
29
|
peakOpacity = 0.3,
|
|
29
30
|
baselineOpacity = 0,
|
|
30
31
|
baseline,
|
|
32
|
+
xAxisId,
|
|
31
33
|
yAxisId,
|
|
32
34
|
gradient: gradientProp,
|
|
33
35
|
animate,
|
|
36
|
+
transitions,
|
|
34
37
|
transition
|
|
35
38
|
} = _ref,
|
|
36
39
|
pathProps = _objectWithoutProperties(_ref, _excluded);
|
|
37
40
|
const {
|
|
41
|
+
layout,
|
|
42
|
+
getXAxis,
|
|
38
43
|
getYAxis
|
|
39
44
|
} = useCartesianChartContext();
|
|
40
45
|
const patternId = useId();
|
|
41
|
-
const
|
|
46
|
+
const valueAxisConfig = layout !== 'horizontal' ? getYAxis(yAxisId) : getXAxis(xAxisId);
|
|
47
|
+
const gradientAxis = layout !== 'horizontal' ? 'y' : 'x';
|
|
42
48
|
const gradient = useMemo(() => {
|
|
43
49
|
if (gradientProp) return gradientProp;
|
|
44
|
-
if (!
|
|
45
|
-
const baselineValue = getBaseline(
|
|
46
|
-
return createGradient(
|
|
47
|
-
}, [gradientProp,
|
|
50
|
+
if (!valueAxisConfig) return;
|
|
51
|
+
const baselineValue = getBaseline(valueAxisConfig.domain, baseline);
|
|
52
|
+
return createGradient(valueAxisConfig.domain, baselineValue, fill, peakOpacity, baselineOpacity, gradientAxis);
|
|
53
|
+
}, [gradientProp, valueAxisConfig, fill, baseline, peakOpacity, baselineOpacity, gradientAxis]);
|
|
48
54
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
49
55
|
children: [gradient && /*#__PURE__*/_jsx("defs", {
|
|
50
56
|
children: /*#__PURE__*/_jsx(Gradient, {
|
|
51
57
|
animate: animate,
|
|
52
58
|
gradient: gradient,
|
|
53
59
|
id: patternId,
|
|
54
|
-
transition: transition,
|
|
60
|
+
transition: (_transitions$update = transitions === null || transitions === void 0 ? void 0 : transitions.update) !== null && _transitions$update !== void 0 ? _transitions$update : transition,
|
|
61
|
+
xAxisId: xAxisId,
|
|
55
62
|
yAxisId: yAxisId
|
|
56
63
|
})
|
|
57
64
|
}), /*#__PURE__*/_jsx(Path, _objectSpread({
|
|
@@ -59,7 +66,8 @@ export const GradientArea = /*#__PURE__*/memo(_ref => {
|
|
|
59
66
|
d: d,
|
|
60
67
|
fill: gradient ? "url(#".concat(patternId, ")") : fill,
|
|
61
68
|
fillOpacity: fillOpacity,
|
|
62
|
-
transition: transition
|
|
69
|
+
transition: transition,
|
|
70
|
+
transitions: transitions
|
|
63
71
|
}, pathProps))]
|
|
64
72
|
});
|
|
65
73
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["d", "fill", "fillOpacity", "yAxisId", "animate", "transition", "gradient"];
|
|
1
|
+
const _excluded = ["d", "fill", "fillOpacity", "xAxisId", "yAxisId", "animate", "transitions", "transition", "gradient"];
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -16,12 +16,15 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
16
16
|
* Otherwise, renders with solid fill.
|
|
17
17
|
*/
|
|
18
18
|
export const SolidArea = /*#__PURE__*/memo(_ref => {
|
|
19
|
+
var _transitions$update;
|
|
19
20
|
let {
|
|
20
21
|
d,
|
|
21
22
|
fill = 'var(--color-fgPrimary)',
|
|
22
23
|
fillOpacity = 1,
|
|
24
|
+
xAxisId,
|
|
23
25
|
yAxisId,
|
|
24
26
|
animate,
|
|
27
|
+
transitions,
|
|
25
28
|
transition,
|
|
26
29
|
gradient
|
|
27
30
|
} = _ref,
|
|
@@ -33,7 +36,8 @@ export const SolidArea = /*#__PURE__*/memo(_ref => {
|
|
|
33
36
|
animate: animate,
|
|
34
37
|
gradient: gradient,
|
|
35
38
|
id: patternId,
|
|
36
|
-
transition: transition,
|
|
39
|
+
transition: (_transitions$update = transitions === null || transitions === void 0 ? void 0 : transitions.update) !== null && _transitions$update !== void 0 ? _transitions$update : transition,
|
|
40
|
+
xAxisId: xAxisId,
|
|
37
41
|
yAxisId: yAxisId
|
|
38
42
|
})
|
|
39
43
|
}), /*#__PURE__*/_jsx(Path, _objectSpread({
|
|
@@ -41,7 +45,8 @@ export const SolidArea = /*#__PURE__*/memo(_ref => {
|
|
|
41
45
|
d: d,
|
|
42
46
|
fill: gradient ? "url(#".concat(patternId, ")") : fill,
|
|
43
47
|
fillOpacity: fillOpacity,
|
|
44
|
-
transition: transition
|
|
48
|
+
transition: transition,
|
|
49
|
+
transitions: transitions
|
|
45
50
|
}, pathProps))]
|
|
46
51
|
});
|
|
47
52
|
});
|
package/esm/chart/axis/Axis.js
CHANGED
|
@@ -5,21 +5,7 @@ export const axisTickMarkStyles = "\n stroke: var(--color-fg);\n stroke-lineca
|
|
|
5
5
|
/**
|
|
6
6
|
* Animation variants for axis elements - updates (used for both grid lines and tick labels)
|
|
7
7
|
*/
|
|
8
|
-
export const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
},
|
|
12
|
-
animate: {
|
|
13
|
-
opacity: 1,
|
|
14
|
-
transition: {
|
|
15
|
-
duration: accessoryFadeTransitionDuration,
|
|
16
|
-
delay: accessoryFadeTransitionDuration
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
exit: {
|
|
20
|
-
opacity: 0,
|
|
21
|
-
transition: {
|
|
22
|
-
duration: accessoryFadeTransitionDuration
|
|
23
|
-
}
|
|
24
|
-
}
|
|
8
|
+
export const axisUpdateAnimationTransition = {
|
|
9
|
+
duration: accessoryFadeTransitionDuration,
|
|
10
|
+
ease: 'easeOut'
|
|
25
11
|
};
|