1+
2+ interface ColorObject {
3+ css : React . CSSProperties ;
4+ value : number ;
5+ hex : string ;
6+ format : "hsl" | "rgb" | "hex" ;
7+ raw : string | number | object | string [ ] | number [ ] ;
8+ name : string ;
9+ aplha : number ;
10+ rgb : [ number , number , number ] ;
11+ hsv : [ number , number , number ] ;
12+ hsl : [ number , number , number ] ;
13+ }
14+ interface ColorError {
15+ raw : string | number | object | string [ ] | number [ ] ;
16+ css : React . CSSProperties ;
17+ name : "none" ;
18+ error : "Wrong format" | "Not an hex value" ;
19+ value : 0 ;
20+ alpha : 1 ;
21+ format : "unknown" ;
22+ hex : "000000" ;
23+ rgb : [ 0 , 0 , 0 ] ;
24+ hsv : [ 0 , 0 , 0 ] ;
25+ hsl : [ 0 , 0 , 0 ] ;
26+ }
27+ type Color = ColorObject | ColorError ;
28+
29+ interface ColorPickerProps {
30+ value ?: Color | string | number ;
31+ disableTextfield ?: boolean ;
32+ deferred ?: boolean ;
33+ palette ?: null ;
34+ inputFormats ?: string [ ] ;
35+ onChange : ( color : Color ) => void ;
36+ onOpen ?: ( ) => void ;
37+ openAtStart ?: boolean ;
38+ doPopup ?: ( ) => void ;
39+ }
40+ interface ColorPickerPalettenProps < T extends Record < string , string > > {
41+ value ?: Color | string | number ;
42+ disableTextfield ?: boolean ;
43+ deferred ?: boolean ;
44+ palette : T ;
45+ inputFormats ?: string [ ] ;
46+ onChange : ( color : Color | keyof T ) => void ;
47+ onOpen ?: ( ) => void ;
48+ openAtStart ?: boolean ;
49+ doPopup ?: ( ) => void ;
50+ }
51+
52+ function ColorPicker < T extends Record < string , string > | null > (
53+ props : ColorPickerPalettenProps < T > | ColorPickerProps
54+ ) : JSX . Element ;
55+
56+ interface ColorButtonProps {
57+ /**
58+ The color to display, could be a css valid string, an integer, or a Color object see ColorType
59+ */
60+ color : Color | string | number ;
61+ /**
62+ The size of the button in pixel
63+ */
64+ size ?: number ;
65+ /**
66+ The width of the button's border, not displayed if borderWidth=0
67+ */
68+ borderWidth ?: number ;
69+ /**
70+ The css color of the button's border, not displayed if borderWidth=0
71+ */
72+ borderColor ?: string ;
73+ /**
74+ A tooltip could be added to the button to display the color name or value
75+ */
76+ tooltip ?: string ;
77+ }
78+
79+ function ColorButton ( props : ColorButtonProps ) : JSX . Element ;
80+
81+ interface ColorInputProps {
82+ value ?: Color | string | number ;
83+ format ?: string ;
84+ onChange : ( color : Color ) => void ;
85+ }
86+
87+ function ColorInput ( props : ColorInputProps ) : JSX . Element ;
88+
89+ interface ColorPaletteProps < T > {
90+ borderWidth ?: number ;
91+ palette : T ;
92+ onSelect ?: ( color : keyof T ) => void ;
93+ }
94+ function ColorPalette < T extends Record < string , string > > (
95+ props : ColorPaletteProps < T >
96+ ) : JSX . Element ;
97+
98+ interface ColorBoxProps {
99+ value ?: Color | string | number ;
100+ deferred ?: boolean ;
101+ palette ?: Record < string , string > ;
102+ inputFormats ?: string [ ] ;
103+ onChange : ( color : Color ) => void ;
104+ }
105+ function ColorBox ( props : ColorBoxProps ) : JSX . Element ;
106+
107+ export {
108+ ColorPicker ,
109+ ColorPickerProps ,
110+ ColorInput ,
111+ ColorInputProps ,
112+ ColorButton ,
113+ ColorButtonProps ,
114+ ColorPalette ,
115+ ColorPaletteProps ,
116+ ColorBox ,
117+ ColorBoxProps ,
118+ Color ,
119+ ColorObject
120+ } ;
0 commit comments