Huge News!Announcing our $40M Series B led by Abstract Ventures.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.1.1 to 0.2.0

13

Bar.js
/*
* work - Bar.js
* Copyright(c) 2015 xeodou <xeodou@gmail.com>
* MIT Licensed
*/
* work - Bar.js
* Copyright(c) 2015 xeodou <xeodou@gmail.com>
* MIT Licensed
*/
var React = require('react');
var PropTypes = React.PropTypes;
var emptyFunction = require('react/lib/emptyFunction');
var noop = function () {};
var Bar = React.createClass({

@@ -28,3 +29,3 @@

className: null,
onClick: emptyFunction
onClick: nopp
};

@@ -31,0 +32,0 @@ },

var React = require('react');
var assign = require('object-assign');
var PropTypes = React.PropTypes;
var emptyFunction = require('react/lib/emptyFunction');
var noop = function () {}
var Cursor = React.createClass({

@@ -24,4 +25,4 @@

position: 0,
onDragStart: emptyFunction,
onDragEnd: emptyFunction
onDragStart: noop,
onDragEnd: noop
};

@@ -28,0 +29,0 @@ },

var React = window.React = require('react');
var ReactDOM = require('react-dom');
var RangeSlider = require('../');

@@ -12,2 +13,10 @@

afterChange: function () {
console.log('after change called');
},
beforeChange: function () {
console.log('before change called');
},
render: function() {

@@ -21,3 +30,3 @@ return (

<div id='main'>
<RangeSlider step={5} value={[ '#42c6da','#3cb9ec','#42a5f5','#4a80df','#5c6bc0']} withBars cursor range={[true]}/>
<RangeSlider onBeforeChange={this.beforeChange} onAfterChange={this.afterChange} value={[ '#42c6da','#3cb9ec','#42a5f5','#4a80df','#5c6bc0']} withBars cursor range={[true]}/>
</div>

@@ -29,3 +38,3 @@ </div>

React.render(<App />, document.getElementById('react-range-example'))
ReactDOM.render(<App />, document.getElementById('react-range-example'))
/*
* react-range-slider - index.js
* Copyright(c) 2015 xeodou <xeodou@gmail.com>
* MIT Licensed
*/
* react-range-slider - index.js
* Copyright(c) 2015 xeodou <xeodou@gmail.com>
* MIT Licensed
*/
var React = require('react');
var PropTypes = React.PropTypes;
var emptyFunction = require('react/lib/emptyFunction');
var assign = require('object-assign');

@@ -14,2 +13,4 @@ var event = require('./event');

var noop = function () {}
/**

@@ -107,10 +108,2 @@ * To prevent text selection while dragging.

/**
* Slider steps for every step.
* Example:
* ```
* <RangeSlider step=5 />
* ```
*/
step: PropTypes.number,
/**
* Orientation for slider, must be horizontal or vertical, default is horizontal.

@@ -221,3 +214,2 @@ * Example:

value: [],
step: 1,
defaultValue: 0,

@@ -229,7 +221,7 @@ orientation: 'horizontal',

disabled: false,
onBeforeChange: emptyFunction,
onChange: emptyFunction,
onAfterChange: emptyFunction,
onBarClick: emptyFunction,
onMouseDown: emptyFunction
onBeforeChange: noop,
onChange: noop,
onAfterChange: noop,
onBarClick: noop,
onMouseDown: noop
};

@@ -298,4 +290,4 @@ },

handleResize: function () {
var slider = this.refs.slider.getDOMNode();
var handle = this.refs.header ? this.refs.header.getDOMNode() : {};
var slider = this.refs.slider;
var handle = this.refs.header ? this.refs.header : {};
var rect = slider.getBoundingClientRect();

@@ -345,3 +337,3 @@

e = this.isTouchDevice() ? e.changedTouches[e.changedTouches.length - 1] : e;
var position = (e['page' + this.state.axis]) * this.props.step,
var position = e['page' + this.state.axis],
diffPosition = position - this.state.startPosition,

@@ -355,3 +347,3 @@ diffValue = (diffPosition / this.state.upperBound) * (this.props.max - this.props.min),

// Move header
if(this.props.disabledHeader) return;
if (this.props.disabledHeader) return;
var v = l > 0 ? finder(Math.min, this.state.value, 'value') : this.state.max;

@@ -375,3 +367,3 @@ this.setState({

// Move tailer
if(this.props.disabledTailer) return;
if (this.props.disabledTailer) return;
var v = l > 0 ? finder(Math.max, this.state.value, 'value') : this.state.min;

@@ -396,2 +388,3 @@ this.setState({

this.removeEvent(window, this.dragEventFor['end'], this.handleDragEnd);
e.stopPropagation();
},

@@ -429,10 +422,10 @@

cursors.splice(0, 0, Cursor(assign({}, opts, {
offset: this.calcOffset(this.state.min),
position: 0,
ref: 'header',
key: 'header',
className: 'cursor header',
value: this.state.min,
onDragStart: this.handleDragStart.bind(null, 0)
})));
offset: this.calcOffset(this.state.min),
position: 0,
ref: 'header',
key: 'header',
className: 'cursor header',
value: this.state.min,
onDragStart: this.handleDragStart.bind(null, 0)
})));
}

@@ -439,0 +432,0 @@ if (this.state.tailer) {

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

@@ -32,3 +32,3 @@ "main": "index.js",

"peerDependencies": {
"react": ">=0.12.x"
"react": ">=0.14.x"
},

@@ -46,8 +46,9 @@ "author": "xeodou@gmail.com",

"gulp-rimraf": "^0.1.0",
"gulp-sass": "^0.7.3",
"gulp-sass": "^2.1.0",
"gulp-size": "^1.1.0",
"jest-cli": "^0.4.0",
"object-assign": "^3.0.0",
"react": "^0.12.1",
"reactify": "^0.17.1"
"react": "^0.14.2",
"react-dom": "^0.14.2",
"reactify": "^1.1.1"
},

@@ -54,0 +55,0 @@ "dependencies": {

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