From 2be68bbacd9d3c04f16990881ea90afc98d31f6b Mon Sep 17 00:00:00 2001 From: mntdn Date: Thu, 3 Aug 2017 17:43:09 +0100 Subject: [PATCH] [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) --- types/react-color/index.d.ts | 4 ++-- types/react-color/lib/components/block/Block.d.ts | 4 +++- types/react-color/lib/components/circle/Circle.d.ts | 5 ++++- types/react-color/lib/components/compact/Compact.d.ts | 3 ++- types/react-color/lib/components/github/Github.d.ts | 3 ++- types/react-color/lib/components/sketch/Sketch.d.ts | 3 ++- types/react-color/lib/components/swatches/Swatches.d.ts | 3 ++- types/react-color/lib/components/twitter/Twitter.d.ts | 9 +++++++-- 8 files changed, 24 insertions(+), 10 deletions(-) diff --git a/types/react-color/index.d.ts b/types/react-color/index.d.ts index f29529cc09..3739d3f9d1 100644 --- a/types/react-color/index.d.ts +++ b/types/react-color/index.d.ts @@ -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 , Marks Polakovs +// Definitions by: Karol Janyst , Marks Polakovs , Matthieu Montaudouin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/react-color/lib/components/block/Block.d.ts b/types/react-color/lib/components/block/Block.d.ts index 9b3633265b..e50b84c6ac 100644 --- a/types/react-color/lib/components/block/Block.d.ts +++ b/types/react-color/lib/components/block/Block.d.ts @@ -1,9 +1,11 @@ import { Component } from "react"; -import { ColorPickerProps } from "react-color"; +import { ColorPickerProps, Color } from "react-color"; export interface BlockPickerProps extends ColorPickerProps { colors?: string[]; width?: string; + triangle?: 'hide' | 'top'; + onSwatchHover?(color: Color, event: MouseEvent): void; } export default class BlockPicker extends Component {} diff --git a/types/react-color/lib/components/circle/Circle.d.ts b/types/react-color/lib/components/circle/Circle.d.ts index 045c5a93bb..5b9e79a0b4 100644 --- a/types/react-color/lib/components/circle/Circle.d.ts +++ b/types/react-color/lib/components/circle/Circle.d.ts @@ -1,9 +1,12 @@ import { Component } from "react"; -import { ColorPickerProps } from "react-color"; +import { ColorPickerProps, Color } from "react-color"; export interface CirclePickerProps extends ColorPickerProps { colors?: string[]; width?: string; + circleSize?: number; + circleSpacing?: number; + onSwatchHover?(color: Color, event: MouseEvent): void; } export default class CirclePicker extends Component {} diff --git a/types/react-color/lib/components/compact/Compact.d.ts b/types/react-color/lib/components/compact/Compact.d.ts index a661972a41..125f496f90 100644 --- a/types/react-color/lib/components/compact/Compact.d.ts +++ b/types/react-color/lib/components/compact/Compact.d.ts @@ -1,8 +1,9 @@ import { Component } from "react"; -import { ColorPickerProps } from "react-color"; +import { ColorPickerProps, Color } from "react-color"; export interface CompactPickerProps extends ColorPickerProps { colors?: string[]; + onSwatchHover?(color: Color, event: MouseEvent): void; } export default class CompactPicker extends Component {} diff --git a/types/react-color/lib/components/github/Github.d.ts b/types/react-color/lib/components/github/Github.d.ts index c4b6e7c27c..d0800c9740 100644 --- a/types/react-color/lib/components/github/Github.d.ts +++ b/types/react-color/lib/components/github/Github.d.ts @@ -1,10 +1,11 @@ import { Component } from "react"; -import { ColorPickerProps } from "react-color"; +import { ColorPickerProps, Color } from "react-color"; export interface GithubPickerProps extends ColorPickerProps { colors?: string[]; width?: string; triangle?: 'hide' | 'top-left' | 'top-right'; + onSwatchHover?(color: Color, event: MouseEvent): void; } export default class GithubPicker extends Component {} diff --git a/types/react-color/lib/components/sketch/Sketch.d.ts b/types/react-color/lib/components/sketch/Sketch.d.ts index 3a1ac6c3fe..6018674809 100644 --- a/types/react-color/lib/components/sketch/Sketch.d.ts +++ b/types/react-color/lib/components/sketch/Sketch.d.ts @@ -1,10 +1,11 @@ import { Component } from "react"; -import { ColorPickerProps } from "react-color"; +import { ColorPickerProps, Color } from "react-color"; export interface SketchPickerProps extends ColorPickerProps { disableAlpha?: boolean; presetColors?: string[]; width?: string; + onSwatchHover?(color: Color, event: MouseEvent): void; } export default class SketchPicker extends Component {} diff --git a/types/react-color/lib/components/swatches/Swatches.d.ts b/types/react-color/lib/components/swatches/Swatches.d.ts index d821fc7c3d..af3efb7652 100644 --- a/types/react-color/lib/components/swatches/Swatches.d.ts +++ b/types/react-color/lib/components/swatches/Swatches.d.ts @@ -1,10 +1,11 @@ import { Component } from "react"; -import { ColorPickerProps } from "react-color"; +import { ColorPickerProps, Color } from "react-color"; export interface SwatchesPickerProps extends ColorPickerProps { colors?: string[][]; height?: number; width?: number; + onSwatchHover?(color: Color, event: MouseEvent): void; } export default class SwatchesPicker extends Component {} diff --git a/types/react-color/lib/components/twitter/Twitter.d.ts b/types/react-color/lib/components/twitter/Twitter.d.ts index 84b53dbc7a..3c37ebb8f5 100644 --- a/types/react-color/lib/components/twitter/Twitter.d.ts +++ b/types/react-color/lib/components/twitter/Twitter.d.ts @@ -1,6 +1,11 @@ import { Component } from "react"; -import { ColorPickerProps } from "react-color"; +import { ColorPickerProps, Color } from "react-color"; -export type TwitterPickerProps = ColorPickerProps; +export interface TwitterPickerProps extends ColorPickerProps { + colors?: string[]; + width?: string; + triangle?: 'hide' | 'top-left' | 'top-right'; + onSwatchHover?(color: Color, event: MouseEvent): void; +} export default class TwitterPicker extends Component {}