Skip to content

Commit

Permalink
Merge pull request #70 from jafin/feature/typescript
Browse files Browse the repository at this point in the history
feat (Typescript): Add typescript support , work done by @Metavirulen with PR fixes.
  • Loading branch information
tvkhoa committed Oct 22, 2019
2 parents 4dff99c + 8991d09 commit 77cfc9d
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 3 deletions.
67 changes: 67 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import * as React from "react";

export type Position =
| "top"
| "top-start"
| "top-end"
| "bottom"
| "bottom-start"
| "bottom-end"
| "left"
| "left-start"
| "left-end"
| "right"
| "right-start"
| "right-end";
export type Trigger = "mouseenter" | "focus" | "click" | "manual";
export type Animation = "shift" | "perspective" | "fade scale" | "none";
export type Size = "small" | "regular" | "big";
export type Theme = "dark" | "light" | "transparent";

export interface TooltipProps {
title?: string;
disabled?: boolean;
open?: boolean;
useContext?: boolean;
onRequestClose?: () => void;
position?: Position;
trigger?: Trigger;
tabIndex?: number;
interactive?: boolean;
interactiveBorder?: number;
delay?: number;
hideDelay?: number;
animation?: Animation;
arrow?: boolean;
arrowSize?: Size;
animateFill?: boolean;
duration?: number;
hideDuration?: number;
distance?: number;
offset?: number;
hideOnClick?: boolean | "persistent";
multiple?: boolean;
followCursor?: boolean;
inertia?: boolean;
transitionFlip?: boolean;
popperOptions?: any;
html?: React.ReactElement<any>;
unmountHTMLWhenHide?: boolean;
size?: Size;
sticky?: boolean;
stickyDuration?: boolean;
beforeShown?: () => void;
shown?: () => void;
beforeHidden?: () => void;
hidden?: () => void;
theme?: Theme;
className?: string;
style?: React.CSSProperties;
}

export class Tooltip extends React.Component<TooltipProps> {}

export declare function withTooltip<P>(
component: React.ComponentType<P>,
options: TooltipProps
): JSX.Element;
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"flow-bin": "^0.42.0",
"lodash-webpack-plugin": "^0.11.2",
"mocha": "^3.2.0",
"popper.js": "^1.11.1",
"react": "^15.5.3",
"react-dom": "^15.5.3",
"react-redux": "^5.0.5",
Expand All @@ -42,14 +43,13 @@
"redux": "^3.7.1",
"redux-state-action": "^1.0.8",
"redux-thunk": "^2.2.0",
"@types/react": "*",
"webpack": "^2.3.0",
"yargs": "^7.0.2"
},
"scripts": {
"build": "webpack --config webpacklib.config.js --env build",
"start": "react-scripts start"
},
"dependencies": {
"popper.js": "^1.11.1"
}
"typings": "./index.d.ts"
}

0 comments on commit 77cfc9d

Please sign in to comment.