@octanejs/recharts 0.1.51 → 0.1.53
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/package.json +4 -4
- package/src/animation/AnimationController.ts +1 -1
- package/src/animation/AnimationControllerImpl.ts +2 -2
- package/src/animation/AnimationHandle.ts +1 -1
- package/src/animation/CSSTransitionAnimate.tsrx +1 -1
- package/src/animation/matchBy.ts +1 -1
- package/src/animation/useAnimationController.ts +1 -1
- package/src/cartesian/Area.tsrx +23 -19
- package/src/cartesian/AreaRevealShape.tsrx +2 -2
- package/src/cartesian/Bar.tsrx +2 -2
- package/src/cartesian/BarStack.tsrx +2 -2
- package/src/cartesian/CartesianGrid.tsrx +6 -6
- package/src/cartesian/ErrorBar.tsrx +5 -5
- package/src/cartesian/Funnel.tsrx +34 -31
- package/src/cartesian/ReferenceLine.tsrx +10 -7
- package/src/cartesian/Scatter.tsrx +44 -36
- package/src/cartesian/ZAxis.tsrx +4 -4
- package/src/cartesian/getCartesianPosition.ts +2 -2
- package/src/cartesian/getEquidistantTicks.ts +2 -2
- package/src/cartesian/getTicks.ts +2 -2
- package/src/chart/AreaChart.tsrx +1 -1
- package/src/chart/ComposedChart.tsrx +1 -1
- package/src/chart/FunnelChart.tsrx +1 -1
- package/src/chart/PieChart.tsrx +1 -1
- package/src/chart/PolarChart.tsrx +3 -3
- package/src/chart/RadarChart.tsrx +1 -1
- package/src/chart/RadialBarChart.tsrx +1 -1
- package/src/chart/RechartsWrapper.tsrx +4 -4
- package/src/chart/Sankey.tsrx +11 -11
- package/src/chart/ScatterChart.tsrx +1 -1
- package/src/chart/SunburstChart.tsrx +16 -10
- package/src/component/Cursor.tsrx +7 -7
- package/src/component/DefaultLegendContent.tsrx +5 -5
- package/src/component/DefaultTooltipContent.tsrx +2 -2
- package/src/component/Label.tsrx +2 -2
- package/src/component/LabelList.tsrx +2 -2
- package/src/component/Legend.tsrx +8 -8
- package/src/component/ResponsiveContainer.tsrx +1 -1
- package/src/component/Tooltip.tsrx +12 -12
- package/src/component/TooltipBoundingBox.tsrx +2 -2
- package/src/container/ClipPathProvider.tsrx +2 -2
- package/src/context/CellsContext.ts +1 -1
- package/src/context/ErrorBarContext.tsrx +1 -1
- package/src/context/RegisterGraphicalItemId.tsrx +1 -3
- package/src/context/legendPayloadContext.tsrx +1 -1
- package/src/context/tooltipContext.ts +2 -2
- package/src/context/useTooltipAxis.ts +1 -1
- package/src/hooks.ts +6 -6
- package/src/polar/Pie.tsrx +32 -32
- package/src/polar/PolarAngleAxis.tsrx +16 -16
- package/src/polar/PolarGrid.tsrx +3 -3
- package/src/polar/PolarRadiusAxis.tsrx +17 -17
- package/src/polar/Radar.tsrx +10 -10
- package/src/polar/RadialBar.tsrx +31 -31
- package/src/polar/defaultPolarAngleAxisProps.ts +1 -1
- package/src/polar/defaultPolarRadiusAxisProps.ts +1 -1
- package/src/state/ReportPolarOptions.tsrx +1 -1
- package/src/state/brushSlice.ts +2 -2
- package/src/state/cartesianAxisSlice.ts +4 -4
- package/src/state/chartDataSlice.ts +2 -2
- package/src/state/errorBarSlice.ts +4 -4
- package/src/state/eventSettingsSlice.ts +2 -2
- package/src/state/externalEventsMiddleware.ts +5 -5
- package/src/state/graphicalItemsSlice.ts +11 -11
- package/src/state/keyboardEventsMiddleware.ts +3 -3
- package/src/state/layoutSlice.ts +2 -2
- package/src/state/legendSlice.ts +3 -3
- package/src/state/mouseEventsMiddleware.ts +4 -4
- package/src/state/optionsSlice.ts +2 -2
- package/src/state/polarAxisSlice.ts +2 -2
- package/src/state/polarOptionsSlice.ts +1 -1
- package/src/state/referenceElementsSlice.ts +5 -5
- package/src/state/renderedTicksSlice.ts +4 -4
- package/src/state/rootPropsSlice.ts +4 -4
- package/src/state/selectors/areaSelectors.ts +7 -7
- package/src/state/selectors/axisSelectors.ts +22 -18
- package/src/state/selectors/barSelectors.ts +11 -11
- package/src/state/selectors/brushSelectors.ts +2 -2
- package/src/state/selectors/combiners/combineActiveLabel.ts +3 -3
- package/src/state/selectors/combiners/combineActiveTooltipIndex.ts +3 -3
- package/src/state/selectors/combiners/combineAllBarPositions.ts +3 -3
- package/src/state/selectors/combiners/combineAxisRangeWithReverse.ts +2 -2
- package/src/state/selectors/combiners/combineBarPosition.ts +3 -3
- package/src/state/selectors/combiners/combineBarSizeList.ts +5 -5
- package/src/state/selectors/combiners/combineCheckedDomain.ts +1 -1
- package/src/state/selectors/combiners/combineConfiguredScale.ts +4 -4
- package/src/state/selectors/combiners/combineCoordinateForDefaultIndex.ts +2 -2
- package/src/state/selectors/combiners/combineDisplayedStackedData.ts +4 -4
- package/src/state/selectors/combiners/combineInverseScaleFunction.ts +2 -2
- package/src/state/selectors/combiners/combineRealScaleType.ts +2 -2
- package/src/state/selectors/combiners/combineStackedData.ts +2 -2
- package/src/state/selectors/combiners/combineTooltipInteractionState.ts +5 -5
- package/src/state/selectors/combiners/combineTooltipPayload.ts +4 -4
- package/src/state/selectors/combiners/combineTooltipPayloadConfigurations.ts +4 -4
- package/src/state/selectors/containerSelectors.ts +2 -2
- package/src/state/selectors/dataSelectors.ts +2 -2
- package/src/state/selectors/funnelSelectors.ts +5 -5
- package/src/state/selectors/graphicalItemSelectors.ts +3 -3
- package/src/state/selectors/legendSelectors.ts +4 -4
- package/src/state/selectors/lineSelectors.ts +6 -6
- package/src/state/selectors/numberDomainEqualityCheck.ts +1 -1
- package/src/state/selectors/pickAxisId.ts +2 -2
- package/src/state/selectors/pickAxisType.ts +1 -1
- package/src/state/selectors/pieSelectors.ts +5 -5
- package/src/state/selectors/polarAxisSelectors.ts +6 -6
- package/src/state/selectors/polarGridSelectors.ts +3 -3
- package/src/state/selectors/polarScaleSelectors.ts +4 -4
- package/src/state/selectors/polarSelectors.ts +6 -6
- package/src/state/selectors/radarSelectors.ts +11 -11
- package/src/state/selectors/radialBarSelectors.ts +16 -16
- package/src/state/selectors/rootPropsSelectors.ts +4 -4
- package/src/state/selectors/scatterSelectors.ts +8 -8
- package/src/state/selectors/selectActivePropsFromChartPointer.ts +3 -3
- package/src/state/selectors/selectAllAxes.ts +2 -2
- package/src/state/selectors/selectChartOffset.ts +2 -2
- package/src/state/selectors/selectChartOffsetInternal.ts +4 -4
- package/src/state/selectors/selectTooltipAxisId.ts +2 -2
- package/src/state/selectors/selectTooltipAxisType.ts +1 -1
- package/src/state/selectors/selectTooltipEventType.ts +3 -3
- package/src/state/selectors/selectTooltipPayloadSearcher.ts +2 -2
- package/src/state/selectors/selectTooltipSettings.ts +2 -2
- package/src/state/selectors/selectTooltipState.ts +2 -2
- package/src/state/selectors/selectors.ts +5 -5
- package/src/state/selectors/tooltipSelectors.ts +16 -16
- package/src/state/selectors/touchSelectors.ts +4 -4
- package/src/state/store.ts +3 -3
- package/src/state/tooltipSlice.ts +5 -5
- package/src/state/touchEventsMiddleware.ts +4 -4
- package/src/state/types/AreaSettings.ts +5 -5
- package/src/state/types/BarSettings.ts +3 -3
- package/src/state/types/LineSettings.ts +3 -3
- package/src/state/types/PieSettings.ts +5 -5
- package/src/state/types/RadarSettings.ts +1 -1
- package/src/state/types/RadialBarSettings.ts +2 -2
- package/src/state/types/ScatterSettings.ts +4 -4
- package/src/state/types/StackedGraphicalItem.ts +3 -3
- package/src/state/zIndexSlice.ts +1 -1
- package/src/synchronisation/syncSelectors.ts +2 -2
- package/src/synchronisation/types.ts +2 -2
- package/src/util/CartesianUtils.ts +1 -1
- package/src/util/ChartUtils.ts +8 -8
- package/src/util/DOMUtils.ts +1 -1
- package/src/util/DataUtils.ts +1 -1
- package/src/util/Events.ts +3 -3
- package/src/util/FunnelUtils.tsrx +2 -2
- package/src/util/PolarUtils.ts +1 -1
- package/src/util/RadialBarUtils.tsrx +2 -2
- package/src/util/ScatterUtils.tsrx +4 -4
- package/src/util/TickUtils.ts +1 -1
- package/src/util/axisPropsAreEqual.ts +3 -3
- package/src/util/cursor/getCursorPoints.ts +6 -6
- package/src/util/cursor/getCursorRectangle.ts +1 -1
- package/src/util/cursor/getRadialCursorPoints.ts +1 -1
- package/src/util/getActiveCoordinate.ts +2 -2
- package/src/util/getAxisTypeBasedOnLayout.ts +1 -1
- package/src/util/getRadiusAndStrokeWidthFromDot.ts +1 -1
- package/src/util/getRelativeCoordinate.ts +1 -1
- package/src/util/isDomainSpecifiedByUser.ts +1 -1
- package/src/util/scale/CartesianScaleHelper.ts +2 -2
- package/src/util/scale/CustomScaleDefinition.ts +1 -1
- package/src/util/scale/RechartsScale.ts +2 -2
- package/src/util/scale/createCategoricalInverse.ts +2 -2
- package/src/util/scale/getNiceTickValues.ts +2 -2
- package/src/util/stacks/getStackSeriesIdentifier.ts +2 -2
- package/src/util/stacks/stackTypes.ts +4 -4
- package/src/util/tooltip/translate.ts +1 -1
- package/src/util/types.ts +12 -12
- package/src/zIndex/zIndexSelectors.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Adapted from recharts@3.9.2, commit b3451050c027a23957ffa50a2665c9119df21e47.
|
|
2
|
-
import { CartesianTickItem, CartesianViewBoxRequired, Size } from '../util/types';
|
|
2
|
+
import type { CartesianTickItem, CartesianViewBoxRequired, Size } from '../util/types';
|
|
3
3
|
import { mathSign, isNumber } from '../util/DataUtils';
|
|
4
4
|
import { getStringSize } from '../util/DOMUtils';
|
|
5
5
|
import { Global } from '../util/Global';
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
getAngledTickWidth,
|
|
11
11
|
} from '../util/TickUtils';
|
|
12
12
|
import { getEquidistantTicks, getEquidistantPreserveEndTicks } from './getEquidistantTicks';
|
|
13
|
-
import {
|
|
13
|
+
import type {
|
|
14
14
|
CartesianAxisSettings,
|
|
15
15
|
XAxisOrientation,
|
|
16
16
|
YAxisOrientation,
|
package/src/chart/AreaChart.tsrx
CHANGED
|
@@ -2,7 +2,7 @@ import type { Ref } from '../util/OctaneTypes.ts';
|
|
|
2
2
|
|
|
3
3
|
import { arrayTooltipSearcher } from '../state/optionsSlice';
|
|
4
4
|
import { CartesianChart } from './CartesianChart.tsrx';
|
|
5
|
-
import { CartesianChartProps, TooltipEventType } from '../util/types';
|
|
5
|
+
import type { CartesianChartProps, TooltipEventType } from '../util/types';
|
|
6
6
|
|
|
7
7
|
const allowedTooltipTypes: ReadonlyArray<TooltipEventType> = ['axis'];
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ import type { Ref } from '../util/OctaneTypes.ts';
|
|
|
2
2
|
|
|
3
3
|
import { arrayTooltipSearcher } from '../state/optionsSlice';
|
|
4
4
|
import { CartesianChart } from './CartesianChart.tsrx';
|
|
5
|
-
import { CartesianChartProps, TooltipEventType } from '../util/types';
|
|
5
|
+
import type { CartesianChartProps, TooltipEventType } from '../util/types';
|
|
6
6
|
|
|
7
7
|
const allowedTooltipTypes: ReadonlyArray<TooltipEventType> = ['axis'];
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ import type { Ref } from '../util/OctaneTypes.ts';
|
|
|
2
2
|
|
|
3
3
|
import { arrayTooltipSearcher } from '../state/optionsSlice';
|
|
4
4
|
import { CartesianChart } from './CartesianChart.tsrx';
|
|
5
|
-
import { CartesianChartProps, TooltipEventType } from '../util/types';
|
|
5
|
+
import type { CartesianChartProps, TooltipEventType } from '../util/types';
|
|
6
6
|
|
|
7
7
|
const allowedTooltipTypes: ReadonlyArray<TooltipEventType> = ['item'];
|
|
8
8
|
|
package/src/chart/PieChart.tsrx
CHANGED
|
@@ -2,7 +2,7 @@ import type { Ref } from '../util/OctaneTypes.ts';
|
|
|
2
2
|
|
|
3
3
|
import { arrayTooltipSearcher } from '../state/optionsSlice';
|
|
4
4
|
import { defaultPolarChartProps, PolarChart } from './PolarChart.tsrx';
|
|
5
|
-
import { PolarChartProps, TooltipEventType } from '../util/types';
|
|
5
|
+
import type { PolarChartProps, TooltipEventType } from '../util/types';
|
|
6
6
|
import { resolveDefaultProps } from '../util/resolveDefaultProps';
|
|
7
7
|
|
|
8
8
|
const allowedTooltipTypes: ReadonlyArray<TooltipEventType> = ['item'];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ChartOptions } from '../state/optionsSlice';
|
|
1
|
+
import type { ChartOptions } from '../state/optionsSlice';
|
|
2
2
|
import { RechartsStoreProvider } from '../state/RechartsStoreProvider.tsrx';
|
|
3
3
|
import { ChartDataContextProvider } from '../context/chartDataContext';
|
|
4
4
|
import { ReportMainChartProps } from '../state/ReportMainChartProps';
|
|
5
5
|
import { ReportChartProps } from '../state/ReportChartProps';
|
|
6
6
|
import { ReportEventSettings } from '../state/ReportEventSettings';
|
|
7
7
|
import { ReportPolarOptions } from '../state/ReportPolarOptions.tsrx';
|
|
8
|
-
import { Margin, PolarChartProps, TooltipEventType } from '../util/types';
|
|
9
|
-
import { TooltipPayloadSearcher } from '../state/tooltipSlice';
|
|
8
|
+
import type { Margin, PolarChartProps, TooltipEventType } from '../util/types';
|
|
9
|
+
import type { TooltipPayloadSearcher } from '../state/tooltipSlice';
|
|
10
10
|
import { CategoricalChart } from './CategoricalChart.tsrx';
|
|
11
11
|
import { resolveDefaultProps } from '../util/resolveDefaultProps';
|
|
12
12
|
import { initialEventSettingsState } from '../state/eventSettingsSlice';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Ref } from '../util/OctaneTypes.ts';
|
|
2
2
|
|
|
3
3
|
import { arrayTooltipSearcher } from '../state/optionsSlice';
|
|
4
|
-
import { PolarChartProps, PolarLayout, TooltipEventType } from '../util/types';
|
|
4
|
+
import type { PolarChartProps, PolarLayout, TooltipEventType } from '../util/types';
|
|
5
5
|
import { resolveDefaultProps } from '../util/resolveDefaultProps';
|
|
6
6
|
import { defaultPolarChartProps, PolarChart } from './PolarChart.tsrx';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Ref } from '../util/OctaneTypes.ts';
|
|
2
2
|
|
|
3
3
|
import { arrayTooltipSearcher } from '../state/optionsSlice';
|
|
4
|
-
import { PolarChartProps, TooltipEventType } from '../util/types';
|
|
4
|
+
import type { PolarChartProps, TooltipEventType } from '../util/types';
|
|
5
5
|
import { resolveDefaultProps } from '../util/resolveDefaultProps';
|
|
6
6
|
import { defaultPolarChartProps, PolarChart } from './PolarChart.tsrx';
|
|
7
7
|
|
|
@@ -299,8 +299,8 @@ export function RechartsWrapper(props: RechartsWrapperProps) {
|
|
|
299
299
|
dispatch(externalEventAction({ handler: onTouchEnd, reactEvent: e }));
|
|
300
300
|
}, [dispatch, onTouchEnd]);
|
|
301
301
|
const WrapperDiv = responsive ? ResponsiveDiv : NonResponsiveDiv;
|
|
302
|
-
return <TooltipPortalContext
|
|
303
|
-
<LegendPortalContext
|
|
302
|
+
return <TooltipPortalContext value={tooltipPortal}>
|
|
303
|
+
<LegendPortalContext value={legendPortal}>
|
|
304
304
|
<WrapperDiv
|
|
305
305
|
width={width ?? style?.width}
|
|
306
306
|
height={height ?? style?.height}
|
|
@@ -325,6 +325,6 @@ export function RechartsWrapper(props: RechartsWrapperProps) {
|
|
|
325
325
|
<EventSynchronizer />
|
|
326
326
|
{children}
|
|
327
327
|
</WrapperDiv>
|
|
328
|
-
</LegendPortalContext
|
|
329
|
-
</TooltipPortalContext
|
|
328
|
+
</LegendPortalContext>
|
|
329
|
+
</TooltipPortalContext>;
|
|
330
330
|
}
|
package/src/chart/Sankey.tsrx
CHANGED
|
@@ -12,9 +12,9 @@ import sumBy from 'es-toolkit/compat/sumBy';
|
|
|
12
12
|
import get from 'es-toolkit/compat/get';
|
|
13
13
|
import { Surface } from '../container/Surface.tsrx';
|
|
14
14
|
import { Layer } from '../container/Layer.tsrx';
|
|
15
|
-
import { Props as RectangleProps, Rectangle } from '../shape/Rectangle.tsrx';
|
|
15
|
+
import { type Props as RectangleProps, Rectangle } from '../shape/Rectangle.tsrx';
|
|
16
16
|
import { getValueByDataKey } from '../util/ChartUtils';
|
|
17
|
-
import {
|
|
17
|
+
import type {
|
|
18
18
|
Coordinate,
|
|
19
19
|
DataKey,
|
|
20
20
|
EventThrottlingProps,
|
|
@@ -37,24 +37,24 @@ import {
|
|
|
37
37
|
mouseLeaveItem,
|
|
38
38
|
setActiveClickItemIndex,
|
|
39
39
|
setActiveMouseOverItemIndex,
|
|
40
|
-
TooltipIndex,
|
|
41
|
-
TooltipPayloadConfiguration,
|
|
42
|
-
TooltipPayloadSearcher,
|
|
40
|
+
type TooltipIndex,
|
|
41
|
+
type TooltipPayloadConfiguration,
|
|
42
|
+
type TooltipPayloadSearcher,
|
|
43
43
|
} from '../state/tooltipSlice';
|
|
44
44
|
import { SetTooltipEntrySettings } from '../state/SetTooltipEntrySettings';
|
|
45
|
-
import { ChartOptions } from '../state/optionsSlice';
|
|
45
|
+
import type { ChartOptions } from '../state/optionsSlice';
|
|
46
46
|
import { ReportEventSettings } from '../state/ReportEventSettings';
|
|
47
47
|
import { SetComputedData } from '../context/chartDataContext';
|
|
48
48
|
import {
|
|
49
49
|
svgPropertiesNoEvents,
|
|
50
50
|
svgPropertiesNoEventsFromUnknown,
|
|
51
51
|
} from '../util/svgPropertiesNoEvents';
|
|
52
|
-
import { RequiresDefaultProps, resolveDefaultProps } from '../util/resolveDefaultProps';
|
|
52
|
+
import { type RequiresDefaultProps, resolveDefaultProps } from '../util/resolveDefaultProps';
|
|
53
53
|
import { isPositiveNumber } from '../util/isWellBehavedNumber';
|
|
54
54
|
import { isNotNil, noop } from '../util/DataUtils';
|
|
55
|
-
import { WithIdRequired } from '../util/useUniqueId';
|
|
55
|
+
import type { WithIdRequired } from '../util/useUniqueId';
|
|
56
56
|
import { RegisterGraphicalItemId } from '../context/RegisterGraphicalItemId.tsrx';
|
|
57
|
-
import { GraphicalItemId } from '../state/graphicalItemsSlice';
|
|
57
|
+
import type { GraphicalItemId } from '../state/graphicalItemsSlice';
|
|
58
58
|
import { initialEventSettingsState } from '../state/eventSettingsSlice';
|
|
59
59
|
|
|
60
60
|
const interpolationGenerator = (a: number, b: number) => {
|
|
@@ -1516,7 +1516,7 @@ export function Sankey(outsideProps: Props) {
|
|
|
1516
1516
|
onTouchMove={undefined}
|
|
1517
1517
|
onTouchEnd={undefined}
|
|
1518
1518
|
>
|
|
1519
|
-
<TooltipPortalContext
|
|
1519
|
+
<TooltipPortalContext value={tooltipPortal}>
|
|
1520
1520
|
<RegisterGraphicalItemId id={externalId} type="sankey">
|
|
1521
1521
|
{(id) => <>
|
|
1522
1522
|
<SetSankeyTooltipEntrySettings
|
|
@@ -1532,7 +1532,7 @@ export function Sankey(outsideProps: Props) {
|
|
|
1532
1532
|
<SankeyImpl {...props} id={id} />
|
|
1533
1533
|
</>}
|
|
1534
1534
|
</RegisterGraphicalItemId>
|
|
1535
|
-
</TooltipPortalContext
|
|
1535
|
+
</TooltipPortalContext>
|
|
1536
1536
|
</RechartsWrapper>
|
|
1537
1537
|
</RechartsStoreProvider>;
|
|
1538
1538
|
}
|
|
@@ -2,7 +2,7 @@ import type { Ref } from '../util/OctaneTypes.ts';
|
|
|
2
2
|
|
|
3
3
|
import { arrayTooltipSearcher } from '../state/optionsSlice';
|
|
4
4
|
import { CartesianChart } from './CartesianChart.tsrx';
|
|
5
|
-
import { CartesianChartProps, TooltipEventType } from '../util/types';
|
|
5
|
+
import type { CartesianChartProps, TooltipEventType } from '../util/types';
|
|
6
6
|
|
|
7
7
|
const allowedTooltipTypes: ReadonlyArray<TooltipEventType> = ['item'];
|
|
8
8
|
|
|
@@ -7,7 +7,7 @@ import get from 'es-toolkit/compat/get';
|
|
|
7
7
|
import { Surface } from '../container/Surface.tsrx';
|
|
8
8
|
import { Layer } from '../container/Layer.tsrx';
|
|
9
9
|
import { Sector } from '../shape/Sector.tsrx';
|
|
10
|
-
import { Text, Props as TextProps } from '../component/Text.tsrx';
|
|
10
|
+
import { Text, type Props as TextProps } from '../component/Text.tsrx';
|
|
11
11
|
import { polarToCartesian } from '../util/PolarUtils';
|
|
12
12
|
import {
|
|
13
13
|
ReportChartMargin,
|
|
@@ -21,19 +21,25 @@ import {
|
|
|
21
21
|
mouseLeaveItem,
|
|
22
22
|
setActiveClickItemIndex,
|
|
23
23
|
setActiveMouseOverItemIndex,
|
|
24
|
-
TooltipIndex,
|
|
25
|
-
TooltipPayloadConfiguration,
|
|
26
|
-
TooltipPayloadSearcher,
|
|
24
|
+
type TooltipIndex,
|
|
25
|
+
type TooltipPayloadConfiguration,
|
|
26
|
+
type TooltipPayloadSearcher,
|
|
27
27
|
} from '../state/tooltipSlice';
|
|
28
28
|
import { SetTooltipEntrySettings } from '../state/SetTooltipEntrySettings';
|
|
29
29
|
import { RechartsStoreProvider } from '../state/RechartsStoreProvider.tsrx';
|
|
30
30
|
import { ReportEventSettings } from '../state/ReportEventSettings';
|
|
31
|
-
import {
|
|
31
|
+
import type {
|
|
32
|
+
ChartCoordinate,
|
|
33
|
+
DataKey,
|
|
34
|
+
EventThrottlingProps,
|
|
35
|
+
Margin,
|
|
36
|
+
Percent,
|
|
37
|
+
} from '../util/types';
|
|
32
38
|
import { useAppDispatch } from '../state/hooks';
|
|
33
|
-
import { RechartsRootState } from '../state/store';
|
|
39
|
+
import type { RechartsRootState } from '../state/store';
|
|
34
40
|
import { RegisterGraphicalItemId } from '../context/RegisterGraphicalItemId.tsrx';
|
|
35
|
-
import { WithIdRequired } from '../util/useUniqueId';
|
|
36
|
-
import { RequiresDefaultProps, resolveDefaultProps } from '../util/resolveDefaultProps';
|
|
41
|
+
import type { WithIdRequired } from '../util/useUniqueId';
|
|
42
|
+
import { type RequiresDefaultProps, resolveDefaultProps } from '../util/resolveDefaultProps';
|
|
37
43
|
import { initialEventSettingsState } from '../state/eventSettingsSlice';
|
|
38
44
|
|
|
39
45
|
export interface SunburstData {
|
|
@@ -469,7 +475,7 @@ export const SunburstChart = (outsideProps: SunburstChartProps) => {
|
|
|
469
475
|
<ReportChartSize width={width} height={height} />
|
|
470
476
|
<ReportChartMargin margin={defaultSunburstMargin} />
|
|
471
477
|
<ReportEventSettings throttleDelay={throttleDelay} throttledEvents={throttledEvents} />
|
|
472
|
-
<TooltipPortalContext
|
|
478
|
+
<TooltipPortalContext value={tooltipPortal}>
|
|
473
479
|
<RechartsWrapper
|
|
474
480
|
className={className}
|
|
475
481
|
width={width}
|
|
@@ -497,6 +503,6 @@ export const SunburstChart = (outsideProps: SunburstChartProps) => {
|
|
|
497
503
|
{(id) => <SunburstChartImpl {...props} id={id} />}
|
|
498
504
|
</RegisterGraphicalItemId>
|
|
499
505
|
</RechartsWrapper>
|
|
500
|
-
</TooltipPortalContext
|
|
506
|
+
</TooltipPortalContext>
|
|
501
507
|
</RechartsStoreProvider>;
|
|
502
508
|
};
|
|
@@ -3,12 +3,12 @@ import * as React from 'octane';
|
|
|
3
3
|
import { cloneElement, createElement, isValidElement } from 'octane';
|
|
4
4
|
import { clsx } from 'clsx';
|
|
5
5
|
import {
|
|
6
|
-
ChartOffsetInternal,
|
|
7
|
-
Coordinate,
|
|
6
|
+
type ChartOffsetInternal,
|
|
7
|
+
type Coordinate,
|
|
8
8
|
isPolarCoordinate,
|
|
9
|
-
LayoutType,
|
|
10
|
-
PolarCoordinate,
|
|
11
|
-
TooltipEventType,
|
|
9
|
+
type LayoutType,
|
|
10
|
+
type PolarCoordinate,
|
|
11
|
+
type TooltipEventType,
|
|
12
12
|
} from '../util/types';
|
|
13
13
|
import { Curve } from '../shape/Curve.tsrx';
|
|
14
14
|
import { Cross } from '../shape/Cross.tsrx';
|
|
@@ -20,9 +20,9 @@ import { getCursorPoints } from '../util/cursor/getCursorPoints';
|
|
|
20
20
|
import { useChartLayout, useOffsetInternal } from '../context/chartLayoutContext';
|
|
21
21
|
import { useTooltipAxisBandSize } from '../context/useTooltipAxis';
|
|
22
22
|
import { useChartName } from '../state/selectors/selectors';
|
|
23
|
-
import { TooltipIndex, TooltipPayload } from '../state/tooltipSlice';
|
|
23
|
+
import type { TooltipIndex, TooltipPayload } from '../state/tooltipSlice';
|
|
24
24
|
import { svgPropertiesNoEventsFromUnknown } from '../util/svgPropertiesNoEvents';
|
|
25
|
-
import { ZIndexable, ZIndexLayer } from '../zIndex/ZIndexLayer.tsrx';
|
|
25
|
+
import { type ZIndexable, ZIndexLayer } from '../zIndex/ZIndexLayer.tsrx';
|
|
26
26
|
import { DefaultZIndexes } from '../zIndex/DefaultZIndexes';
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -10,13 +10,13 @@ import { clsx } from 'clsx';
|
|
|
10
10
|
import { Surface } from '../container/Surface.tsrx';
|
|
11
11
|
import { Symbols } from '../shape/Symbols.tsrx';
|
|
12
12
|
import {
|
|
13
|
-
DataKey,
|
|
14
|
-
LegendType,
|
|
13
|
+
type DataKey,
|
|
14
|
+
type LegendType,
|
|
15
15
|
adaptEventsOfChild,
|
|
16
|
-
PresentationAttributesAdaptChildEvent,
|
|
17
|
-
CartesianLayout,
|
|
16
|
+
type PresentationAttributesAdaptChildEvent,
|
|
17
|
+
type CartesianLayout,
|
|
18
18
|
} from '../util/types';
|
|
19
|
-
import { RequiresDefaultProps, resolveDefaultProps } from '../util/resolveDefaultProps';
|
|
19
|
+
import { type RequiresDefaultProps, resolveDefaultProps } from '../util/resolveDefaultProps';
|
|
20
20
|
|
|
21
21
|
const SIZE = 32;
|
|
22
22
|
export type ContentType = OctaneElement | ((props: Props) => OctaneNode);
|
|
@@ -8,8 +8,8 @@ import * as React from 'octane';
|
|
|
8
8
|
import sortBy from 'es-toolkit/compat/sortBy';
|
|
9
9
|
import { clsx } from 'clsx';
|
|
10
10
|
import { isNullish, isNumOrStr } from '../util/DataUtils';
|
|
11
|
-
import { DataKey } from '../util/types';
|
|
12
|
-
import { TooltipPayload, TooltipPayloadEntry } from '../state/tooltipSlice';
|
|
11
|
+
import type { DataKey } from '../util/types';
|
|
12
|
+
import type { TooltipPayload, TooltipPayloadEntry } from '../state/tooltipSlice';
|
|
13
13
|
|
|
14
14
|
function defaultFormatter(value: ValueType | undefined): OctaneNode {
|
|
15
15
|
return Array.isArray(value) && isNumOrStr(value[0]) && isNumOrStr(value[1])
|
package/src/component/Label.tsrx
CHANGED
|
@@ -92,7 +92,7 @@ export function CartesianLabelContextProvider(props: TrapezoidViewBox & {
|
|
|
92
92
|
width,
|
|
93
93
|
height,
|
|
94
94
|
]);
|
|
95
|
-
<CartesianLabelContext
|
|
95
|
+
<CartesianLabelContext value={viewBox}>{children}</CartesianLabelContext>
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
function useCartesianLabelContext() {
|
|
@@ -112,7 +112,7 @@ export function PolarLabelContextProvider(props: PolarViewBoxRequired & {
|
|
|
112
112
|
() => ({ cx, cy, innerRadius, outerRadius, startAngle, endAngle, clockWise }),
|
|
113
113
|
[cx, cy, innerRadius, outerRadius, startAngle, endAngle, clockWise],
|
|
114
114
|
);
|
|
115
|
-
<PolarLabelContext
|
|
115
|
+
<PolarLabelContext value={viewBox}>{children}</PolarLabelContext>
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
export function usePolarLabelContext() {
|
|
@@ -64,11 +64,11 @@ const defaultAccessor = (entry: LabelListEntry) => {
|
|
|
64
64
|
const CartesianLabelListContext = createContext<ReadonlyArray<CartesianLabelListEntry> | undefined>(
|
|
65
65
|
undefined,
|
|
66
66
|
);
|
|
67
|
-
export const CartesianLabelListContextProvider = CartesianLabelListContext
|
|
67
|
+
export const CartesianLabelListContextProvider = CartesianLabelListContext;
|
|
68
68
|
const PolarLabelListContext = createContext<ReadonlyArray<PolarLabelListEntry> | undefined>(
|
|
69
69
|
undefined,
|
|
70
70
|
);
|
|
71
|
-
export const PolarLabelListContextProvider = PolarLabelListContext
|
|
71
|
+
export const PolarLabelListContextProvider = PolarLabelListContext;
|
|
72
72
|
|
|
73
73
|
function useCartesianLabelListContext() {
|
|
74
74
|
return useContext(CartesianLabelListContext);
|
|
@@ -4,19 +4,19 @@ import { useLayoutEffect } from 'octane';
|
|
|
4
4
|
import { createPortal } from 'octane';
|
|
5
5
|
import { useLegendPortal } from '../context/legendPortalContext';
|
|
6
6
|
import {
|
|
7
|
-
ContentType,
|
|
7
|
+
type ContentType,
|
|
8
8
|
DefaultLegendContent,
|
|
9
|
-
LegendPayload,
|
|
10
|
-
Props as DefaultLegendContentProps,
|
|
11
|
-
VerticalAlignmentType,
|
|
9
|
+
type LegendPayload,
|
|
10
|
+
type Props as DefaultLegendContentProps,
|
|
11
|
+
type VerticalAlignmentType,
|
|
12
12
|
} from './DefaultLegendContent.tsrx';
|
|
13
13
|
|
|
14
|
-
import { LayoutType, Margin, Size } from '../util/types';
|
|
15
|
-
import { getUniqPayload, UniqueOption } from '../util/payload/getUniqPayload';
|
|
14
|
+
import type { LayoutType, Margin, Size } from '../util/types';
|
|
15
|
+
import { getUniqPayload, type UniqueOption } from '../util/payload/getUniqPayload';
|
|
16
16
|
import { useLegendPayload } from '../context/legendPayloadContext.tsrx';
|
|
17
|
-
import { ElementOffset, useElementOffset } from '../util/useElementOffset';
|
|
17
|
+
import { type ElementOffset, useElementOffset } from '../util/useElementOffset';
|
|
18
18
|
import { useChartHeight, useChartWidth, useMargin } from '../context/chartLayoutContext';
|
|
19
|
-
import { LegendSettings, setLegendSettings, setLegendSize } from '../state/legendSlice';
|
|
19
|
+
import { type LegendSettings, setLegendSettings, setLegendSize } from '../state/legendSlice';
|
|
20
20
|
import { useAppDispatch } from '../state/hooks';
|
|
21
21
|
import { resolveDefaultProps } from '../util/resolveDefaultProps';
|
|
22
22
|
import { propsAreEqual } from '../util/propsAreEqual';
|
|
@@ -49,7 +49,7 @@ export interface Props extends Omit<
|
|
|
49
49
|
const initialDimension = defaultResponsiveContainerProps.initialDimension;
|
|
50
50
|
const ResponsiveContainerContext = createContext<ResponsiveContainerDimensions>(initialDimension);
|
|
51
51
|
|
|
52
|
-
export const ResponsiveContainerContextProviderInternal = ResponsiveContainerContext
|
|
52
|
+
export const ResponsiveContainerContextProviderInternal = ResponsiveContainerContext;
|
|
53
53
|
export const useResponsiveContainerContext = () => useContext(ResponsiveContainerContext);
|
|
54
54
|
export { initialDimension as defaultResponsiveContainerDimension };
|
|
55
55
|
|
|
@@ -4,20 +4,20 @@ import { useEffect } from 'octane';
|
|
|
4
4
|
import { createPortal } from 'octane';
|
|
5
5
|
import {
|
|
6
6
|
DefaultTooltipContent,
|
|
7
|
-
NameType,
|
|
8
|
-
Payload,
|
|
9
|
-
Props as DefaultTooltipContentProps,
|
|
10
|
-
TooltipItemSorter,
|
|
11
|
-
ValueType,
|
|
7
|
+
type NameType,
|
|
8
|
+
type Payload,
|
|
9
|
+
type Props as DefaultTooltipContentProps,
|
|
10
|
+
type TooltipItemSorter,
|
|
11
|
+
type ValueType,
|
|
12
12
|
} from './DefaultTooltipContent.tsrx';
|
|
13
13
|
import { TooltipBoundingBox } from './TooltipBoundingBox.tsrx';
|
|
14
14
|
|
|
15
|
-
import { getUniqPayload, UniqueOption } from '../util/payload/getUniqPayload';
|
|
16
|
-
import { AllowInDimension, AnimationDuration, EasingInput, Coordinate } from '../util/types';
|
|
15
|
+
import { getUniqPayload, type UniqueOption } from '../util/payload/getUniqPayload';
|
|
16
|
+
import type { AllowInDimension, AnimationDuration, EasingInput, Coordinate } from '../util/types';
|
|
17
17
|
import { useViewBox } from '../context/chartLayoutContext';
|
|
18
18
|
import { useAccessibilityLayer } from '../context/accessibilityContext';
|
|
19
19
|
import { useElementOffset } from '../util/useElementOffset';
|
|
20
|
-
import { Cursor, CursorDefinition } from './Cursor.tsrx';
|
|
20
|
+
import { Cursor, type CursorDefinition } from './Cursor.tsrx';
|
|
21
21
|
import {
|
|
22
22
|
selectActiveCoordinate,
|
|
23
23
|
selectActiveLabel,
|
|
@@ -29,11 +29,11 @@ import type { TooltipTrigger } from '../chart/types';
|
|
|
29
29
|
import { useAppDispatch, useAppSelector } from '../state/hooks';
|
|
30
30
|
import {
|
|
31
31
|
setTooltipSettingsState,
|
|
32
|
-
TooltipIndex,
|
|
33
|
-
TooltipPayload,
|
|
34
|
-
TooltipPayloadEntry,
|
|
32
|
+
type TooltipIndex,
|
|
33
|
+
type TooltipPayload,
|
|
34
|
+
type TooltipPayloadEntry,
|
|
35
35
|
} from '../state/tooltipSlice';
|
|
36
|
-
import { AxisId } from '../state/cartesianAxisSlice';
|
|
36
|
+
import type { AxisId } from '../state/cartesianAxisSlice';
|
|
37
37
|
import { useTooltipChartSynchronisation } from '../synchronisation/useChartSynchronisation.tsrx';
|
|
38
38
|
import { useTooltipEventType } from '../state/selectors/selectTooltipEventType';
|
|
39
39
|
import { resolveDefaultProps } from '../util/resolveDefaultProps';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CSSProperties, OctaneNode } from '../util/OctaneTypes.ts';
|
|
2
2
|
import * as React from 'octane';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import type {
|
|
5
5
|
AllowInDimension,
|
|
6
6
|
AnimationDuration,
|
|
7
7
|
EasingInput,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
Coordinate,
|
|
10
10
|
PolarCoordinate,
|
|
11
11
|
} from '../util/types';
|
|
12
|
-
import { ElementOffset, SetElementOffset } from '../util/useElementOffset';
|
|
12
|
+
import type { ElementOffset, SetElementOffset } from '../util/useElementOffset';
|
|
13
13
|
import { getTooltipTranslate } from '../util/tooltip/translate';
|
|
14
14
|
import { usePrefersReducedMotion } from '../util/usePrefersReducedMotion';
|
|
15
15
|
|
|
@@ -18,14 +18,14 @@ export function ClipPathProvider(props: {
|
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
20
|
const { x, y, width, height } = plotArea;
|
|
21
|
-
<ClipPathIdContext
|
|
21
|
+
<ClipPathIdContext value={clipPathId}>
|
|
22
22
|
<defs>
|
|
23
23
|
<clipPath id={clipPathId}>
|
|
24
24
|
<rect x={x} y={y} height={height} width={width} />
|
|
25
25
|
</clipPath>
|
|
26
26
|
</defs>
|
|
27
27
|
{children}
|
|
28
|
-
</ClipPathIdContext
|
|
28
|
+
</ClipPathIdContext>
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export const useClipPathId = () => {
|
|
@@ -33,7 +33,7 @@ function toCellArray(map: Map<object, CellProps>): RegisteredCell[] | undefined
|
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* Owns the collected cells state. Returns `[cells, registry]`; provide the
|
|
36
|
-
* registry via `<CellsContext
|
|
36
|
+
* registry via `<CellsContext value={registry}>` around the item's
|
|
37
37
|
* children, and pass `cells` wherever upstream passed findAllByType's result.
|
|
38
38
|
* `cells` is `undefined` until the first Cell registers — matching upstream,
|
|
39
39
|
* where a childless item passes an empty find result whose `cells[index]`
|
|
@@ -37,7 +37,7 @@ export function SetErrorBarContext<
|
|
|
37
37
|
children: OctaneNode;
|
|
38
38
|
}) {
|
|
39
39
|
const { children, ...rest } = props;
|
|
40
|
-
return <ErrorBarContext
|
|
40
|
+
return <ErrorBarContext value={rest}>{children}</ErrorBarContext>;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
export const useErrorBarContext = () => useContext(ErrorBarContext);
|
|
@@ -17,9 +17,7 @@ const GraphicalItemIdContext = createContext<GraphicalItemId | undefined>(undefi
|
|
|
17
17
|
export function RegisterGraphicalItemId(props: IdSetter) {
|
|
18
18
|
const { id, type, children } = props;
|
|
19
19
|
const resolvedId = useUniqueId('recharts-' + type, id);
|
|
20
|
-
return <GraphicalItemIdContext
|
|
21
|
-
resolvedId,
|
|
22
|
-
)}</GraphicalItemIdContext.Provider>;
|
|
20
|
+
return <GraphicalItemIdContext value={resolvedId}>{children(resolvedId)}</GraphicalItemIdContext>;
|
|
23
21
|
}
|
|
24
22
|
|
|
25
23
|
export function useGraphicalItemId() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LegendPayload } from '../component/DefaultLegendContent.tsrx';
|
|
1
|
+
import type { LegendPayload } from '../component/DefaultLegendContent.tsrx';
|
|
2
2
|
import { useAppSelector } from '../state/hooks';
|
|
3
3
|
import { selectLegendPayload } from '../state/selectors/legendSelectors';
|
|
4
4
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// Adapted from recharts@3.9.2, commit b3451050c027a23957ffa50a2665c9119df21e47.
|
|
2
2
|
import type { NativeMouseEvent } from '../util/OctaneTypes';
|
|
3
3
|
|
|
4
|
-
import { Coordinate, DataKey } from '../util/types';
|
|
4
|
+
import type { Coordinate, DataKey } from '../util/types';
|
|
5
5
|
import { useAppDispatch } from '../state/hooks';
|
|
6
6
|
import {
|
|
7
7
|
mouseLeaveItem,
|
|
8
8
|
setActiveClickItemIndex,
|
|
9
9
|
setActiveMouseOverItemIndex,
|
|
10
|
-
TooltipPayload,
|
|
10
|
+
type TooltipPayload,
|
|
11
11
|
} from '../state/tooltipSlice';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useAppSelector } from '../state/hooks';
|
|
2
2
|
import { getBandSizeOfAxis } from '../util/ChartUtils';
|
|
3
|
-
import { RenderableAxisSettings, selectTooltipAxis } from '../state/selectors/axisSelectors';
|
|
3
|
+
import { type RenderableAxisSettings, selectTooltipAxis } from '../state/selectors/axisSelectors';
|
|
4
4
|
import {
|
|
5
5
|
selectTooltipAxisScale,
|
|
6
6
|
selectTooltipAxisTicks,
|
package/src/hooks.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Adapted from recharts@3.9.2, commit b3451050c027a23957ffa50a2665c9119df21e47.
|
|
2
|
-
import { AxisId, defaultAxisId } from './state/cartesianAxisSlice';
|
|
2
|
+
import { type AxisId, defaultAxisId } from './state/cartesianAxisSlice';
|
|
3
3
|
import {
|
|
4
|
-
BaseAxisWithScale,
|
|
4
|
+
type BaseAxisWithScale,
|
|
5
5
|
selectAxisDomain,
|
|
6
6
|
selectAxisInverseScale,
|
|
7
7
|
selectAxisInverseDataSnapScale,
|
|
@@ -18,12 +18,12 @@ import {
|
|
|
18
18
|
selectActiveTooltipDataPoints,
|
|
19
19
|
selectIsTooltipActive,
|
|
20
20
|
} from './state/selectors/tooltipSelectors';
|
|
21
|
-
import { ChartOffset, PlotArea } from './types';
|
|
21
|
+
import type { ChartOffset, PlotArea } from './types';
|
|
22
22
|
import { selectChartOffset } from './state/selectors/selectChartOffset';
|
|
23
23
|
import { selectPlotArea } from './state/selectors/selectPlotArea';
|
|
24
|
-
import { CategoricalDomain, Coordinate, NumberDomain, TickItem } from './util/types';
|
|
25
|
-
import { ActiveLabel } from './synchronisation/types';
|
|
26
|
-
import { BandPosition } from './util/scale/RechartsScale';
|
|
24
|
+
import type { CategoricalDomain, Coordinate, NumberDomain, TickItem } from './util/types';
|
|
25
|
+
import type { ActiveLabel } from './synchronisation/types';
|
|
26
|
+
import type { BandPosition } from './util/scale/RechartsScale';
|
|
27
27
|
|
|
28
28
|
export const useXAxis = (xAxisId: AxisId): BaseAxisWithScale | undefined => {
|
|
29
29
|
const isPanorama = useIsPanorama();
|