react-slider
Advanced tools
Comparing version 0.3.3 to 0.3.4
{ | ||
"name": "react-slider", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"description": "Slider component for React", | ||
@@ -5,0 +5,0 @@ "main": "react-slider.js", |
@@ -43,2 +43,6 @@ (function (root, factory) { | ||
function notNull(x) { | ||
return x != null; | ||
} | ||
var ReactSlider = React.createClass({ | ||
@@ -120,19 +124,9 @@ displayName: 'ReactSlider', | ||
// Check if the arity of `value` or `defaultValue` matches the number of children (= number of custom handles) and returns it. | ||
// If no custom handles are provided, just returns `value` if present or `defaultValue` otherwise. | ||
// If custom handles are present but neither `value` nor `defaultValue` are applicable the handles are spread out equally. | ||
_or: function (value, defaultValue) { | ||
var count = React.Children.count(this.props.children); | ||
switch (count) { | ||
case 0: | ||
return value != null ? value : defaultValue; | ||
case value.length: | ||
return value; | ||
case defaultValue.length: | ||
return defaultValue; | ||
default: | ||
if (value.length !== count || defaultValue.length !== count) { | ||
console.warn("ReactSlider: Number of values does not match number of children."); | ||
} | ||
return linspace(this.props.min, this.props.max, count); | ||
if (value.every(notNull)) { | ||
return value; | ||
} else if (defaultValue.every(notNull)) { | ||
return defaultValue | ||
} else { | ||
return linspace(this.props.min, this.props.max, React.Children.count(this.props.children)); | ||
} | ||
@@ -248,3 +242,3 @@ }, | ||
'touchmove': this._onTouchMove, | ||
'tochend': this._onTouchEnd | ||
'touchend': this._onTouchEnd | ||
} | ||
@@ -265,3 +259,5 @@ }, | ||
return function (e) { | ||
document.activeElement.blur(); | ||
if (document.activeElement) { | ||
document.activeElement.blur(); | ||
} | ||
@@ -524,3 +520,5 @@ var position = getPosition(e); | ||
document.activeElement.blur(); | ||
if (document.activeElement) { | ||
document.activeElement.blur(); | ||
} | ||
@@ -527,0 +525,0 @@ var position = getPosition(e); |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
24894
468