Skip to content

Commit

Permalink
fix(interactive): correcting exports
Browse files Browse the repository at this point in the history
Adding index files and exporting components.

Resolves react-financial#440
  • Loading branch information
markmcdowell committed Sep 1, 2020
1 parent 4957c32 commit afe3ba9
Show file tree
Hide file tree
Showing 27 changed files with 250 additions and 264 deletions.
31 changes: 14 additions & 17 deletions packages/interactive/src/EquidistantChannel.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
};
}

Expand Down Expand Up @@ -70,15 +68,14 @@ export class EquidistantChannel extends React.Component<EquidistantChannelProps,
private terminate: () => void;
private saveNodeType: any;
// @ts-ignore
private getSelectionState;
private getSelectionState: any;
private mouseMoved: any;

public constructor(props: EquidistantChannelProps) {
super(props);

this.terminate = terminate.bind(this);
this.saveNodeType = saveNodeType.bind(this);

this.getSelectionState = isHoverForInteractiveType("channels").bind(this);

this.state = {};
Expand Down
32 changes: 15 additions & 17 deletions packages/interactive/src/FibonacciRetracement.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
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 { HoverTextNearMouse, MouseLocationIndicator } from "./components";
import { isHoverForInteractiveType, saveNodeType, terminate } from "./utils";
import { EachFibRetracement } from "./wrapper/EachFibRetracement";
import { EachFibRetracement } from "./wrapper";

interface FibonacciRetracementProps {
readonly enabled: boolean;
Expand All @@ -22,17 +21,17 @@ interface FibonacciRetracementProps {
readonly currentPositionRadius?: number;
readonly retracements: any[];
readonly appearance: {
stroke: string;
strokeWidth: number;
strokeOpacity: number;
fontFamily: string;
fontSize: number;
fontFill: string;
edgeStroke: string;
edgeFill: string;
nsEdgeFill: string;
edgeStrokeWidth: number;
r: number;
readonly stroke: string;
readonly strokeWidth: number;
readonly strokeOpacity: 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;
};
}

Expand Down Expand Up @@ -75,12 +74,11 @@ export class FibonacciRetracement extends React.Component<FibonacciRetracementPr
};

// @ts-ignore
private getSelectionState;
private getSelectionState: any;
private mouseMoved: any;
private saveNodeType: any;

// @ts-ignore
private terminate;
private terminate: any;

public constructor(props: FibonacciRetracementProps) {
super(props);
Expand Down
29 changes: 14 additions & 15 deletions packages/interactive/src/GannFan.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
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 { HoverTextNearMouse, MouseLocationIndicator } from "./components";
import { isHoverForInteractiveType, saveNodeType, terminate } from "./utils";
import { EachGannFan } from "./wrapper/EachGannFan";
import { EachGannFan } from "./wrapper";

export interface GannFanProps {
readonly enabled: boolean;
Expand All @@ -15,18 +14,18 @@ export interface GannFanProps {
readonly currentPositionOpacity?: number;
readonly currentPositionRadius?: number;
readonly appearance: {
stroke: string;
strokeOpacity: number;
fillOpacity: number;
strokeWidth: number;
edgeStroke: string;
edgeFill: string;
edgeStrokeWidth: number;
r: number;
fill: string[];
fontFamily: string;
fontSize: number;
fontFill: string;
readonly stroke: string;
readonly strokeOpacity: number;
readonly fillOpacity: number;
readonly strokeWidth: number;
readonly edgeStroke: string;
readonly edgeFill: string;
readonly edgeStrokeWidth: number;
readonly r: number;
readonly fill: string[];
readonly fontFamily: string;
readonly fontSize: number;
readonly fontFill: string;
};
readonly hoverText: object;
readonly fans: any[];
Expand Down
24 changes: 12 additions & 12 deletions packages/interactive/src/InteractiveText.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import * as PropTypes from "prop-types";
import * as React from "react";
import { isDefined, noop, getMouseCanvas, GenericChartComponent } from "@react-financial-charts/core";
import { HoverTextNearMouse } from "./components/HoverTextNearMouse";
import { HoverTextNearMouse } from "./components";
import { getValueFromOverride, isHoverForInteractiveType, saveNodeType, terminate } from "./utils";
import { EachText } from "./wrapper/EachText";
import { EachText } from "./wrapper";

interface InteractiveTextProps {
readonly onChoosePosition: (e: React.MouseEvent, newText: any, moreProps: any) => 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[];
Expand Down
24 changes: 12 additions & 12 deletions packages/interactive/src/InteractiveYCoordinate.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
23 changes: 11 additions & 12 deletions packages/interactive/src/StandardDeviationChannel.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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[];
Expand Down
26 changes: 10 additions & 16 deletions packages/interactive/src/TrendLine.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
};
}

Expand Down Expand Up @@ -112,7 +106,7 @@ export class TrendLine extends React.Component<TrendLineProps, TrendLineState> {

const tempLine =
isDefined(current) && isDefined(current.end) ? (
<StraightLine
<InteractiveStraightLine
type={type}
x1Value={current.start[0]}
y1Value={current.start[1]}
Expand Down
8 changes: 4 additions & 4 deletions packages/interactive/src/ZoomButtons.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { last } from "@react-financial-charts/core";
import { interpolateNumber } from "d3-interpolate";
import * as PropTypes from "prop-types";
import * as React from "react";
import { last } from "@react-financial-charts/core";

interface ZoomButtonsProps {
export interface ZoomButtonsProps {
readonly fill: string;
readonly fillOpacity: number;
readonly heightFromBase: number;
Expand Down Expand Up @@ -35,7 +35,7 @@ export class ZoomButtons extends React.Component<ZoomButtonsProps> {
xAxisZoom: PropTypes.func.isRequired,
};

private interval?: any;
private interval?: number;

public render() {
const { chartConfig } = this.context;
Expand Down Expand Up @@ -161,7 +161,7 @@ export class ZoomButtons extends React.Component<ZoomButtonsProps> {
return [left(i), right(i)];
});

this.interval = setInterval(() => {
this.interval = window.setInterval(() => {
xAxisZoom(foo.shift());
if (foo.length === 0) {
clearInterval(this.interval);
Expand Down
4 changes: 2 additions & 2 deletions packages/interactive/src/components/ChannelWithArea.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Loading

0 comments on commit afe3ba9

Please sign in to comment.