@@ -14,7 +14,7 @@ import { rgba2hex } from './utils';
14
14
15
15
const KEY_ENTER = 13 ;
16
16
17
- const ColorPicker = ( { color, onChange } ) => {
17
+ const ColorPicker = ( { color, onChange, disabled } ) => {
18
18
const { r, g, b, a, h, s, v } = color ;
19
19
20
20
function changeColor ( color ) {
@@ -80,6 +80,7 @@ const ColorPicker = ({ color, onChange }) => {
80
80
y = { 100 - v }
81
81
ymax = { 100 }
82
82
onChange = { ( { x, y } ) => changeHSV ( h , x , 100 - y ) }
83
+ disabled = { disabled }
83
84
styles = { {
84
85
track : { width : '100%' , height : '100%' , background : 'none' } ,
85
86
thumb : {
@@ -107,6 +108,7 @@ const ColorPicker = ({ color, onChange }) => {
107
108
x = { h }
108
109
xmax = { 359 }
109
110
onChange = { ( { x } ) => changeHSV ( x , s , v ) }
111
+ disabled = { disabled }
110
112
styles = { {
111
113
track : {
112
114
width : '100%' ,
@@ -148,6 +150,7 @@ const ColorPicker = ({ color, onChange }) => {
148
150
} ,
149
151
} }
150
152
onChange = { ( { x } ) => changeAlpha ( x ) }
153
+ disabled = { disabled }
151
154
/>
152
155
</ div >
153
156
< div
@@ -163,6 +166,7 @@ const ColorPicker = ({ color, onChange }) => {
163
166
value = { color . hex }
164
167
onChange = { ( e ) => changeHex ( e . target . value ) }
165
168
onKeyUp = { handleHexKeyUp }
169
+ disabled = { disabled }
166
170
/>
167
171
< div > Hex</ div >
168
172
</ div >
@@ -173,6 +177,7 @@ const ColorPicker = ({ color, onChange }) => {
173
177
max = { 255 }
174
178
value = { r }
175
179
onChange = { ( r ) => changeRGB ( r , g , b ) }
180
+ disabled = { disabled }
176
181
/>
177
182
< div > R</ div >
178
183
</ div >
@@ -182,6 +187,7 @@ const ColorPicker = ({ color, onChange }) => {
182
187
max = { 255 }
183
188
value = { g }
184
189
onChange = { ( g ) => changeRGB ( r , g , b ) }
190
+ disabled = { disabled }
185
191
/>
186
192
< div > G</ div >
187
193
</ div >
@@ -191,6 +197,7 @@ const ColorPicker = ({ color, onChange }) => {
191
197
max = { 255 }
192
198
value = { b }
193
199
onChange = { ( b ) => changeRGB ( r , g , b ) }
200
+ disabled = { disabled }
194
201
/>
195
202
< div > B</ div >
196
203
</ div >
@@ -201,6 +208,7 @@ const ColorPicker = ({ color, onChange }) => {
201
208
max = { 100 }
202
209
value = { a }
203
210
onChange = { ( a ) => changeAlpha ( a ) }
211
+ disabled = { disabled }
204
212
/>
205
213
< div > A</ div >
206
214
</ div >
@@ -211,6 +219,7 @@ const ColorPicker = ({ color, onChange }) => {
211
219
212
220
ColorPicker . defaultProps = {
213
221
initialValue : '#5e72e4' ,
222
+ disabled : false
214
223
} ;
215
224
216
225
const styles = {
0 commit comments