@octanejs/recharts 0.1.62 → 0.1.63

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.
Files changed (73) hide show
  1. package/package.json +5 -5
  2. package/src/animation/AnimatedItems.tsrx +36 -31
  3. package/src/animation/CSSTransitionAnimate.tsrx +1 -2
  4. package/src/animation/JavascriptAnimate.tsrx +1 -2
  5. package/src/cartesian/Area.tsrx +414 -386
  6. package/src/cartesian/AreaRevealShape.tsrx +103 -84
  7. package/src/cartesian/Bar.tsrx +343 -317
  8. package/src/cartesian/BarStack.tsrx +33 -28
  9. package/src/cartesian/CartesianAxis.tsrx +168 -165
  10. package/src/cartesian/CartesianGrid.tsrx +256 -272
  11. package/src/cartesian/ErrorBar.tsrx +108 -104
  12. package/src/cartesian/Funnel.tsrx +405 -382
  13. package/src/cartesian/GraphicalItemClipPath.tsrx +4 -8
  14. package/src/cartesian/Line.tsrx +190 -177
  15. package/src/cartesian/LineDrawShape.tsrx +14 -15
  16. package/src/cartesian/ReferenceLine.tsrx +119 -105
  17. package/src/cartesian/Scatter.tsrx +416 -398
  18. package/src/cartesian/XAxis.tsrx +39 -32
  19. package/src/cartesian/YAxis.tsrx +47 -37
  20. package/src/cartesian/ZAxis.tsrx +76 -73
  21. package/src/chart/AreaChart.tsrx +15 -11
  22. package/src/chart/BarChart.tsrx +15 -11
  23. package/src/chart/CategoricalChart.tsrx +32 -26
  24. package/src/chart/ComposedChart.tsrx +15 -11
  25. package/src/chart/FunnelChart.tsrx +15 -11
  26. package/src/chart/LineChart.tsrx +15 -11
  27. package/src/chart/PieChart.tsrx +15 -11
  28. package/src/chart/PolarChart.tsrx +45 -48
  29. package/src/chart/RadarChart.tsrx +38 -32
  30. package/src/chart/RadialBarChart.tsrx +15 -11
  31. package/src/chart/RechartsWrapper.tsrx +214 -162
  32. package/src/chart/Sankey.tsrx +412 -378
  33. package/src/chart/ScatterChart.tsrx +15 -11
  34. package/src/chart/SunburstChart.tsrx +162 -155
  35. package/src/component/ActivePoints.tsrx +19 -13
  36. package/src/component/Cursor.tsrx +25 -18
  37. package/src/component/DefaultLegendContent.tsrx +131 -127
  38. package/src/component/DefaultTooltipContent.tsrx +46 -42
  39. package/src/component/Dots.tsrx +11 -5
  40. package/src/component/Label.tsrx +69 -55
  41. package/src/component/LabelList.tsrx +32 -27
  42. package/src/component/Legend.tsrx +120 -123
  43. package/src/component/ResponsiveContainer.tsrx +18 -11
  44. package/src/component/Text.tsrx +50 -43
  45. package/src/component/Tooltip.tsrx +234 -223
  46. package/src/component/TooltipBoundingBox.tsrx +34 -34
  47. package/src/container/ClipPathProvider.tsrx +1 -3
  48. package/src/container/Layer.tsrx +5 -1
  49. package/src/container/RootSurface.tsrx +31 -21
  50. package/src/container/Surface.tsrx +15 -13
  51. package/src/context/ErrorBarContext.tsrx +5 -5
  52. package/src/polar/Pie.tsrx +541 -487
  53. package/src/polar/PolarAngleAxis.tsrx +245 -227
  54. package/src/polar/PolarGrid.tsrx +139 -127
  55. package/src/polar/PolarRadiusAxis.tsrx +204 -185
  56. package/src/polar/Radar.tsrx +274 -264
  57. package/src/polar/RadialBar.tsrx +408 -361
  58. package/src/shape/Cross.tsrx +13 -7
  59. package/src/shape/Curve.tsrx +54 -44
  60. package/src/shape/Dot.tsrx +10 -8
  61. package/src/shape/Polygon.tsrx +38 -29
  62. package/src/shape/Rectangle.tsrx +73 -28
  63. package/src/shape/Sector.tsrx +30 -18
  64. package/src/shape/Symbols.tsrx +13 -11
  65. package/src/shape/Trapezoid.tsrx +16 -11
  66. package/src/state/RechartsStoreProvider.tsrx +5 -1
  67. package/src/synchronisation/useChartSynchronisation.tsrx +8 -7
  68. package/src/util/BarUtils.tsrx +43 -40
  69. package/src/util/FunnelUtils.tsrx +5 -5
  70. package/src/util/RadialBarUtils.tsrx +3 -4
  71. package/src/util/ScatterUtils.tsrx +13 -8
  72. package/src/zIndex/ZIndexLayer.tsrx +2 -2
  73. package/src/zIndex/ZIndexPortal.tsrx +2 -8
@@ -44,8 +44,7 @@ function resolveTransitionProperty(args: {
44
44
  return undefined;
45
45
  }
46
46
  if (args.isAnimationActive && args.active) {
47
- const easing =
48
- typeof args.animationEasing === 'string' ? args.animationEasing : 'ease';
47
+ const easing = typeof args.animationEasing === 'string' ? args.animationEasing : 'ease';
49
48
  return `transform ${args.animationDuration}ms ${easing}`;
50
49
  }
51
50
  return undefined;
@@ -53,12 +52,10 @@ function resolveTransitionProperty(args: {
53
52
 
54
53
  function TooltipBoundingBoxImpl(props: TooltipBoundingBoxProps) {
55
54
  const prefersReducedMotion = usePrefersReducedMotion();
56
- const [state, setState] = React.useState(
57
- () => ({
58
- dismissed: false,
59
- dismissedAtCoordinate: { x: 0, y: 0 },
60
- }),
61
- );
55
+ const [state, setState] = React.useState(() => ({
56
+ dismissed: false,
57
+ dismissedAtCoordinate: { x: 0, y: 0 },
58
+ }));
62
59
 
63
60
  React.useEffect(() => {
64
61
  const handleKeyDown = (event: KeyboardEvent) => {
@@ -80,8 +77,8 @@ function TooltipBoundingBoxImpl(props: TooltipBoundingBoxProps) {
80
77
 
81
78
  if (
82
79
  state.dismissed &&
83
- ((props.coordinate?.x ?? 0) !== state.dismissedAtCoordinate.x ||
84
- (props.coordinate?.y ?? 0) !== state.dismissedAtCoordinate.y)
80
+ ((props.coordinate?.x ?? 0) !== state.dismissedAtCoordinate.x ||
81
+ (props.coordinate?.y ?? 0) !== state.dismissedAtCoordinate.y)
85
82
  ) {
86
83
  setState({ ...state, dismissed: false });
87
84
  }
@@ -100,35 +97,38 @@ function TooltipBoundingBoxImpl(props: TooltipBoundingBoxProps) {
100
97
  useTranslate3d: props.useTranslate3d,
101
98
  viewBox: props.viewBox,
102
99
  });
103
- const positionStyle: CSSProperties =
104
- props.hasPortalFromProps
105
- ? {}
106
- : {
107
- transition: resolveTransitionProperty({
108
- prefersReducedMotion,
109
- isAnimationActive: props.isAnimationActive,
110
- active: props.active,
111
- animationDuration: props.animationDuration,
112
- animationEasing: props.animationEasing,
113
- }),
114
- ...cssProperties,
115
- pointerEvents: 'none',
116
- position: 'absolute',
117
- top: 0,
118
- left: 0,
119
- };
100
+ const positionStyle: CSSProperties = props.hasPortalFromProps
101
+ ? {}
102
+ : {
103
+ transition: resolveTransitionProperty({
104
+ prefersReducedMotion,
105
+ isAnimationActive: props.isAnimationActive,
106
+ active: props.active,
107
+ animationDuration: props.animationDuration,
108
+ animationEasing: props.animationEasing,
109
+ }),
110
+ ...cssProperties,
111
+ pointerEvents: 'none',
112
+ position: 'absolute',
113
+ top: 0,
114
+ left: 0,
115
+ };
120
116
  const outerStyle: CSSProperties = {
121
117
  ...positionStyle,
122
118
  visibility: !state.dismissed && props.active && props.hasPayload ? 'visible' : 'hidden',
123
119
  ...props.wrapperStyle,
124
120
  };
125
- return <div
126
- xmlns="http://www.w3.org/1999/xhtml"
127
- tabIndex={-1}
128
- className={cssClasses}
129
- style={outerStyle}
130
- ref={props.innerRef}
131
- >{props.children}</div>;
121
+ return (
122
+ <div
123
+ xmlns="http://www.w3.org/1999/xhtml"
124
+ tabIndex={-1}
125
+ className={cssClasses}
126
+ style={outerStyle}
127
+ ref={props.innerRef}
128
+ >
129
+ {props.children}
130
+ </div>
131
+ );
132
132
  }
133
133
 
134
134
  export const TooltipBoundingBox = React.memo(TooltipBoundingBoxImpl);
@@ -8,9 +8,7 @@ import { usePlotArea } from '../hooks';
8
8
 
9
9
  const ClipPathIdContext = createContext<string | undefined>(undefined);
10
10
 
11
- export function ClipPathProvider(props: {
12
- children: OctaneNode;
13
- }) @{
11
+ export function ClipPathProvider(props: { children: OctaneNode }) @{
14
12
  const { children } = props;
15
13
  const [clipPathId] = useState(uniqueId('recharts') + '-clip');
16
14
  const plotArea = usePlotArea();
@@ -12,5 +12,9 @@ import { svgPropertiesAndEvents } from '../util/svgPropertiesAndEvents.ts';
12
12
  export function Layer(props: Props) {
13
13
  const { children, className, ref, ...others } = props;
14
14
  const layerClass = clsx('recharts-layer', className);
15
- return <g className={layerClass} {...svgPropertiesAndEvents(others)} ref={ref}>{children}</g>;
15
+ return (
16
+ <g className={layerClass} {...svgPropertiesAndEvents(others)} ref={ref}>
17
+ {children}
18
+ </g>
19
+ );
16
20
  }
@@ -48,40 +48,50 @@ function MainChartSurface(props: RootSurfaceProps) {
48
48
  role = hasAccessibilityLayer ? 'application' : undefined;
49
49
  }
50
50
  }
51
- return <Surface
52
- {...otherAttributes}
53
- title={title}
54
- desc={desc}
55
- role={role}
56
- tabIndex={tabIndex}
57
- width={width}
58
- height={height}
59
- style={FULL_WIDTH_AND_HEIGHT}
60
- ref={ref}
61
- >{children}</Surface>;
51
+ return (
52
+ <Surface
53
+ {...otherAttributes}
54
+ title={title}
55
+ desc={desc}
56
+ role={role}
57
+ tabIndex={tabIndex}
58
+ width={width}
59
+ height={height}
60
+ style={FULL_WIDTH_AND_HEIGHT}
61
+ ref={ref}
62
+ >
63
+ {children}
64
+ </Surface>
65
+ );
62
66
  }
63
67
 
64
- function BrushPanoramaSurface(props: {
65
- children: OctaneNode;
66
- }) {
68
+ function BrushPanoramaSurface(props: { children: OctaneNode }) {
67
69
  const { children } = props;
68
70
  const brushDimensions = useAppSelector(selectBrushDimensions);
69
71
  if (!brushDimensions) {
70
72
  return null;
71
73
  }
72
74
  const { width, height, y, x } = brushDimensions;
73
- return <Surface width={width} height={height} x={x} y={y}>{children}</Surface>;
75
+ return (
76
+ <Surface width={width} height={height} x={x} y={y}>
77
+ {children}
78
+ </Surface>
79
+ );
74
80
  }
75
81
 
76
82
  export function RootSurface(props: RootSurfaceProps) {
77
83
  const { children, ref, ...rest } = props;
78
84
  const isPanorama = useIsPanorama();
79
85
  if (isPanorama) {
80
- return <BrushPanoramaSurface>
81
- <AllZIndexPortals isPanorama={true}>{children}</AllZIndexPortals>
82
- </BrushPanoramaSurface>;
86
+ return (
87
+ <BrushPanoramaSurface>
88
+ <AllZIndexPortals isPanorama={true}>{children}</AllZIndexPortals>
89
+ </BrushPanoramaSurface>
90
+ );
83
91
  }
84
- return <MainChartSurface ref={ref} {...rest}>
85
- <AllZIndexPortals isPanorama={false}>{children}</AllZIndexPortals>
86
- </MainChartSurface>;
92
+ return (
93
+ <MainChartSurface ref={ref} {...rest}>
94
+ <AllZIndexPortals isPanorama={false}>{children}</AllZIndexPortals>
95
+ </MainChartSurface>
96
+ );
87
97
  }
@@ -21,17 +21,19 @@ export function Surface(props: Props) {
21
21
  const { children, width, height, viewBox, className, style, title, desc, ref, ...others } = props;
22
22
  const svgView = viewBox || { width, height, x: 0, y: 0 };
23
23
  const layerClass = clsx('recharts-surface', className);
24
- return <svg
25
- {...svgPropertiesAndEvents(others)}
26
- className={layerClass}
27
- width={width}
28
- height={height}
29
- style={style}
30
- viewBox={svgView.x + ' ' + svgView.y + ' ' + svgView.width + ' ' + svgView.height}
31
- ref={ref}
32
- >
33
- <title>{title}</title>
34
- <desc>{desc}</desc>
35
- {children}
36
- </svg>;
24
+ return (
25
+ <svg
26
+ {...svgPropertiesAndEvents(others)}
27
+ className={layerClass}
28
+ width={width}
29
+ height={height}
30
+ style={style}
31
+ viewBox={svgView.x + ' ' + svgView.y + ' ' + svgView.width + ' ' + svgView.height}
32
+ ref={ref}
33
+ >
34
+ <title>{title}</title>
35
+ <desc>{desc}</desc>
36
+ {children}
37
+ </svg>
38
+ );
37
39
  }
@@ -31,11 +31,11 @@ const initialContextState: ErrorBarContextType<any> = {
31
31
 
32
32
  const ErrorBarContext = createContext(initialContextState);
33
33
 
34
- export function SetErrorBarContext<
35
- T extends BarRectangleItem | LinePointItem | ScatterPointItem,
36
- >(props: ErrorBarContextType<T> & {
37
- children: OctaneNode;
38
- }) {
34
+ export function SetErrorBarContext<T extends BarRectangleItem | LinePointItem | ScatterPointItem>(
35
+ props: ErrorBarContextType<T> & {
36
+ children: OctaneNode;
37
+ },
38
+ ) {
39
39
  const { children, ...rest } = props;
40
40
  return <ErrorBarContext value={rest}>{children}</ErrorBarContext>;
41
41
  }