react-color
Advanced tools
Comparing version 2.18.0 to 2.18.1
@@ -22,2 +22,6 @@ 'use strict'; | ||
var _isUndefined = require('lodash/isUndefined'); | ||
var _isUndefined2 = _interopRequireDefault(_isUndefined); | ||
var _common = require('../common'); | ||
@@ -95,6 +99,13 @@ | ||
// We store HSL as a unit interval so we need to override the 1 input to 0.01 | ||
if (data.s == 1) { | ||
data.s = 0.01; | ||
} else if (data.l == 1) { | ||
data.l = 0.01; | ||
} | ||
_this.props.onChange({ | ||
h: data.h || _this.props.hsl.h, | ||
s: Number(data.s && data.s || _this.props.hsl.s), | ||
l: Number(data.l && data.l || _this.props.hsl.l), | ||
s: Number(!(0, _isUndefined2.default)(data.s) ? data.s : _this.props.hsl.s), | ||
l: Number(!(0, _isUndefined2.default)(data.l) ? data.l : _this.props.hsl.l), | ||
source: 'hsl' | ||
@@ -101,0 +112,0 @@ }, e); |
@@ -42,3 +42,3 @@ 'use strict'; | ||
background: 'transparent', | ||
boxShadow: 'inset 0 0 0 ' + circleSize / 2 + 'px ' + color, | ||
boxShadow: 'inset 0 0 0 ' + (circleSize / 2 + 1) + 'px ' + color, | ||
transition: '100ms box-shadow ease' | ||
@@ -45,0 +45,0 @@ } |
@@ -8,2 +8,4 @@ 'use strict'; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _react = require('react'); | ||
@@ -31,3 +33,4 @@ | ||
borderRadius = _ref.borderRadius, | ||
boxShadow = _ref.boxShadow; | ||
boxShadow = _ref.boxShadow, | ||
children = _ref.children; | ||
@@ -44,4 +47,3 @@ var styles = (0, _reactcss2.default)({ | ||
}); | ||
return _react2.default.createElement('div', { style: styles.grid }); | ||
return (0, _react.isValidElement)(children) ? _react2.default.cloneElement(children, _extends({}, children.props, { style: _extends({}, children.props.style, styles.grid) })) : _react2.default.createElement('div', { style: styles.grid }); | ||
}; | ||
@@ -48,0 +50,0 @@ |
@@ -36,12 +36,5 @@ 'use strict'; | ||
}; | ||
var getFormattedPercentage = function getFormattedPercentage(number) { | ||
return number + '%'; | ||
}; | ||
var getNumberValue = function getNumberValue(value) { | ||
return Number(String(value).replace(/%/g, '')); | ||
}; | ||
var getIsPercentage = function getIsPercentage(value) { | ||
return String(value).indexOf('%') > -1; | ||
}; | ||
@@ -145,6 +138,3 @@ var EditableInput = exports.EditableInput = function (_ref) { | ||
var isPercentage = getIsPercentage(e.target.value); | ||
this.setState({ | ||
value: isPercentage ? getFormattedPercentage(value) : value | ||
}); | ||
this.setState({ value: value }); | ||
} | ||
@@ -151,0 +141,0 @@ }, { |
@@ -60,2 +60,15 @@ 'use strict'; | ||
test('Checkboard renders children correctly', function () { | ||
var tree = _reactTestRenderer2.default.create(_react2.default.createElement( | ||
_Checkboard2.default, | ||
null, | ||
_react2.default.createElement( | ||
'button', | ||
null, | ||
'Click' | ||
) | ||
)).toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
// test('Checkboard renders on server correctly', () => { | ||
@@ -62,0 +75,0 @@ // const tree = renderer.create( |
@@ -28,6 +28,2 @@ 'use strict'; | ||
var _color = require('../../helpers/color'); | ||
var _color2 = _interopRequireDefault(_color); | ||
var _materialColors = require('material-colors'); | ||
@@ -79,6 +75,3 @@ | ||
var handleChange = function handleChange(data, e) { | ||
_color2.default.isValidHex(data) && onChange({ | ||
hex: data, | ||
source: 'hex' | ||
}, e); | ||
return onChange({ hex: data, source: 'hex' }, e); | ||
}; | ||
@@ -85,0 +78,0 @@ |
@@ -31,3 +31,3 @@ 'use strict'; | ||
a: hsl.a, | ||
source: 'rgb' | ||
source: 'hsl' | ||
}; | ||
@@ -52,3 +52,3 @@ } | ||
a: hsl.a, | ||
source: 'rgb' | ||
source: 'hsl' | ||
}; | ||
@@ -55,0 +55,0 @@ } |
@@ -36,4 +36,4 @@ 'use strict'; | ||
a: hsl.a, | ||
source: 'rgb' | ||
source: 'hsv' | ||
}; | ||
}; |
{ | ||
"name": "react-color", | ||
"version": "2.18.0", | ||
"version": "2.18.1", | ||
"description": "A Collection of Color Pickers from Sketch, Photoshop, Chrome & more", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
229730
5771