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

react-range-slider

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-range-slider - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

Cursor.js

2

example/app.js

@@ -20,3 +20,3 @@ var React = window.React = require('react');

<div id='main'>
<RangeSlider value={[ '#42c6da','#3cb9ec','#42a5f5','#4a80df','#5c6bc0']} withBars/>
<RangeSlider value={[ '#42c6da','#3cb9ec','#42a5f5','#4a80df','#5c6bc0']} withBars withCursor range={[true]}/>
</div>

@@ -23,0 +23,0 @@ </div>

@@ -6,3 +6,3 @@ var React = require('react/addons');

var event = require('./event');
var Handler = React.createFactory(require('./Handler'));
var Cursor = React.createFactory(require('./Cursor'));

@@ -243,7 +243,2 @@ /**

this.handleResize();
// var value = map(this.state.value, this._trimAlignValue);
// this.setState({
// value: value
// });
},

@@ -294,3 +289,3 @@

this.props.onBeforeChange(e);
this.props.onBeforeChange(e, i - 1);

@@ -312,2 +307,4 @@ // Add event handlers

l = this.state.value.length;
// Cursor position after moved
var _v = this.state.startValue + diffValue;
if (i === 0) {

@@ -317,3 +314,2 @@ // Move header

var v = l > 0 ? finder(Math.min, this.state.value, 'value') : this.state.max;
var _v = diffValue + this.state.startValue;
this.setState({

@@ -324,8 +320,15 @@ min: parseInt(Math.max(_v <= v ? (_v < 0 ? 0 : _v) : v, this.props.min), 10)

// Move cursor
// The cursor postion must smaller than the next cursor or this.state.max
// bigger than the previous cursor or this.state.min
var value = this.state.value;
// var v = value[i - 1].value;
var min = (value[i - 2] ? value[i- 2].value : this.state.min);
var max = value[i] ? value[i].value : this.state.max;
value[i - 1].value = parseInt(Math.max(Math.min(_v, max), min), 10);
this.setState({
value: value
});
} else if (i === l + 1) {
// Move tailer
var v = l > 0 ? finder(Math.max, this.state.value, 'value') : this.state.min;
var _v = this.state.startValue + diffValue;
this.setState({

@@ -336,3 +339,3 @@ max: parseInt(Math.min(_v >= v ? _v : v, this.props.max))

this.props.onChange(this.state.value);
this.props.onChange(e, i - 1, this.state.value);
},

@@ -345,3 +348,3 @@

this.props.onAfterChange(this.state.value);
this.props.onAfterChange(e, this.state.value);

@@ -368,3 +371,3 @@ // Remove event handlers

}
return Handler({
return Cursor({
axis: this.state.axis,

@@ -382,5 +385,5 @@ offset: offset,

renderCursors: function (offsets) {
var handlers = [];
var cursors = [];
if (this.props.withCursor) {
handlers = offsets.map(function (offset, i) {
cursors = offsets.map(function (offset, i) {
return this.renderCursor(offset, i + 1)

@@ -390,11 +393,11 @@ }, this);

if (this.state.header) {
handlers.splice(0, 0, this.renderCursor(this.calcOffset(this.state.min), 0,
cursors.splice(0, 0, this.renderCursor(this.calcOffset(this.state.min), 0,
React.createElement('span', null, this.state.min)));
}
if (this.state.tailer) {
var l = handlers.length;
handlers.push(this.renderCursor(this.calcOffset(this.state.max), l,
var l = cursors.length;
cursors.push(this.renderCursor(this.calcOffset(this.state.max), l,
React.createElement('span', null, this.state.max)));
}
return handlers;
return cursors;
},

@@ -401,0 +404,0 @@

{
"name": "react-range-slider",
"version": "0.0.4",
"version": "0.0.5",
"description": "A flexible slider for reactjs.",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

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