New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-slider

Package Overview
Dependencies
Maintainers
4
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-slider - npm Package Compare versions

Comparing version 1.0.7 to 1.0.8

11

CHANGELOG.md

@@ -5,2 +5,13 @@ # Change Log

## [1.0.8](https://github.com/zillow/react-slider/compare/v1.0.7...v1.0.8) (2020-06-15)
### Bug Fixes
* account for floating point operations when stepping values with the keyboard ([93f89d8](https://github.com/zillow/react-slider/commit/93f89d811f639837d7ba81a48524224cd672c2aa)), closes [#179](https://github.com/zillow/react-slider/issues/179)
* call `onBeforeChange` and `onAfterChange` lifecycle methods when clicking track ([1e3d90e](https://github.com/zillow/react-slider/commit/1e3d90e13203cc860ed8b52651008956af197a71)), closes [#180](https://github.com/zillow/react-slider/issues/180)
* encapsulate value reference within ReactSlider ([#181](https://github.com/zillow/react-slider/issues/181)) ([453855f](https://github.com/zillow/react-slider/commit/453855f24b210be7ae5a889a3ca6b6f7925b2194))
## [1.0.7](https://github.com/zillow/react-slider/compare/v1.0.6...v1.0.7) (2020-05-17)

@@ -7,0 +18,0 @@

47

es/components/ReactSlider/ReactSlider.js

@@ -32,3 +32,3 @@ var _jsxFileName = "/Users/brians/git/react-slider/src/components/ReactSlider/ReactSlider.jsx";

function ensureArray(x) {
function sanitizeInValue(x) {
if (x == null) {

@@ -38,7 +38,7 @@ return [];

return Array.isArray(x) ? x : [x];
return Array.isArray(x) ? x.slice() : [x];
}
function undoEnsureArray(x) {
return x !== null && x.length === 1 ? x[0] : x;
function prepareOutValue(x) {
return x !== null && x.length === 1 ? x[0] : x.slice();
}

@@ -212,4 +212,2 @@

_this.hasMoved = false;
if (!_this.props.snapDragDisabled) {

@@ -221,4 +219,2 @@ var position = _this.getMousePosition(e);

_this.fireChangeEvent('onChange');
addHandlers(_this.getMouseEventMap());

@@ -328,3 +324,3 @@ });

index: i,
value: undoEnsureArray(_this.state.value),
value: prepareOutValue(_this.state.value),
valueNow: _this.state.value[i]

@@ -348,3 +344,3 @@ };

index: i,
value: undoEnsureArray(_this.state.value)
value: prepareOutValue(_this.state.value)
};

@@ -354,6 +350,6 @@ return _this.props.renderTrack(props, state);

var value = ensureArray(_props.value);
var value = sanitizeInValue(_props.value);
if (!value.length) {
value = ensureArray(_props.defaultValue);
value = sanitizeInValue(_props.defaultValue);
} // reused throughout the component to store results of iterations over `value`

@@ -394,3 +390,3 @@

_proto.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(newProps) {
var value = ensureArray(newProps.value);
var value = sanitizeInValue(newProps.value);

@@ -443,3 +439,3 @@ if (!value.length) {

_proto.getValue = function getValue() {
return undoEnsureArray(this.state.value);
return prepareOutValue(this.state.value);
};

@@ -583,2 +579,4 @@

_proto.forceValueFromPosition = function forceValueFromPosition(position, callback) {
var _this2 = this;
var pixelOffset = this.calcOffsetFromPosition(position);

@@ -598,5 +596,11 @@ var closestIndex = this.getClosestIndex(pixelOffset);

this.fireChangeEvent('onBeforeChange');
this.hasMoved = true;
this.setState({
value: value
}, callback.bind(this, closestIndex));
}, function () {
callback(closestIndex);
_this2.fireChangeEvent('onChange');
});
} // clear all pending timeouts to avoid error messages after unmounting

@@ -619,3 +623,2 @@ ;

this.hasMoved = false;
var zIndices = this.state.zIndices; // remove wherever the element is

@@ -642,3 +645,3 @@

var oldValue = this.state.value[this.state.index];
var newValue = oldValue + step;
var newValue = this.trimAlignValue(oldValue + step);
this.move(Math.min(newValue, this.props.max));

@@ -653,3 +656,3 @@ };

var oldValue = this.state.value[this.state.index];
var newValue = oldValue - step;
var newValue = this.trimAlignValue(oldValue - step);
this.move(Math.max(newValue, this.props.min));

@@ -825,3 +828,3 @@ };

if (this.props[event]) {
this.props[event](undoEnsureArray(this.state.value));
this.props[event](prepareOutValue(this.state.value));
}

@@ -882,3 +885,3 @@ };

_proto.render = function render() {
var _this2 = this;
var _this3 = this;

@@ -895,5 +898,5 @@ var offset = this.tempArray;

var thumbs = this.renderThumbs(offset);
return React.createElement('div', {
return /*#__PURE__*/React.createElement('div', {
ref: function ref(r) {
_this2.slider = r;
_this3.slider = r;
},

@@ -900,0 +903,0 @@ style: {

@@ -38,3 +38,3 @@ "use strict";

function ensureArray(x) {
function sanitizeInValue(x) {
if (x == null) {

@@ -44,7 +44,7 @@ return [];

return Array.isArray(x) ? x : [x];
return Array.isArray(x) ? x.slice() : [x];
}
function undoEnsureArray(x) {
return x !== null && x.length === 1 ? x[0] : x;
function prepareOutValue(x) {
return x !== null && x.length === 1 ? x[0] : x.slice();
}

@@ -218,4 +218,2 @@

_this.hasMoved = false;
if (!_this.props.snapDragDisabled) {

@@ -227,4 +225,2 @@ var position = _this.getMousePosition(e);

_this.fireChangeEvent('onChange');
addHandlers(_this.getMouseEventMap());

@@ -334,3 +330,3 @@ });

index: i,
value: undoEnsureArray(_this.state.value),
value: prepareOutValue(_this.state.value),
valueNow: _this.state.value[i]

@@ -354,3 +350,3 @@ };

index: i,
value: undoEnsureArray(_this.state.value)
value: prepareOutValue(_this.state.value)
};

@@ -360,6 +356,6 @@ return _this.props.renderTrack(props, state);

var value = ensureArray(_props.value);
var value = sanitizeInValue(_props.value);
if (!value.length) {
value = ensureArray(_props.defaultValue);
value = sanitizeInValue(_props.defaultValue);
} // reused throughout the component to store results of iterations over `value`

@@ -400,3 +396,3 @@

_proto.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(newProps) {
var value = ensureArray(newProps.value);
var value = sanitizeInValue(newProps.value);

@@ -449,3 +445,3 @@ if (!value.length) {

_proto.getValue = function getValue() {
return undoEnsureArray(this.state.value);
return prepareOutValue(this.state.value);
};

@@ -589,2 +585,4 @@

_proto.forceValueFromPosition = function forceValueFromPosition(position, callback) {
var _this2 = this;
var pixelOffset = this.calcOffsetFromPosition(position);

@@ -604,5 +602,11 @@ var closestIndex = this.getClosestIndex(pixelOffset);

this.fireChangeEvent('onBeforeChange');
this.hasMoved = true;
this.setState({
value: value
}, callback.bind(this, closestIndex));
}, function () {
callback(closestIndex);
_this2.fireChangeEvent('onChange');
});
} // clear all pending timeouts to avoid error messages after unmounting

@@ -625,3 +629,2 @@ ;

this.hasMoved = false;
var zIndices = this.state.zIndices; // remove wherever the element is

@@ -648,3 +651,3 @@

var oldValue = this.state.value[this.state.index];
var newValue = oldValue + step;
var newValue = this.trimAlignValue(oldValue + step);
this.move(Math.min(newValue, this.props.max));

@@ -659,3 +662,3 @@ };

var oldValue = this.state.value[this.state.index];
var newValue = oldValue - step;
var newValue = this.trimAlignValue(oldValue - step);
this.move(Math.max(newValue, this.props.min));

@@ -831,3 +834,3 @@ };

if (this.props[event]) {
this.props[event](undoEnsureArray(this.state.value));
this.props[event](prepareOutValue(this.state.value));
}

@@ -888,3 +891,3 @@ };

_proto.render = function render() {
var _this2 = this;
var _this3 = this;

@@ -901,5 +904,5 @@ var offset = this.tempArray;

var thumbs = this.renderThumbs(offset);
return _react.default.createElement('div', {
return /*#__PURE__*/_react.default.createElement('div', {
ref: function ref(r) {
_this2.slider = r;
_this3.slider = r;
},

@@ -906,0 +909,0 @@ style: {

{
"name": "react-slider",
"version": "1.0.7",
"version": "1.0.8",
"description": "Slider component for React",

@@ -50,5 +50,5 @@ "main": "lib/components/ReactSlider/ReactSlider.js",

"create-react-styleguide": "^5.2.0",
"eslint-plugin-jest": "^23.10.0",
"eslint-plugin-zillow": "^3.7.4",
"gh-pages": "^2.2.0",
"eslint-plugin-jest": "^23.13.2",
"eslint-plugin-zillow": "^3.7.8",
"gh-pages": "^3.0.0",
"husky": "^4.2.5",

@@ -61,3 +61,3 @@ "jest-styled-components": "^7.0.2",

"standard-version": "^5.0.2",
"styled-components": "^5.1.0"
"styled-components": "^5.1.1"
},

@@ -64,0 +64,0 @@ "contributors": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc