[react-color] Type updates for the individual APIs (#18571)

Update to the type definition of the individual APIs to reflect their specificity (adding of onSwatchHover for example)
This commit is contained in:
mntdn
2017-08-03 09:43:09 -07:00
committed by Sheetal Nandi
parent 1ad787e3ed
commit 2be68bbacd
8 changed files with 24 additions and 10 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
// Type definitions for react-color 2.11
// Type definitions for react-color 2.13
// Project: https://github.com/casesandberg/react-color/
// Definitions by: Karol Janyst <https://github.com/LKay>, Marks Polakovs <https://github.com/markspolakovs>
// Definitions by: Karol Janyst <https://github.com/LKay>, Marks Polakovs <https://github.com/markspolakovs>, Matthieu Montaudouin <https://github.com/mntdn>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
+3 -1
View File
@@ -1,9 +1,11 @@
import { Component } from "react";
import { ColorPickerProps } from "react-color";
import { ColorPickerProps, Color } from "react-color";
export interface BlockPickerProps extends ColorPickerProps<BlockPicker> {
colors?: string[];
width?: string;
triangle?: 'hide' | 'top';
onSwatchHover?(color: Color, event: MouseEvent): void;
}
export default class BlockPicker extends Component<BlockPickerProps> {}
+4 -1
View File
@@ -1,9 +1,12 @@
import { Component } from "react";
import { ColorPickerProps } from "react-color";
import { ColorPickerProps, Color } from "react-color";
export interface CirclePickerProps extends ColorPickerProps<CirclePicker> {
colors?: string[];
width?: string;
circleSize?: number;
circleSpacing?: number;
onSwatchHover?(color: Color, event: MouseEvent): void;
}
export default class CirclePicker extends Component<CirclePickerProps> {}
+2 -1
View File
@@ -1,8 +1,9 @@
import { Component } from "react";
import { ColorPickerProps } from "react-color";
import { ColorPickerProps, Color } from "react-color";
export interface CompactPickerProps extends ColorPickerProps<CompactPicker> {
colors?: string[];
onSwatchHover?(color: Color, event: MouseEvent): void;
}
export default class CompactPicker extends Component<CompactPickerProps> {}
+2 -1
View File
@@ -1,10 +1,11 @@
import { Component } from "react";
import { ColorPickerProps } from "react-color";
import { ColorPickerProps, Color } from "react-color";
export interface GithubPickerProps extends ColorPickerProps<GithubPicker> {
colors?: string[];
width?: string;
triangle?: 'hide' | 'top-left' | 'top-right';
onSwatchHover?(color: Color, event: MouseEvent): void;
}
export default class GithubPicker extends Component<GithubPickerProps> {}
+2 -1
View File
@@ -1,10 +1,11 @@
import { Component } from "react";
import { ColorPickerProps } from "react-color";
import { ColorPickerProps, Color } from "react-color";
export interface SketchPickerProps extends ColorPickerProps<SketchPicker> {
disableAlpha?: boolean;
presetColors?: string[];
width?: string;
onSwatchHover?(color: Color, event: MouseEvent): void;
}
export default class SketchPicker extends Component<SketchPickerProps> {}
+2 -1
View File
@@ -1,10 +1,11 @@
import { Component } from "react";
import { ColorPickerProps } from "react-color";
import { ColorPickerProps, Color } from "react-color";
export interface SwatchesPickerProps extends ColorPickerProps<SwatchesPicker> {
colors?: string[][];
height?: number;
width?: number;
onSwatchHover?(color: Color, event: MouseEvent): void;
}
export default class SwatchesPicker extends Component<SwatchesPickerProps> {}
+7 -2
View File
@@ -1,6 +1,11 @@
import { Component } from "react";
import { ColorPickerProps } from "react-color";
import { ColorPickerProps, Color } from "react-color";
export type TwitterPickerProps = ColorPickerProps<TwitterPicker>;
export interface TwitterPickerProps extends ColorPickerProps<TwitterPicker> {
colors?: string[];
width?: string;
triangle?: 'hide' | 'top-left' | 'top-right';
onSwatchHover?(color: Color, event: MouseEvent): void;
}
export default class TwitterPicker extends Component<TwitterPickerProps> {}