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

rheostat

Package Overview
Dependencies
Maintainers
3
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rheostat - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

.nyc_output/157bbb88d33b579ea5eb99cd95dd5c7f.json

7

CHANGELOG.md

@@ -8,2 +8,9 @@ # Change Log

## [2.1.1] - 2017-07-11
### Changed
- [Fix] use prop-types + create-react-class packages (#73)
- [Fix] ensure `Object.assign` is transformed to `object.assign`
## [2.1.0] - 2016-11-10

@@ -10,0 +17,0 @@

143

lib/Slider.js

@@ -13,2 +13,6 @@ Object.defineProperty(exports, "__esModule", {

var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _SliderConstants = require('./constants/SliderConstants');

@@ -33,2 +37,3 @@

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* globals document */
/* eslint react/no-array-index-key: 1 */

@@ -43,4 +48,4 @@ function getClassName(props) {

var PropTypeArrOfNumber = _react.PropTypes.arrayOf(_react.PropTypes.number);
var PropTypeReactComponent = _react.PropTypes.oneOfType([_react.PropTypes.func, _react.PropTypes.string]);
var PropTypeArrOfNumber = _propTypes2['default'].arrayOf(_propTypes2['default'].number);
var PropTypeReactComponent = _propTypes2['default'].oneOfType([_propTypes2['default'].func, _propTypes2['default'].string]);

@@ -62,3 +67,3 @@ function getHandleFor(ev) {

return _possibleConstructorReturn(this, Object.getPrototypeOf(Button).apply(this, arguments));
return _possibleConstructorReturn(this, (Button.__proto__ || Object.getPrototypeOf(Button)).apply(this, arguments));
}

@@ -82,35 +87,35 @@

// the algorithm to use
algorithm: _react.PropTypes.shape({
getValue: _react.PropTypes.func,
getPosition: _react.PropTypes.func
algorithm: _propTypes2['default'].shape({
getValue: _propTypes2['default'].func,
getPosition: _propTypes2['default'].func
}),
// any children you pass in
children: _react.PropTypes.any,
children: _propTypes2['default'].any,
// standard class name you'd like to apply to the root element
className: _react.PropTypes.string,
className: _propTypes2['default'].string,
// prevent the slider from moving when clicked
disabled: _react.PropTypes.bool,
disabled: _propTypes2['default'].bool,
// a custom handle you can pass in
handle: PropTypeReactComponent,
// the maximum possible value
max: _react.PropTypes.number,
max: _propTypes2['default'].number,
// the minimum possible value
min: _react.PropTypes.number,
min: _propTypes2['default'].number,
// called on click
onClick: _react.PropTypes.func,
onClick: _propTypes2['default'].func,
// called whenever the user is done changing values on the slider
onChange: _react.PropTypes.func,
onChange: _propTypes2['default'].func,
// called on key press
onKeyPress: _react.PropTypes.func,
onKeyPress: _propTypes2['default'].func,
// called when you finish dragging a handle
onSliderDragEnd: _react.PropTypes.func,
onSliderDragEnd: _propTypes2['default'].func,
// called every time the slider is dragged and the value changes
onSliderDragMove: _react.PropTypes.func,
onSliderDragMove: _propTypes2['default'].func,
// called when you start dragging a handle
onSliderDragStart: _react.PropTypes.func,
onSliderDragStart: _propTypes2['default'].func,
// called whenever the user is actively changing the values on the slider
// (dragging, clicked, keypress)
onValuesUpdated: _react.PropTypes.func,
onValuesUpdated: _propTypes2['default'].func,
// the orientation
orientation: _react.PropTypes.oneOf(['horizontal', 'vertical']),
orientation: _propTypes2['default'].oneOf(['horizontal', 'vertical']),
// a component for rendering the pits

@@ -123,3 +128,3 @@ pitComponent: PropTypeReactComponent,

// should we snap?
snap: _react.PropTypes.bool,
snap: _propTypes2['default'].bool,
// the points we should snap to

@@ -152,8 +157,8 @@ snapPoints: PropTypeArrOfNumber,

var _this2 = _possibleConstructorReturn(this, Object.getPrototypeOf(Rheostat).call(this, props));
var _this2 = _possibleConstructorReturn(this, (Rheostat.__proto__ || Object.getPrototypeOf(Rheostat)).call(this, props));
var _this2$props = _this2.props;
var max = _this2$props.max;
var min = _this2$props.min;
var values = _this2$props.values;
var _this2$props = _this2.props,
max = _this2$props.max,
min = _this2$props.min,
values = _this2$props.values;

@@ -338,6 +343,6 @@ _this2.state = {

var _props = this.props;
var algorithm = _props.algorithm;
var max = _props.max;
var min = _props.min;
var _props = this.props,
algorithm = _props.algorithm,
max = _props.max,
min = _props.min;

@@ -360,10 +365,10 @@

var _state = this.state;
var handlePos = _state.handlePos;
var values = _state.values;
var _props2 = this.props;
var algorithm = _props2.algorithm;
var max = _props2.max;
var min = _props2.min;
var snapPoints = _props2.snapPoints;
var _state = this.state,
handlePos = _state.handlePos,
values = _state.values;
var _props2 = this.props,
algorithm = _props2.algorithm,
max = _props2.max,
min = _props2.min,
snapPoints = _props2.snapPoints;

@@ -446,5 +451,5 @@

var handlePos = this.state.handlePos;
var _props3 = this.props;
var max = _props3.max;
var min = _props3.min;
var _props3 = this.props,
max = _props3.max,
min = _props3.min;

@@ -591,5 +596,5 @@

function handleSlide(x, y) {
var _state2 = this.state;
var idx = _state2.slidingIndex;
var sliderBox = _state2.sliderBox;
var _state2 = this.state,
idx = _state2.slidingIndex,
sliderBox = _state2.sliderBox;

@@ -721,8 +726,10 @@

function validatePosition(idx, proposedPosition) {
var _state3 = this.state;
var handlePos = _state3.handlePos;
var handleDimensions = _state3.handleDimensions;
var _state3 = this.state,
handlePos = _state3.handlePos,
handleDimensions = _state3.handleDimensions;
return Math.max(Math.min(proposedPosition, handlePos[idx + 1] !== undefined ? handlePos[idx + 1] - handleDimensions : SliderConstants.PERCENT_FULL), handlePos[idx - 1] !== undefined ? handlePos[idx - 1] + handleDimensions : SliderConstants.PERCENT_EMPTY);
return Math.max(Math.min(proposedPosition, handlePos[idx + 1] !== undefined ? handlePos[idx + 1] - handleDimensions : SliderConstants.PERCENT_FULL // 100% is the highest value
), handlePos[idx - 1] !== undefined ? handlePos[idx - 1] + handleDimensions : SliderConstants.PERCENT_EMPTY // 0% is the lowest value
);
}

@@ -736,8 +743,6 @@

function validateValues(proposedValues, props) {
var _ref = props || this.props;
var _ref = props || this.props,
max = _ref.max,
min = _ref.min;
var max = _ref.max;
var min = _ref.min;
return proposedValues.map(function (value, idx, values) {

@@ -763,5 +768,5 @@ var realValue = Math.max(Math.min(value, max), min);

function canMove(idx, proposedPosition) {
var _state4 = this.state;
var handlePos = _state4.handlePos;
var handleDimensions = _state4.handleDimensions;
var _state4 = this.state,
handlePos = _state4.handlePos,
handleDimensions = _state4.handleDimensions;

@@ -830,5 +835,5 @@

var max = nextProps.max;
var min = nextProps.min;
var values = nextProps.values;
var max = nextProps.max,
min = nextProps.min,
values = nextProps.values;

@@ -856,13 +861,13 @@

var _props4 = this.props;
var algorithm = _props4.algorithm;
var children = _props4.children;
var disabled = _props4.disabled;
var Handle = _props4.handle;
var max = _props4.max;
var min = _props4.min;
var orientation = _props4.orientation;
var PitComponent = _props4.pitComponent;
var pitPoints = _props4.pitPoints;
var ProgressBar = _props4.progressBar;
var _props4 = this.props,
algorithm = _props4.algorithm,
children = _props4.children,
disabled = _props4.disabled,
Handle = _props4.handle,
max = _props4.max,
min = _props4.min,
orientation = _props4.orientation,
PitComponent = _props4.pitComponent,
pitPoints = _props4.pitPoints,
ProgressBar = _props4.progressBar;

@@ -869,0 +874,0 @@

{
"name": "rheostat",
"version": "2.1.0",
"version": "2.1.1",
"description": "Rheostat is a www, mobile, and accessible slider component built with React",

@@ -13,7 +13,10 @@ "main": "lib/Slider.js",

"storybook": "start-storybook -p 9001",
"pretest": "npm run lint",
"test": "npm run build && npm run test:coverage",
"tests-only": "npm run build && npm run test:quick",
"test:coverage": "babel-node node_modules/.bin/babel-istanbul cover node_modules/.bin/_mocha -- -R tap 'test/**/*-test.*'",
"test:quick": "babel-node node_modules/.bin/_mocha -R tap test/*-test.*",
"pretest": "npm run build && npm run lint",
"test": "nyc npm run test:all",
"tests-only": "npm run build && npm run test:all",
"test:all": "npm run test:node && npm run test:dom",
"test:node": "npm run test:mocha",
"test:dom": "WITH_DOM=1 npm run test:mocha -- --require './test/.dom.js'",
"test:mocha": "npm run mocha 'test/**/*-test.*'",
"mocha": "mocha -R tap --compilers js:babel-register",
"react:clean": "rimraf node_modules/react node_modules/react-dom node_modules/react-addons-test-utils",

@@ -31,29 +34,38 @@ "react:13": "npm run react:clean && npm i react@0.13",

"devDependencies": {
"@kadira/storybook": "^2.4.2",
"babel-cli": "^6.18.0",
"babel-core": "^6.18.2",
"babel-istanbul": "^0.11.0",
"babel-preset-airbnb": "^2.1.1",
"casual": "^1.5.8",
"chai": "^3.5.0",
"chai-enzyme": "^0.6.0",
"enzyme": "^1.6.0",
"eslint": "^3.9.1",
"eslint-config-airbnb": "^13.0.0",
"eslint-plugin-import": "^2.1.0",
"eslint-plugin-jsx-a11y": "^2.2.3",
"eslint-plugin-react": "^6.6.0",
"@kadira/storybook": "^2.35.3",
"babel-cli": "^6.24.1",
"babel-core": "^6.25.0",
"babel-plugin-transform-replace-object-assign": "^0.2.1",
"babel-preset-airbnb": "^2.4.0",
"babel-register": "^6.24.1",
"casual": "^1.5.14",
"chai": "^4.0.2",
"chai-enzyme": "^0.8.0",
"create-react-class": "^15.6.0",
"enzyme": "^2.9.1",
"eslint": "^3.19.0",
"eslint-config-airbnb": "^15.0.2",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^5.1.1",
"eslint-plugin-react": "^7.1.0",
"has": "^1.0.1",
"mocha": "^3.1.2",
"jsdom": "^9.12.0",
"mocha": "^3.4.2",
"nyc": "^11.0.3",
"raw-loader": "^0.5.1",
"react": "^0.14.3",
"react-addons-test-utils": "^0.14.8",
"react-dom": "^0.14.3",
"rimraf": "^2.5.4",
"sinon": "^1.17.6",
"style-loader": "^0.13.1"
"react": "^15.6.1",
"react-addons-test-utils": "^15.6.0",
"react-dom": "^15.6.1",
"react-test-renderer": "^15.6.1",
"rimraf": "^2.6.1",
"sinon": "^2.3.7",
"style-loader": "^0.17.0"
},
"peerDependencies": {
"react": ">=0.13.x"
},
"dependencies": {
"object.assign": "^4.0.4",
"prop-types": "^15.5.10"
}
}
/* globals document */
/* eslint react/no-array-index-key: 1 */
import React, { PropTypes } from 'react';
import React from 'react';
import PropTypes from 'prop-types';

@@ -5,0 +7,0 @@ import * as SliderConstants from './constants/SliderConstants';

@@ -53,5 +53,9 @@ import React, { PropTypes } from 'react';

LabeledSlider.propTypes = {
values: PropTypes.array,
values: PropTypes.array, // eslint-disable-line react/forbid-prop-types
formatValue: PropTypes.func,
};
LabeledSlider.defaultProps = {
values: [],
formatValue: null,
};

@@ -84,2 +88,5 @@ storiesOf('Slider', module)

};
MyHandle.defaultProps = {
style: null,
};

@@ -166,5 +173,9 @@ return (

PitComponent.propTypes = {
style: PropTypes.object,
style: PropTypes.object, // eslint-disable-line react/forbid-prop-types
children: PropTypes.number,
};
PitComponent.defaultProps = {
style: null,
children: null,
};

@@ -171,0 +182,0 @@ return (

@@ -1,3 +0,5 @@

import { shallow, describeWithDOM, mount } from 'enzyme';
import { shallow, mount } from 'enzyme';
import React from 'react';
import createReactClass from 'create-react-class';
import sinon from 'sinon';

@@ -10,2 +12,10 @@ import { assert } from 'chai';

const { WITH_DOM } = process.env;
function skipWithoutDom() {
if (WITH_DOM !== '1') {
this.skip();
}
}
function testKeys(slider, tests) {

@@ -21,3 +31,5 @@ Object.keys(tests).forEach((key) => {

describeWithDOM('<Slider />', () => {
describe('<Slider />', () => {
beforeEach(skipWithoutDom);
describe('render', () => {

@@ -46,5 +58,3 @@ it('should render the slider with one handle by default', () => {

const pitRender = sinon.stub().returns(<div />);
// eslint-disable-next-line
const PitComponent = React.createClass({
const PitComponent = createReactClass({
render: pitRender,

@@ -60,5 +70,3 @@ });

const pitRender = sinon.stub().returns(<div />);
// eslint-disable-next-line
const PitComponent = React.createClass({
const PitComponent = createReactClass({
render: pitRender,

@@ -65,0 +73,0 @@ });

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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