Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat (Typescript): Add typescript support , work done by @Metavirulen with PR fixes. #70

Merged
merged 3 commits into from
Oct 22, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
"start": "react-scripts start"
},
"dependencies": {
"popper.js": "^1.11.1"
}
}
"popper.js": "^1.11.1",
"@types/react": "*"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this should be in devDependencies?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@moshfeu yep, fixed. pushed to PR.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope that @tvkhoa will ever merge it 🙏

},
"typings": "./index.d.ts"
}