@@ -14,7 +14,7 @@ import { rgba2hex } from './utils';
1414
1515const KEY_ENTER = 13 ;
1616
17- const ColorPicker = ( { color, onChange } ) => {
17+ const ColorPicker = ( { color, onChange, disabled } ) => {
1818 const { r, g, b, a, h, s, v } = color ;
1919
2020 function changeColor ( color ) {
@@ -80,6 +80,7 @@ const ColorPicker = ({ color, onChange }) => {
8080 y = { 100 - v }
8181 ymax = { 100 }
8282 onChange = { ( { x, y } ) => changeHSV ( h , x , 100 - y ) }
83+ disabled = { disabled }
8384 styles = { {
8485 track : { width : '100%' , height : '100%' , background : 'none' } ,
8586 thumb : {
@@ -107,6 +108,7 @@ const ColorPicker = ({ color, onChange }) => {
107108 x = { h }
108109 xmax = { 359 }
109110 onChange = { ( { x } ) => changeHSV ( x , s , v ) }
111+ disabled = { disabled }
110112 styles = { {
111113 track : {
112114 width : '100%' ,
@@ -148,6 +150,7 @@ const ColorPicker = ({ color, onChange }) => {
148150 } ,
149151 } }
150152 onChange = { ( { x } ) => changeAlpha ( x ) }
153+ disabled = { disabled }
151154 />
152155 </ div >
153156 < div
@@ -163,6 +166,7 @@ const ColorPicker = ({ color, onChange }) => {
163166 value = { color . hex }
164167 onChange = { ( e ) => changeHex ( e . target . value ) }
165168 onKeyUp = { handleHexKeyUp }
169+ disabled = { disabled }
166170 />
167171 < div > Hex</ div >
168172 </ div >
@@ -173,6 +177,7 @@ const ColorPicker = ({ color, onChange }) => {
173177 max = { 255 }
174178 value = { r }
175179 onChange = { ( r ) => changeRGB ( r , g , b ) }
180+ disabled = { disabled }
176181 />
177182 < div > R</ div >
178183 </ div >
@@ -182,6 +187,7 @@ const ColorPicker = ({ color, onChange }) => {
182187 max = { 255 }
183188 value = { g }
184189 onChange = { ( g ) => changeRGB ( r , g , b ) }
190+ disabled = { disabled }
185191 />
186192 < div > G</ div >
187193 </ div >
@@ -191,6 +197,7 @@ const ColorPicker = ({ color, onChange }) => {
191197 max = { 255 }
192198 value = { b }
193199 onChange = { ( b ) => changeRGB ( r , g , b ) }
200+ disabled = { disabled }
194201 />
195202 < div > B</ div >
196203 </ div >
@@ -201,6 +208,7 @@ const ColorPicker = ({ color, onChange }) => {
201208 max = { 100 }
202209 value = { a }
203210 onChange = { ( a ) => changeAlpha ( a ) }
211+ disabled = { disabled }
204212 />
205213 < div > A</ div >
206214 </ div >
@@ -211,6 +219,7 @@ const ColorPicker = ({ color, onChange }) => {
211219
212220ColorPicker . defaultProps = {
213221 initialValue : '#5e72e4' ,
222+ disabled : false
214223} ;
215224
216225const styles = {
0 commit comments