Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const handleChange = (data, e) => {
if (data.hex) {
color.isValidHex(data.hex) && onChange({
hex: data.hex,
source: 'hex',
}, e)
} else if (data.r || data.g || data.b) {
onChange({
r: data.r || rgb.r,
g: data.g || rgb.g,
b: data.b || rgb.b,
a: rgb.a,
source: 'rgb',
}, e)
} else if (data.a) {
if (data.a < 0) {
data.a = 0
} else if (data.a > 100) {
data.a = 100
handleChange = (value, e) => {
color.isValidHex(value) && this.props.onChange({
hex: value,
source: 'hex',
}, e);
}
handleChange = (data) => {
if (data.hex) {
color.isValidHex(data.hex) && this.props.onChange({
hex: data.hex,
source: 'hex'
})
} else if (data.r || data.g || data.b) {
this.props.onChange({
r: data.r || this.props.rgb.r,
g: data.g || this.props.rgb.g,
b: data.b || this.props.rgb.b,
a: this.props.rgb.a,
source: 'rgb'
})
} else if (data.a) {
if (data.a < 0) {
data.a = 0
} else if (data.a > 100) {
data.a = 100
const handleChange = (data, e) => {
if (data.hex) {
color.isValidHex(data.hex) &&
onChange(
{
hex: data.hex,
source: 'hex'
},
e
)
} else if (data.r || data.g || data.b) {
onChange(
{
r: data.r || rgb.r,
g: data.g || rgb.g,
b: data.b || rgb.b,
a: rgb.a,
source: 'rgb'
},
const handleSwatchChange = data => {
if (data.hex) {
color.isValidHex(data.hex) &&
this.props.onChange({
hex: data.hex,
source: 'hex',
});
} else {
this.props.onChange(data);
}
};
const handleSwatchChange = (data) => {
if (data.hex) {
color.isValidHex(data.hex) && this.props.onChange({
hex: data.hex,
source: 'hex',
});
} else {
this.props.onChange(data);
}
};