react-carousel
Advanced tools
Comparing version 4.2.2 to 4.2.3
@@ -51,2 +51,4 @@ import React from 'react'; | ||
scrollStepDistance={this.state.scrollStepDistance} | ||
// eslint-disable-next-line react/forbid-component-props | ||
style={{ | ||
@@ -53,0 +55,0 @@ background: '#eee', |
@@ -16,6 +16,2 @@ 'use strict'; | ||
var _propTypes = require('prop-types'); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
var _range = require('range'); | ||
@@ -61,2 +57,4 @@ | ||
index = firstVisibleIndex - (itemsBehindVisible > scrollStepDistance ? scrollStepDistance : itemsBehindVisible); | ||
} else { | ||
throw new Error('Unexpected state.'); | ||
} | ||
@@ -255,10 +253,2 @@ | ||
Carousel.propTypes = { | ||
controlWidth: _propTypes2.default.number, | ||
firstVisibleIndex: _propTypes2.default.number, | ||
itemMargin: _propTypes2.default.number, | ||
itemWidth: _propTypes2.default.number.isRequired, | ||
onItemScroll: _propTypes2.default.func, | ||
scrollStepDistance: _propTypes2.default.number | ||
}; | ||
Carousel.defaultProps = { | ||
@@ -265,0 +255,0 @@ controlWidth: 30, |
@@ -1,47 +0,1 @@ | ||
{ | ||
"description": "React carousel.", | ||
"devDependencies": { | ||
"babel-cli": "^6.24.1", | ||
"babel-core": "^6.24.1", | ||
"babel-plugin-transform-flow-strip-types": "^6.22.0", | ||
"babel-preset-es2015": "^6.24.1", | ||
"babel-preset-react": "^6.24.1", | ||
"babel-preset-stage-0": "^6.24.1", | ||
"chai": "^3.5.0", | ||
"eslint": "^3.19.0", | ||
"eslint-config-canonical": "^8.1.1", | ||
"flow-bin": "^0.44.2", | ||
"flow-copy-source": "^1.1.0", | ||
"mocha": "^3.2.0", | ||
"react": "^15.5.4", | ||
"react-dom": "^15.5.4", | ||
"semantic-release": "^6.3.2", | ||
"sinon": "^2.1.0", | ||
"sinon-chai": "^2.9.0" | ||
}, | ||
"engines": { | ||
"node": ">4" | ||
}, | ||
"keywords": [ | ||
"react", | ||
"carousel" | ||
], | ||
"license": "BSD-3-Clause", | ||
"main": "./dist/Carousel.js", | ||
"name": "react-carousel", | ||
"repository": { | ||
"type": "git", | ||
"url": "git@github.com:gajus/react-carousel.git" | ||
}, | ||
"scripts": { | ||
"build": "rm -fr ./dist && NODE_ENV=production babel ./src --source-maps --copy-files --out-dir ./dist && flow-copy-source src dist", | ||
"lint": "eslint ./test ./src ./demo/src && flow", | ||
"test": "mocha --compilers js:babel-core/register" | ||
}, | ||
"version": "4.2.2", | ||
"dependencies": { | ||
"debounce": "^1.0.2", | ||
"prop-types": "^15.5.8", | ||
"range": "0.0.3" | ||
} | ||
} | ||
{"description":"React carousel.","devDependencies":{"babel-cli":"^6.26.0","babel-core":"^6.26.0","babel-plugin-transform-flow-strip-types":"^6.22.0","babel-preset-es2015":"^6.24.1","babel-preset-react":"^6.24.1","babel-preset-stage-0":"^6.24.1","chai":"^4.1.2","eslint":"^4.11.0","eslint-config-canonical":"^9.3.1","flow-bin":"^0.59.0","flow-copy-source":"^1.2.1","mocha":"^4.0.1","react":"^16.1.1","react-dom":"^16.1.1","semantic-release":"^8.2.0","sinon":"^4.1.2","sinon-chai":"^2.14.0"},"engines":{"node":">4"},"keywords":["react","carousel"],"license":"BSD-3-Clause","main":"./dist/Carousel.js","name":"react-carousel","repository":{"type":"git","url":"git@github.com:gajus/react-carousel.git"},"scripts":{"build":"rm -fr ./dist && NODE_ENV=production babel ./src --source-maps --copy-files --out-dir ./dist && flow-copy-source src dist","lint":"eslint ./test ./src ./demo/src && flow","test":"mocha --compilers js:babel-core/register"},"version":"4.2.3","dependencies":{"debounce":"^1.1.0","range":"0.0.3"}} |
@@ -6,3 +6,2 @@ // @flow | ||
} from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { | ||
@@ -15,6 +14,6 @@ range | ||
type StateType = { | ||
type ComponentStateType = {| | ||
firstVisibleIndex: number, | ||
maxWidth: number | ||
}; | ||
|}; | ||
@@ -43,3 +42,3 @@ /** | ||
scrollStepDistance: number | ||
) => { | ||
): number => { | ||
let index; | ||
@@ -54,2 +53,4 @@ | ||
index = firstVisibleIndex - (itemsBehindVisible > scrollStepDistance ? scrollStepDistance : itemsBehindVisible); | ||
} else { | ||
throw new Error('Unexpected state.'); | ||
} | ||
@@ -92,16 +93,19 @@ | ||
class Carousel extends Component { | ||
type PropsType = {| | ||
+children: *, | ||
+controlWidth: number, | ||
+firstVisibleIndex: number, | ||
+itemMargin: number, | ||
+itemWidth: number, | ||
+onItemScroll: (index: number) => void, | ||
+scrollStepDistance: number, | ||
+style: { | ||
[key: string]: string | ||
} | ||
|}; | ||
class Carousel extends Component<PropsType, ComponentStateType> { | ||
resizeEventListener: () => void; | ||
wrapperElement: HTMLElement; | ||
state: StateType; | ||
static propTypes = { | ||
controlWidth: PropTypes.number, | ||
firstVisibleIndex: PropTypes.number, | ||
itemMargin: PropTypes.number, | ||
itemWidth: PropTypes.number.isRequired, | ||
onItemScroll: PropTypes.func, | ||
scrollStepDistance: PropTypes.number | ||
}; | ||
static defaultProps = { | ||
@@ -116,3 +120,3 @@ controlWidth: 30, | ||
constructor (props: Object) { | ||
constructor (props: PropsType) { | ||
super(props); | ||
@@ -119,0 +123,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
2
46947
524
- Removedprop-types@^15.5.8
- Removedjs-tokens@4.0.0(transitive)
- Removedloose-envify@1.4.0(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedprop-types@15.8.1(transitive)
- Removedreact-is@16.13.1(transitive)
Updateddebounce@^1.1.0