diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..5812ec7 --- /dev/null +++ b/index.d.ts @@ -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; + 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 {} + +export declare function withTooltip

( + component: React.ComponentType

, + options: TooltipProps +): JSX.Element; diff --git a/package.json b/package.json index ab245da..ff977cb 100644 --- a/package.json +++ b/package.json @@ -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", @@ -42,6 +43,7 @@ "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" }, @@ -49,7 +51,5 @@ "build": "webpack --config webpacklib.config.js --env build", "start": "react-scripts start" }, - "dependencies": { - "popper.js": "^1.11.1" - } + "typings": "./index.d.ts" }