1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-25 20:02:58 +01:00
metamask-extension/types/react-tippy.d.ts
Elliot Winkler a7d98b695f
Add TypeScript migration dashboard (#13820)
As we convert parts of the codebase to TypeScript, we will want a way to
track progress. This commit adds a dashboard which displays all of the
files that we wish to convert to TypeScript and which files we've
already converted.

The list of all possible files to convert is predetermined by walking
the dependency graph of each entrypoint the build system uses to compile
the extension (the files that the entrypoint imports, the files that the
imports import, etc). The list should not need to be regenerated, but
you can do it by running:

    yarn ts-migration:enumerate

The dashboard is implemented as a separate React app. The CircleCI
configuration has been updated so that when a new commit is pushed, the
React app is built and stored in the CircleCI artifacts. When a PR is
merged, the built files will be pushed to a separate repo whose sole
purpose is to serve the dashboard via GitHub Pages (this is the same
way that the Storybook works). All of the app code and script to build
the app are self-contained under
`development/ts-migration-dashboard`. To build this app yourself, you
can run:

    yarn ts-migration:dashboard:build

or if you want to build automatically as you change files, run:

    yarn ts-migration:dashboard:watch

Then open the following file in your browser (there is no server
component):

    development/ts-migration-dashboard/build/index.html

Finally, although you shouldn't have to do this, to manually deploy the
dashboard once built, you can run:

    git remote add ts-migration-dashboard git@github.com:MetaMask/metamask-extension-ts-migration-dashboard.git
    yarn ts-migration:dashboard:deploy
2022-08-09 14:16:08 -06:00

72 lines
1.9 KiB
TypeScript

// Copied from <https://github.com/tvkhoa/react-tippy/blob/c6e6169e3f2cabe05f1bfbd7e0dea1ddef4debe8/index.d.ts>
// which for some reason is not included in the distributed version
declare module 'react-tippy' {
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 function withTooltip<P>(
component: React.ComponentType<P>,
options: TooltipProps,
): JSX.Element;
}