@octanejs/recharts 0.1.16 → 0.1.18

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 (88) hide show
  1. package/package.json +4 -4
  2. package/src/animation/CSSTransitionAnimate.tsrx +142 -0
  3. package/src/cartesian/Area.tsrx +1096 -0
  4. package/src/cartesian/Area.tsrx.d.ts +340 -0
  5. package/src/cartesian/AreaRevealShape.tsrx +202 -0
  6. package/src/cartesian/CartesianGrid.tsrx +643 -0
  7. package/src/cartesian/CartesianGrid.tsrx.d.ts +219 -0
  8. package/src/cartesian/ErrorBar.tsrx +322 -0
  9. package/src/cartesian/ErrorBar.tsrx.d.ts +131 -0
  10. package/src/cartesian/Funnel.tsrx +833 -0
  11. package/src/cartesian/Funnel.tsrx.d.ts +274 -0
  12. package/src/cartesian/ReferenceLine.tsrx +452 -0
  13. package/src/cartesian/ReferenceLine.tsrx.d.ts +178 -0
  14. package/src/cartesian/Scatter.tsrx +1076 -0
  15. package/src/cartesian/Scatter.tsrx.d.ts +351 -0
  16. package/src/cartesian/ZAxis.tsrx +148 -0
  17. package/src/cartesian/ZAxis.tsrx.d.ts +102 -0
  18. package/src/chart/AreaChart.tsrx +22 -0
  19. package/src/chart/AreaChart.tsrx.d.ts +12 -0
  20. package/src/chart/ComposedChart.tsrx +22 -0
  21. package/src/chart/ComposedChart.tsrx.d.ts +12 -0
  22. package/src/chart/FunnelChart.tsrx +22 -0
  23. package/src/chart/FunnelChart.tsrx.d.ts +12 -0
  24. package/src/chart/PieChart.tsrx +31 -0
  25. package/src/chart/PieChart.tsrx.d.ts +31 -0
  26. package/src/chart/PolarChart.tsrx +121 -0
  27. package/src/chart/RadarChart.tsrx +53 -0
  28. package/src/chart/RadarChart.tsrx.d.ts +31 -0
  29. package/src/chart/RadialBarChart.tsrx +31 -0
  30. package/src/chart/RadialBarChart.tsrx.d.ts +31 -0
  31. package/src/chart/Sankey.tsrx +1542 -0
  32. package/src/chart/Sankey.tsrx.d.ts +253 -0
  33. package/src/chart/ScatterChart.tsrx +22 -0
  34. package/src/chart/ScatterChart.tsrx.d.ts +12 -0
  35. package/src/chart/SunburstChart.tsrx +495 -0
  36. package/src/chart/SunburstChart.tsrx.d.ts +146 -0
  37. package/src/chart/types.ts +19 -0
  38. package/src/component/Cursor.tsrx +157 -0
  39. package/src/component/DefaultLegendContent.tsrx +288 -0
  40. package/src/component/DefaultLegendContent.tsrx.d.ts +125 -0
  41. package/src/component/DefaultTooltipContent.tsrx +215 -0
  42. package/src/component/DefaultTooltipContent.tsrx.d.ts +87 -0
  43. package/src/component/Legend.tsrx +302 -0
  44. package/src/component/Legend.tsrx.d.ts +88 -0
  45. package/src/component/ResponsiveContainer.ts +1 -22
  46. package/src/component/ResponsiveContainer.tsrx +171 -0
  47. package/src/component/ResponsiveContainer.tsrx.d.ts +81 -0
  48. package/src/component/Tooltip.tsrx +425 -0
  49. package/src/component/Tooltip.tsrx.d.ts +246 -0
  50. package/src/component/TooltipBoundingBox.tsrx +135 -0
  51. package/src/context/CellsContext.ts +12 -0
  52. package/src/context/legendPayloadContext.tsrx +11 -0
  53. package/src/context/useTooltipAxis.ts +20 -0
  54. package/src/index.d.ts +236 -0
  55. package/src/index.ts +67 -0
  56. package/src/polar/Pie.tsrx +1224 -0
  57. package/src/polar/Pie.tsrx.d.ts +436 -0
  58. package/src/polar/PolarAngleAxis.tsrx +554 -0
  59. package/src/polar/PolarAngleAxis.tsrx.d.ts +215 -0
  60. package/src/polar/PolarGrid.tsrx +317 -0
  61. package/src/polar/PolarGrid.tsrx.d.ts +117 -0
  62. package/src/polar/PolarRadiusAxis.tsrx +463 -0
  63. package/src/polar/PolarRadiusAxis.tsrx.d.ts +209 -0
  64. package/src/polar/Radar.tsrx +696 -0
  65. package/src/polar/Radar.tsrx.d.ts +215 -0
  66. package/src/polar/RadialBar.tsrx +887 -0
  67. package/src/polar/RadialBar.tsrx.d.ts +340 -0
  68. package/src/state/ReportPolarOptions.tsrx +11 -0
  69. package/src/state/selectors/areaSelectors.ts +257 -0
  70. package/src/state/selectors/funnelSelectors.ts +86 -0
  71. package/src/state/selectors/pieSelectors.ts +134 -0
  72. package/src/state/selectors/polarGridSelectors.ts +43 -0
  73. package/src/state/selectors/polarScaleSelectors.ts +159 -0
  74. package/src/state/selectors/polarSelectors.ts +198 -0
  75. package/src/state/selectors/radarSelectors.ts +228 -0
  76. package/src/state/selectors/radialBarSelectors.ts +511 -0
  77. package/src/state/selectors/scatterSelectors.ts +168 -0
  78. package/src/util/FunnelUtils.tsrx +19 -0
  79. package/src/util/RadialBarUtils.tsrx +29 -0
  80. package/src/util/ScatterUtils.tsrx +34 -0
  81. package/src/util/cursor/getCursorPoints.ts +45 -0
  82. package/src/util/cursor/getCursorRectangle.ts +28 -0
  83. package/src/util/cursor/getRadialCursorPoints.ts +31 -0
  84. package/src/util/payload/getUniqPayload.ts +28 -0
  85. package/src/util/scale/CartesianScaleHelper.ts +71 -0
  86. package/src/util/tooltip/translate.ts +168 -0
  87. package/src/util/types.ts +3 -0
  88. package/src/util/useElementOffset.ts +147 -0
@@ -0,0 +1,215 @@
1
+ import * as React from 'octane';
2
+ import { MouseEvent, ReactElement, SVGProps } from 'octane';
3
+ import { ImplicitLabelListType } from '../component/LabelList';
4
+ import {
5
+ ActiveDotType,
6
+ AnimationDuration,
7
+ DataConsumer,
8
+ DataKey,
9
+ DotType,
10
+ EasingInput,
11
+ LegendType,
12
+ PolarLayout,
13
+ TooltipType,
14
+ } from '../util/types';
15
+ import { AnimationInterpolateFn } from '../animation/AnimatedItems';
16
+ import { AnimationMatchByProp } from '../animation/matchBy';
17
+ import { RequiresDefaultProps } from '../util/resolveDefaultProps';
18
+ import { WithIdRequired } from '../util/useUniqueId';
19
+ import { ZIndexable } from '../zIndex/ZIndexLayer';
20
+ import { RechartsScale } from '../util/scale/RechartsScale';
21
+ export interface RadarPoint {
22
+ x: number;
23
+ y: number;
24
+ cx?: number;
25
+ cy?: number;
26
+ angle: number;
27
+ radius?: number;
28
+ value?: number;
29
+ payload?: any;
30
+ name?: string | number;
31
+ }
32
+ interface RadarProps<DataPointType = any, DataValueType = any>
33
+ extends ZIndexable, DataConsumer<DataPointType, DataValueType> {
34
+ /**
35
+ * @defaultValue true
36
+ */
37
+ activeDot?: ActiveDotType;
38
+ /**
39
+ * @defaultValue 0
40
+ */
41
+ angleAxisId?: string | number;
42
+ /**
43
+ * Specifies when the animation should begin, the unit of this option is ms.
44
+ * @defaultValue 0
45
+ */
46
+ animationBegin?: number;
47
+ /**
48
+ * Specifies the duration of animation, the unit of this option is ms.
49
+ * @defaultValue 1500
50
+ */
51
+ animationDuration?: AnimationDuration;
52
+ /**
53
+ * The type of easing function.
54
+ * @defaultValue ease
55
+ */
56
+ animationEasing?: EasingInput;
57
+ /**
58
+ * Custom animation function for interpolating data items.
59
+ * When provided, this replaces the default animation interpolation.
60
+ *
61
+ * @param prevItems The items from the previous animation frame, or null on first render
62
+ * @param nextItems The target items to animate towards
63
+ * @param animationElapsedTime A normalized time value (0 = start, 1 = end)
64
+ * @returns The interpolated items at time animationElapsedTime
65
+ *
66
+ * @since 3.9
67
+ * @see {@link https://recharts.github.io/en-US/guide/animations/ Animations guide}
68
+ */
69
+ animationInterpolateFn?: AnimationInterpolateFn<RadarPoint, PolarLayout>;
70
+ /**
71
+ * Strategy for matching previous items to next items during animation.
72
+ * Determines how Recharts pairs old data points with new data points
73
+ * to create smooth transitions.
74
+ *
75
+ * - `matchByIndex` (default): match by array position with proportional stretching
76
+ * - `matchAppend`: match sequentially by index and treat newly appended items as new
77
+ * - `matchByDataKey('someKey')`: match by a data key from the payload
78
+ * - Custom function `(item, index) => key`: match by the returned key
79
+ *
80
+ * @defaultValue index
81
+ * @see matchByIndex
82
+ * @see matchByDataKey
83
+ * @see matchAppend
84
+ */
85
+ animationMatchBy?: AnimationMatchByProp<RadarPoint>;
86
+ baseLinePoints?: RadarPoint[];
87
+ className?: string;
88
+ connectNulls?: boolean;
89
+ /**
90
+ * Renders a circle element at each data point. Options:
91
+ *
92
+ * - `false`: no dots are drawn;
93
+ * - `true`: renders the dots with default settings;
94
+ * - `object`: the props of the dot. This will be merged with the internal calculated props of each dot;
95
+ * - `ReactElement`: the custom dot element;
96
+ * - `function`: a render function of the custom dot.
97
+ *
98
+ * @defaultValue false
99
+ */
100
+ dot?: DotType;
101
+ /**
102
+ * @defaultValue false
103
+ */
104
+ hide?: boolean;
105
+ /**
106
+ * If set false, animation of polygon will be disabled.
107
+ * If set "auto", the animation will be disabled in SSR and will respect the user's prefers-reduced-motion system preference for accessibility.
108
+ * @defaultValue auto
109
+ */
110
+ isAnimationActive?: boolean | 'auto';
111
+ isRange?: boolean;
112
+ /**
113
+ * Renders one label for each point. Options:
114
+ * - `true`: renders default labels;
115
+ * - `false`: no labels are rendered;
116
+ * - `object`: the props of LabelList component;
117
+ * - `ReactElement`: a custom SVG label element, such as `<text>` or `<g>`.
118
+ * HTML elements such as `<div>` are not valid inside the chart SVG and may trigger React DOM warnings.
119
+ * - `function`: a render function of custom label.
120
+ *
121
+ * @defaultValue false
122
+ */
123
+ label?: ImplicitLabelListType;
124
+ /**
125
+ * The type of icon in legend. If set to 'none', no legend item will be rendered.
126
+ * @defaultValue rect
127
+ */
128
+ legendType?: LegendType;
129
+ /**
130
+ * The customized event handler of animation end
131
+ */
132
+ onAnimationEnd?: () => void;
133
+ /**
134
+ * The customized event handler of animation start
135
+ */
136
+ onAnimationStart?: () => void;
137
+ onMouseEnter?: (props: InternalRadarProps, e: MouseEvent<SVGPolygonElement>) => void;
138
+ onMouseLeave?: (props: InternalRadarProps, e: MouseEvent<SVGPolygonElement>) => void;
139
+ /**
140
+ * @defaultValue 0
141
+ */
142
+ radiusAxisId?: string | number;
143
+ /**
144
+ * If set a ReactElement, the shape of radar can be customized.
145
+ * If set a function, the function will be called to render customized shape.
146
+ */
147
+ shape?: ReactElement<SVGElement> | ((props: any) => ReactElement<SVGElement>);
148
+ tooltipType?: TooltipType;
149
+ /**
150
+ * @defaultValue 100
151
+ */
152
+ zIndex?: number;
153
+ }
154
+ export type RadiusAxisForRadar = {
155
+ scale: RechartsScale;
156
+ };
157
+ export type AngleAxisForRadar = {
158
+ scale: RechartsScale;
159
+ type: 'number' | 'category';
160
+ dataKey: DataKey<any> | undefined;
161
+ cx: number;
162
+ cy: number;
163
+ };
164
+ export type Props<DataPointType = any, DataValueType = any> = Omit<
165
+ SVGProps<SVGGraphicsElement>,
166
+ 'onMouseEnter' | 'onMouseLeave' | 'points' | 'ref'
167
+ > &
168
+ RadarProps<DataPointType, DataValueType>;
169
+ export type RadarComposedData = {
170
+ points: RadarPoint[];
171
+ baseLinePoints: RadarPoint[];
172
+ isRange: boolean;
173
+ };
174
+ export declare function computeRadarPoints({
175
+ radiusAxis,
176
+ angleAxis,
177
+ displayedData,
178
+ dataKey,
179
+ bandSize,
180
+ }: {
181
+ radiusAxis: RadiusAxisForRadar;
182
+ angleAxis: AngleAxisForRadar;
183
+ displayedData: any[];
184
+ dataKey: RadarProps['dataKey'];
185
+ bandSize: number;
186
+ }): RadarComposedData;
187
+ export declare const defaultRadarProps: {
188
+ readonly activeDot: true;
189
+ readonly angleAxisId: 0;
190
+ readonly animationBegin: 0;
191
+ readonly animationDuration: 1500;
192
+ readonly animationEasing: 'ease';
193
+ readonly animationMatchBy: 'index';
194
+ readonly animationInterpolateFn: AnimationInterpolateFn<RadarPoint, PolarLayout>;
195
+ readonly dot: false;
196
+ readonly hide: false;
197
+ readonly isAnimationActive: 'auto';
198
+ readonly label: false;
199
+ readonly legendType: 'rect';
200
+ readonly radiusAxisId: 0;
201
+ readonly zIndex: 100;
202
+ };
203
+ type PropsWithDefaults = RequiresDefaultProps<Props, typeof defaultRadarProps>;
204
+ export type InternalRadarProps = WithIdRequired<PropsWithDefaults> & RadarComposedData;
205
+ /**
206
+ * @consumes PolarChartContext
207
+ * @provides LabelListContext
208
+ */
209
+ export declare function Radar<DataPointType = any, DataValueType = any>(
210
+ outsideProps: Props<DataPointType, DataValueType>,
211
+ ): React.JSX.Element;
212
+ export declare namespace Radar {
213
+ var displayName: string;
214
+ }
215
+ export {};