From afe3ba9c38a9300c720895c51b5a0d09631eace9 Mon Sep 17 00:00:00 2001 From: Mark McDowell Date: Mon, 31 Aug 2020 22:59:36 +0100 Subject: [PATCH] fix(interactive): correcting exports Adding index files and exporting components. Resolves #440 --- .../interactive/src/EquidistantChannel.tsx | 31 ++++---- .../interactive/src/FibonacciRetracement.tsx | 32 ++++----- packages/interactive/src/GannFan.tsx | 29 ++++---- packages/interactive/src/InteractiveText.tsx | 24 +++---- .../src/InteractiveYCoordinate.tsx | 24 +++---- .../src/StandardDeviationChannel.tsx | 23 +++--- packages/interactive/src/TrendLine.tsx | 26 +++---- packages/interactive/src/ZoomButtons.tsx | 8 +-- .../src/components/ChannelWithArea.tsx | 4 +- .../src/components/ClickableShape.tsx | 10 +-- .../interactive/src/components/GannFan.tsx | 4 +- .../src/components/HoverTextNearMouse.tsx | 2 +- ...htLine.tsx => InteractiveStraightLine.tsx} | 12 ++-- .../src/components/InteractiveYCoordinate.tsx | 8 +-- .../LinearRegressionChannelWithArea.tsx | 4 +- .../src/components/MouseLocationIndicator.tsx | 2 +- packages/interactive/src/components/Text.tsx | 2 +- packages/interactive/src/components/index.ts | 11 +++ packages/interactive/src/index.ts | 1 + .../src/wrapper/EachEquidistantChannel.tsx | 42 +++++------ .../src/wrapper/EachFibRetracement.tsx | 51 ++++++-------- .../interactive/src/wrapper/EachGannFan.tsx | 70 +++++++++---------- .../wrapper/EachInteractiveYCoordinate.tsx | 13 ++-- .../wrapper/EachLinearRegressionChannel.tsx | 7 +- packages/interactive/src/wrapper/EachText.tsx | 57 ++++++++------- .../interactive/src/wrapper/EachTrendLine.tsx | 10 +-- packages/interactive/src/wrapper/index.ts | 7 ++ 27 files changed, 250 insertions(+), 264 deletions(-) rename packages/interactive/src/components/{StraightLine.tsx => InteractiveStraightLine.tsx} (96%) create mode 100644 packages/interactive/src/components/index.ts create mode 100644 packages/interactive/src/wrapper/index.ts diff --git a/packages/interactive/src/EquidistantChannel.tsx b/packages/interactive/src/EquidistantChannel.tsx index c34015965..2ec6f91fd 100644 --- a/packages/interactive/src/EquidistantChannel.tsx +++ b/packages/interactive/src/EquidistantChannel.tsx @@ -1,10 +1,9 @@ import * as React from "react"; import { isDefined, isNotDefined, noop } from "@react-financial-charts/core"; -import { HoverTextNearMouse } from "./components/HoverTextNearMouse"; -import { MouseLocationIndicator } from "./components/MouseLocationIndicator"; -import { getSlope, getYIntercept } from "./components/StraightLine"; +import { HoverTextNearMouse, MouseLocationIndicator } from "./components"; +import { getSlope, getYIntercept } from "./components/InteractiveStraightLine"; import { isHoverForInteractiveType, saveNodeType, terminate } from "./utils"; -import { EachEquidistantChannel } from "./wrapper/EachEquidistantChannel"; +import { EachEquidistantChannel } from "./wrapper"; interface EquidistantChannelProps { readonly enabled: boolean; @@ -15,20 +14,19 @@ interface EquidistantChannelProps { readonly currentPositionStrokeWidth?: number; readonly currentPositionOpacity?: number; readonly currentPositionRadius?: number; - // eslint-disable-next-line @typescript-eslint/ban-types readonly hoverText: object; readonly channels: any[]; readonly appearance: { - stroke: string; - strokeOpacity: number; - strokeWidth: number; - fill: string; - fillOpacity: number; - edgeStroke: string; - edgeFill: string; - edgeFill2: string; - edgeStrokeWidth: number; - r: number; + readonly stroke: string; + readonly strokeOpacity: number; + readonly strokeWidth: number; + readonly fill: string; + readonly fillOpacity: number; + readonly edgeStroke: string; + readonly edgeFill: string; + readonly edgeFill2: string; + readonly edgeStrokeWidth: number; + readonly r: number; }; } @@ -70,7 +68,7 @@ export class EquidistantChannel extends React.Component void; private saveNodeType: any; // @ts-ignore - private getSelectionState; + private getSelectionState: any; private mouseMoved: any; public constructor(props: EquidistantChannelProps) { @@ -78,7 +76,6 @@ export class EquidistantChannel extends React.Component void; readonly onDragComplete?: (e: React.MouseEvent, newTextList: any[], moreProps: any) => void; readonly onSelect?: (e: React.MouseEvent, interactives: any[], moreProps: any) => void; readonly defaultText: { - bgFill: string; - bgOpacity: number; - bgStrokeWidth?: number; - bgStroke?: string; - textFill: string; - fontFamily: string; - fontWeight: string; - fontStyle: string; - fontSize: number; - text: string; + readonly bgFill: string; + readonly bgOpacity: number; + readonly bgStrokeWidth?: number; + readonly bgStroke?: string; + readonly textFill: string; + readonly fontFamily: string; + readonly fontWeight: string; + readonly fontStyle: string; + readonly fontSize: number; + readonly text: string; }; readonly hoverText: object; readonly textList: any[]; diff --git a/packages/interactive/src/InteractiveYCoordinate.tsx b/packages/interactive/src/InteractiveYCoordinate.tsx index 0b0cadcc1..6cf498b6e 100644 --- a/packages/interactive/src/InteractiveYCoordinate.tsx +++ b/packages/interactive/src/InteractiveYCoordinate.tsx @@ -1,10 +1,10 @@ +import { format } from "d3-format"; import * as PropTypes from "prop-types"; import * as React from "react"; -import { format } from "d3-format"; import { isDefined, strokeDashTypes } from "@react-financial-charts/core"; -import { HoverTextNearMouse } from "./components/HoverTextNearMouse"; +import { HoverTextNearMouse } from "./components"; import { getValueFromOverride, isHoverForInteractiveType, saveNodeType, terminate } from "./utils"; -import { EachInteractiveYCoordinate } from "./wrapper/EachInteractiveYCoordinate"; +import { EachInteractiveYCoordinate } from "./wrapper"; interface InteractiveYCoordinateProps { readonly onChoosePosition: (e: React.MouseEvent, newText: any, moreProps: any) => void; @@ -25,13 +25,13 @@ interface InteractiveYCoordinateProps { readonly fontSize: number; readonly text: string; readonly textBox: { - height: number; - left: number; - padding: { + readonly height: number; + readonly left: number; + readonly padding: { left: number; right: number; }; - closeIcon: { + readonly closeIcon: { padding: { left: number; right: number; @@ -40,11 +40,11 @@ interface InteractiveYCoordinateProps { }; }; readonly edge: { - stroke: string; - strokeOpacity: number; - strokeWidth: number; - fill: string; - fillOpacity: number; + readonly stroke: string; + readonly strokeOpacity: number; + readonly strokeWidth: number; + readonly fill: string; + readonly fillOpacity: number; }; }; readonly hoverText: object; diff --git a/packages/interactive/src/StandardDeviationChannel.tsx b/packages/interactive/src/StandardDeviationChannel.tsx index f590ed5ef..117603b5d 100644 --- a/packages/interactive/src/StandardDeviationChannel.tsx +++ b/packages/interactive/src/StandardDeviationChannel.tsx @@ -1,9 +1,8 @@ import * as React from "react"; import { isDefined, isNotDefined } from "@react-financial-charts/core"; import { getValueFromOverride, isHoverForInteractiveType, saveNodeType, terminate } from "./utils"; -import { HoverTextNearMouse } from "./components/HoverTextNearMouse"; -import { MouseLocationIndicator } from "./components/MouseLocationIndicator"; -import { EachLinearRegressionChannel } from "./wrapper/EachLinearRegressionChannel"; +import { HoverTextNearMouse, MouseLocationIndicator } from "./components"; +import { EachLinearRegressionChannel } from "./wrapper"; export interface StandardDeviationChannelProps { readonly enabled: boolean; @@ -16,15 +15,15 @@ export interface StandardDeviationChannelProps { readonly currentPositionOpacity?: number; readonly currentPositionRadius?: number; readonly appearance: { - stroke?: string; - strokeOpacity?: number; - strokeWidth?: number; - fill?: string; - fillOpacity?: number; - edgeStrokeWidth?: number; - edgeStroke?: string; - edgeFill?: string; - r?: number; + readonly stroke?: string; + readonly strokeOpacity?: number; + readonly strokeWidth?: number; + readonly fill?: string; + readonly fillOpacity?: number; + readonly edgeStrokeWidth?: number; + readonly edgeStroke?: string; + readonly edgeFill?: string; + readonly r?: number; }; readonly hoverText: object; readonly channels: any[]; diff --git a/packages/interactive/src/TrendLine.tsx b/packages/interactive/src/TrendLine.tsx index fc0bb6508..07bbadd78 100644 --- a/packages/interactive/src/TrendLine.tsx +++ b/packages/interactive/src/TrendLine.tsx @@ -1,15 +1,10 @@ import * as React from "react"; - import { isDefined, isNotDefined, noop, strokeDashTypes } from "@react-financial-charts/core"; - import { getValueFromOverride, isHoverForInteractiveType, saveNodeType, terminate } from "./utils"; +import { HoverTextNearMouse, MouseLocationIndicator, InteractiveStraightLine } from "./components"; +import { EachTrendLine } from "./wrapper"; -import { HoverTextNearMouse } from "./components/HoverTextNearMouse"; -import { MouseLocationIndicator } from "./components/MouseLocationIndicator"; -import StraightLine from "./components/StraightLine"; -import { EachTrendLine } from "./wrapper/EachTrendLine"; - -interface TrendLineProps { +export interface TrendLineProps { readonly snap: boolean; readonly enabled: boolean; readonly snapTo: (datum: any) => number; @@ -25,16 +20,15 @@ interface TrendLineProps { | "XLINE" // extends from -Infinity to +Infinity | "RAY" // extends to +/-Infinity in one direction | "LINE"; // extends between the set bounds - // eslint-disable-next-line @typescript-eslint/ban-types readonly hoverText: object; readonly trends: any[]; readonly appearance: { - strokeStyle: string; - strokeWidth: number; - strokeDasharray: strokeDashTypes; - edgeStrokeWidth: number; - edgeFill: string; - edgeStroke: string; + readonly strokeStyle: string; + readonly strokeWidth: number; + readonly strokeDasharray: strokeDashTypes; + readonly edgeStrokeWidth: number; + readonly edgeFill: string; + readonly edgeStroke: string; }; } @@ -112,7 +106,7 @@ export class TrendLine extends React.Component { const tempLine = isDefined(current) && isDefined(current.end) ? ( - { xAxisZoom: PropTypes.func.isRequired, }; - private interval?: any; + private interval?: number; public render() { const { chartConfig } = this.context; @@ -161,7 +161,7 @@ export class ZoomButtons extends React.Component { return [left(i), right(i)]; }); - this.interval = setInterval(() => { + this.interval = window.setInterval(() => { xAxisZoom(foo.shift()); if (foo.length === 0) { clearInterval(this.interval); diff --git a/packages/interactive/src/components/ChannelWithArea.tsx b/packages/interactive/src/components/ChannelWithArea.tsx index ee883d69f..52c4d9182 100644 --- a/packages/interactive/src/components/ChannelWithArea.tsx +++ b/packages/interactive/src/components/ChannelWithArea.tsx @@ -1,8 +1,8 @@ import * as React from "react"; import { isDefined, isNotDefined, getMouseCanvas, GenericChartComponent } from "@react-financial-charts/core"; -import { generateLine, isHovering } from "./StraightLine"; +import { generateLine, isHovering } from "./InteractiveStraightLine"; -interface ChannelWithAreaProps { +export interface ChannelWithAreaProps { readonly startXY?: number[]; readonly endXY?: number[]; readonly dy?: number; diff --git a/packages/interactive/src/components/ClickableShape.tsx b/packages/interactive/src/components/ClickableShape.tsx index e99d5349c..1645318f0 100644 --- a/packages/interactive/src/components/ClickableShape.tsx +++ b/packages/interactive/src/components/ClickableShape.tsx @@ -1,8 +1,8 @@ import * as React from "react"; import { getMouseCanvas, GenericChartComponent } from "@react-financial-charts/core"; -import { isHovering2 } from "./StraightLine"; +import { isHovering2 } from "./InteractiveStraightLine"; -interface ClickableShapeProps { +export interface ClickableShapeProps { readonly fontWeight: string; readonly fontFamily: string; readonly fontStyle: string; @@ -11,9 +11,9 @@ interface ClickableShapeProps { readonly strokeWidth: number; readonly text: string; readonly textBox: { - closeIcon: any; - left: number; - padding: any; + readonly closeIcon: any; + readonly left: number; + readonly padding: any; }; readonly hovering?: boolean; readonly interactiveCursorClass?: string; diff --git a/packages/interactive/src/components/GannFan.tsx b/packages/interactive/src/components/GannFan.tsx index 8aed12dea..7b6bf76d6 100644 --- a/packages/interactive/src/components/GannFan.tsx +++ b/packages/interactive/src/components/GannFan.tsx @@ -1,9 +1,9 @@ import { pairs } from "d3-array"; import * as React from "react"; -import { generateLine, isHovering2 } from "./StraightLine"; +import { generateLine, isHovering2 } from "./InteractiveStraightLine"; import { isDefined, isNotDefined, getMouseCanvas, GenericChartComponent } from "@react-financial-charts/core"; -interface GannFanProps { +export interface GannFanProps { readonly startXY: number[]; readonly defaultClassName?: string; readonly endXY: number[]; diff --git a/packages/interactive/src/components/HoverTextNearMouse.tsx b/packages/interactive/src/components/HoverTextNearMouse.tsx index 3f1ac0a45..e8b2f2aeb 100644 --- a/packages/interactive/src/components/HoverTextNearMouse.tsx +++ b/packages/interactive/src/components/HoverTextNearMouse.tsx @@ -4,7 +4,7 @@ import { isDefined, GenericChartComponent } from "@react-financial-charts/core"; const PADDING = 10; const MIN_WIDTH = PADDING; -interface HoverTextNearMouseProps { +export interface HoverTextNearMouseProps { readonly fontFamily?: string; readonly fontSize?: number; readonly fill?: string; diff --git a/packages/interactive/src/components/StraightLine.tsx b/packages/interactive/src/components/InteractiveStraightLine.tsx similarity index 96% rename from packages/interactive/src/components/StraightLine.tsx rename to packages/interactive/src/components/InteractiveStraightLine.tsx index 13f08a29a..360dacfed 100644 --- a/packages/interactive/src/components/StraightLine.tsx +++ b/packages/interactive/src/components/InteractiveStraightLine.tsx @@ -7,7 +7,7 @@ import { } from "@react-financial-charts/core"; import * as React from "react"; -interface StraightLineProps { +export interface StraightLineProps { readonly x1Value: any; readonly x2Value: any; readonly y1Value: any; @@ -37,7 +37,7 @@ interface StraightLineProps { readonly selected?: boolean; } -class StraightLine extends React.Component { +export class InteractiveStraightLine extends React.Component { public static defaultProps = { onEdge1Drag: noop, onEdge2Drag: noop, @@ -102,7 +102,11 @@ class StraightLine extends React.Component { }; private readonly drawOnCanvas = (ctx: CanvasRenderingContext2D, moreProps: any) => { - const { strokeWidth = StraightLine.defaultProps.strokeWidth, strokeDasharray, strokeStyle } = this.props; + const { + strokeWidth = InteractiveStraightLine.defaultProps.strokeWidth, + strokeDasharray, + strokeStyle, + } = this.props; const { x1, y1, x2, y2 } = helper(this.props, moreProps); ctx.lineWidth = strokeWidth; @@ -311,5 +315,3 @@ function getLineCoordinates({ start, end }: any) { y2, }; } - -export default StraightLine; diff --git a/packages/interactive/src/components/InteractiveYCoordinate.tsx b/packages/interactive/src/components/InteractiveYCoordinate.tsx index 61ae8ea55..170c5ddfd 100644 --- a/packages/interactive/src/components/InteractiveYCoordinate.tsx +++ b/packages/interactive/src/components/InteractiveYCoordinate.tsx @@ -21,10 +21,10 @@ export interface InteractiveYCoordinateProps { readonly text: string; readonly edge: object; readonly textBox: { - closeIcon: any; - left: number; - height: number; - padding: any; + readonly closeIcon: any; + readonly left: number; + readonly height: number; + readonly padding: any; }; readonly yValue: number; readonly onDragStart?: (e: React.MouseEvent, moreProps: any) => void; diff --git a/packages/interactive/src/components/LinearRegressionChannelWithArea.tsx b/packages/interactive/src/components/LinearRegressionChannelWithArea.tsx index f73c14c72..d36233545 100644 --- a/packages/interactive/src/components/LinearRegressionChannelWithArea.tsx +++ b/packages/interactive/src/components/LinearRegressionChannelWithArea.tsx @@ -1,9 +1,9 @@ import { deviation, sum, zip } from "d3-array"; import * as React from "react"; import { getClosestItemIndexes, getMouseCanvas, GenericChartComponent } from "@react-financial-charts/core"; -import { isHovering2 } from "./StraightLine"; +import { isHovering2 } from "./InteractiveStraightLine"; -interface LinearRegressionChannelWithAreaProps { +export interface LinearRegressionChannelWithAreaProps { readonly x1Value: any; readonly x2Value: any; readonly type: diff --git a/packages/interactive/src/components/MouseLocationIndicator.tsx b/packages/interactive/src/components/MouseLocationIndicator.tsx index adf19c423..3faed6c3b 100644 --- a/packages/interactive/src/components/MouseLocationIndicator.tsx +++ b/packages/interactive/src/components/MouseLocationIndicator.tsx @@ -10,7 +10,7 @@ import { import * as React from "react"; import { getXValue } from "@react-financial-charts/core/lib/utils/ChartDataUtil"; -interface MouseLocationIndicatorProps { +export interface MouseLocationIndicatorProps { readonly enabled: boolean; readonly snap: boolean; readonly shouldDisableSnap: (e: React.MouseEvent) => boolean; diff --git a/packages/interactive/src/components/Text.tsx b/packages/interactive/src/components/Text.tsx index 2675c8c68..01528df55 100644 --- a/packages/interactive/src/components/Text.tsx +++ b/packages/interactive/src/components/Text.tsx @@ -1,7 +1,7 @@ import * as React from "react"; import { getMouseCanvas, GenericChartComponent } from "@react-financial-charts/core"; -interface TextProps { +export interface TextProps { readonly children: string; readonly fontFamily: string; readonly fontSize: number; diff --git a/packages/interactive/src/components/index.ts b/packages/interactive/src/components/index.ts new file mode 100644 index 000000000..bc327ef34 --- /dev/null +++ b/packages/interactive/src/components/index.ts @@ -0,0 +1,11 @@ +export * from "./ChannelWithArea"; +export * from "./ClickableCircle"; +export * from "./ClickableShape"; +export * from "./GannFan"; +export * from "./HoverTextNearMouse"; +export * from "./InteractiveStraightLine"; +export * from "./InteractiveText"; +export * from "./InteractiveYCoordinate"; +export * from "./LinearRegressionChannelWithArea"; +export * from "./MouseLocationIndicator"; +export * from "./Text"; diff --git a/packages/interactive/src/index.ts b/packages/interactive/src/index.ts index c32ca473a..3d28034c8 100644 --- a/packages/interactive/src/index.ts +++ b/packages/interactive/src/index.ts @@ -9,3 +9,4 @@ export { InteractiveText } from "./InteractiveText"; export { InteractiveYCoordinate } from "./InteractiveYCoordinate"; export { DrawingObjectSelector } from "./DrawingObjectSelector"; export { ZoomButtons } from "./ZoomButtons"; +export * from "./utils"; diff --git a/packages/interactive/src/wrapper/EachEquidistantChannel.tsx b/packages/interactive/src/wrapper/EachEquidistantChannel.tsx index 2c2ce2fab..4cd3767d3 100644 --- a/packages/interactive/src/wrapper/EachEquidistantChannel.tsx +++ b/packages/interactive/src/wrapper/EachEquidistantChannel.tsx @@ -1,39 +1,35 @@ import * as React from "react"; - import { isDefined, noop } from "@react-financial-charts/core"; import { getXValue } from "@react-financial-charts/core/lib/utils/ChartDataUtil"; import { isHover, saveNodeType } from "../utils"; +import { ChannelWithArea, ClickableCircle, HoverTextNearMouse } from "../components"; -import { ChannelWithArea } from "../components/ChannelWithArea"; -import { ClickableCircle } from "../components/ClickableCircle"; -import { HoverTextNearMouse } from "../components/HoverTextNearMouse"; - -interface EachEquidistantChannelProps { +export interface EachEquidistantChannelProps { readonly startXY: number[]; readonly endXY: number[]; readonly dy?: number; readonly interactive: boolean; readonly selected: boolean; readonly hoverText: { - enable: boolean; - fontFamily: string; - fontSize: number; - fill: string; - text: string; - bgFill: string; - bgOpacity: number; - bgWidth: number | string; - bgHeight: number | string; + readonly enable: boolean; + readonly fontFamily: string; + readonly fontSize: number; + readonly fill: string; + readonly text: string; + readonly bgFill: string; + readonly bgOpacity: number; + readonly bgWidth: number | string; + readonly bgHeight: number | string; }; readonly appearance: { - stroke: string; - strokeWidth: number; - fill: string; - edgeStroke: string; - edgeFill: string; - edgeFill2: string; - edgeStrokeWidth: number; - r: number; + readonly stroke: string; + readonly strokeWidth: number; + readonly fill: string; + readonly edgeStroke: string; + readonly edgeFill: string; + readonly edgeFill2: string; + readonly edgeStrokeWidth: number; + readonly r: number; }; readonly index?: number; readonly onDrag: (e: React.MouseEvent, index: number | undefined, moreProps: any) => void; diff --git a/packages/interactive/src/wrapper/EachFibRetracement.tsx b/packages/interactive/src/wrapper/EachFibRetracement.tsx index 0fc8c4712..e1d244933 100644 --- a/packages/interactive/src/wrapper/EachFibRetracement.tsx +++ b/packages/interactive/src/wrapper/EachFibRetracement.tsx @@ -1,16 +1,11 @@ import * as React from "react"; - import { head, last, noop } from "@react-financial-charts/core"; import { getXValue } from "@react-financial-charts/core/lib/utils/ChartDataUtil"; import { isHover, saveNodeType } from "../utils"; - -import { ClickableCircle } from "../components/ClickableCircle"; -import { HoverTextNearMouse } from "../components/HoverTextNearMouse"; -import StraightLine, { generateLine } from "../components/StraightLine"; -import { Text } from "../components/Text"; +import { ClickableCircle, HoverTextNearMouse, InteractiveStraightLine, generateLine, Text } from "../components"; import { getNewXY } from "./EachTrendLine"; -interface EachFibRetracementProps { +export interface EachFibRetracementProps { readonly x1: any; readonly x2: any; readonly y1: number; @@ -19,29 +14,29 @@ interface EachFibRetracementProps { readonly type: string; readonly selected: boolean; readonly appearance: { - strokeStyle: string; - strokeWidth: number; - fontFamily: string; - fontSize: number; - fontFill: string; - edgeStroke: string; - edgeFill: string; - nsEdgeFill: string; - edgeStrokeWidth: number; - r: number; + readonly strokeStyle: string; + readonly strokeWidth: number; + readonly fontFamily: string; + readonly fontSize: number; + readonly fontFill: string; + readonly edgeStroke: string; + readonly edgeFill: string; + readonly nsEdgeFill: string; + readonly edgeStrokeWidth: number; + readonly r: number; }; readonly interactive: boolean; readonly hoverText: { - enable: boolean; - fontFamily: string; - fontSize: number; - fill: string; - text: string; - bgFill: string; - bgOpacity: number; - bgWidth: number | string; - bgHeight: number | string; - selectedText: string; + readonly enable: boolean; + readonly fontFamily: string; + readonly fontSize: number; + readonly fill: string; + readonly text: string; + readonly bgFill: string; + readonly bgOpacity: number; + readonly bgWidth: number | string; + readonly bgHeight: number | string; + readonly selectedText: string; }; readonly index?: number; readonly onDrag: (e: React.MouseEvent, index: number | undefined, moreProps: any) => void; @@ -165,7 +160,7 @@ export class EachFibRetracement extends React.Component - ; - fontFamily: string; - fontSize: number; - fontFill: string; +import { ClickableCircle, GannFan, HoverTextNearMouse } from "../components"; + +export interface EachGannFanProps { + readonly startXY: number[]; + readonly endXY: number[]; + readonly dy?: number; + readonly interactive: boolean; + readonly selected: boolean; + readonly appearance: { + readonly stroke: string; + readonly strokeWidth: number; + readonly edgeStroke: string; + readonly edgeFill: string; + readonly edgeStrokeWidth: number; + readonly r: number; + readonly fill: Array; + readonly fontFamily: string; + readonly fontSize: number; + readonly fontFill: string; }; - hoverText: { - enable: boolean; - fontFamily: string; - fontSize: number; - fill: string; - text: string; - bgFill: string; - bgOpacity: number; - bgWidth: number | string; - bgHeight: number | string; - selectedText: string; + readonly hoverText: { + readonly enable: boolean; + readonly fontFamily: string; + readonly fontSize: number; + readonly fill: string; + readonly text: string; + readonly bgFill: string; + readonly bgOpacity: number; + readonly bgWidth: number | string; + readonly bgHeight: number | string; + readonly selectedText: string; }; - index?: number; - onDrag: (e: React.MouseEvent, index: number | undefined, moreProps: any) => void; - onDragComplete?: (e: React.MouseEvent, moreProps: any) => void; + readonly index?: number; + readonly onDrag: (e: React.MouseEvent, index: number | undefined, moreProps: any) => void; + readonly onDragComplete?: (e: React.MouseEvent, moreProps: any) => void; } interface EachGannFanState { diff --git a/packages/interactive/src/wrapper/EachInteractiveYCoordinate.tsx b/packages/interactive/src/wrapper/EachInteractiveYCoordinate.tsx index bf1ad2a2f..5ebdeeafe 100644 --- a/packages/interactive/src/wrapper/EachInteractiveYCoordinate.tsx +++ b/packages/interactive/src/wrapper/EachInteractiveYCoordinate.tsx @@ -1,10 +1,9 @@ import * as React from "react"; import { strokeDashTypes } from "@react-financial-charts/core"; import { isHover, saveNodeType } from "../utils"; -import { ClickableShape } from "../components/ClickableShape"; -import { InteractiveYCoordinate } from "../components/InteractiveYCoordinate"; +import { ClickableShape, InteractiveYCoordinate } from "../components"; -interface EachInteractiveYCoordinateProps { +export interface EachInteractiveYCoordinateProps { readonly index?: number; readonly draggable: boolean; readonly yValue: number; @@ -21,10 +20,10 @@ interface EachInteractiveYCoordinateProps { readonly selected: boolean; readonly edge: object; readonly textBox: { - closeIcon: any; - left: number; - height: number; - padding: any; + readonly closeIcon: any; + readonly left: number; + readonly height: number; + readonly padding: any; }; readonly onDrag?: (e: React.MouseEvent, index: number | undefined, moreProps: any) => void; readonly onDragComplete?: (e: React.MouseEvent, moreProps: any) => void; diff --git a/packages/interactive/src/wrapper/EachLinearRegressionChannel.tsx b/packages/interactive/src/wrapper/EachLinearRegressionChannel.tsx index 333070d49..a81f0b411 100644 --- a/packages/interactive/src/wrapper/EachLinearRegressionChannel.tsx +++ b/packages/interactive/src/wrapper/EachLinearRegressionChannel.tsx @@ -1,17 +1,14 @@ import { getCurrentItem } from "@react-financial-charts/core/lib/utils/ChartDataUtil"; import * as React from "react"; import { isHover, saveNodeType } from "../utils"; - -import { HoverTextNearMouse } from "../components/HoverTextNearMouse"; +import { HoverTextNearMouse, ClickableCircle } from "../components"; import { edge1Provider, edge2Provider, LinearRegressionChannelWithArea, } from "../components/LinearRegressionChannelWithArea"; -import { ClickableCircle } from "../components/ClickableCircle"; - -interface EachLinearRegressionChannelProps { +export interface EachLinearRegressionChannelProps { readonly defaultClassName?: string; readonly x1Value: any; readonly x2Value: any; diff --git a/packages/interactive/src/wrapper/EachText.tsx b/packages/interactive/src/wrapper/EachText.tsx index 8751b050f..dcc4eaf8e 100644 --- a/packages/interactive/src/wrapper/EachText.tsx +++ b/packages/interactive/src/wrapper/EachText.tsx @@ -1,35 +1,34 @@ import * as React from "react"; import { getXValue } from "@react-financial-charts/core/lib/utils/ChartDataUtil"; import { isHover, saveNodeType } from "../utils"; -import { HoverTextNearMouse } from "../components/HoverTextNearMouse"; -import { InteractiveText } from "../components/InteractiveText"; - -interface EachTextProps { - index?: number; - position?: any; - bgFill: string; - bgStrokeWidth: number; - bgStroke?: string; - textFill: string; - fontWeight: string; - fontFamily: string; - fontStyle: string; - fontSize: number; - text: string; - selected: boolean; - onDrag?: (e: React.MouseEvent, index: number | undefined, xyValue: number[]) => void; - onDragComplete?: (e: React.MouseEvent, moreProps: any) => void; - hoverText: { - enable: boolean; - fontFamily: string; - fontSize: number; - fill: string; - text: string; - selectedText: string; - bgFill: string; - bgOpacity: number; - bgWidth: number | string; - bgHeight: number | string; +import { HoverTextNearMouse, InteractiveText } from "../components"; + +export interface EachTextProps { + readonly index?: number; + readonly position?: any; + readonly bgFill: string; + readonly bgStrokeWidth: number; + readonly bgStroke?: string; + readonly textFill: string; + readonly fontWeight: string; + readonly fontFamily: string; + readonly fontStyle: string; + readonly fontSize: number; + readonly text: string; + readonly selected: boolean; + readonly onDrag?: (e: React.MouseEvent, index: number | undefined, xyValue: number[]) => void; + readonly onDragComplete?: (e: React.MouseEvent, moreProps: any) => void; + readonly hoverText: { + readonly enable: boolean; + readonly fontFamily: string; + readonly fontSize: number; + readonly fill: string; + readonly text: string; + readonly selectedText: string; + readonly bgFill: string; + readonly bgOpacity: number; + readonly bgWidth: number | string; + readonly bgHeight: number | string; }; } diff --git a/packages/interactive/src/wrapper/EachTrendLine.tsx b/packages/interactive/src/wrapper/EachTrendLine.tsx index b4ed65305..3670fabd1 100644 --- a/packages/interactive/src/wrapper/EachTrendLine.tsx +++ b/packages/interactive/src/wrapper/EachTrendLine.tsx @@ -1,15 +1,11 @@ import * as React from "react"; - import { ascending as d3Ascending } from "d3-array"; import { noop, strokeDashTypes } from "@react-financial-charts/core"; import { getXValue } from "@react-financial-charts/core/lib/utils/ChartDataUtil"; import { isHover, saveNodeType } from "../utils"; +import { ClickableCircle, HoverTextNearMouse, InteractiveStraightLine } from "../components"; -import { ClickableCircle } from "../components/ClickableCircle"; -import { HoverTextNearMouse } from "../components/HoverTextNearMouse"; -import StraightLine from "../components/StraightLine"; - -interface EachTrendLineProps { +export interface EachTrendLineProps { readonly x1Value: any; readonly x2Value: any; readonly y1Value: any; @@ -121,7 +117,7 @@ export class EachTrendLine extends React.Component -