react-carousel
Advanced tools
Comparing version 3.1.1 to 3.1.2
@@ -43,2 +43,4 @@ 'use strict'; | ||
function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -48,3 +50,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; } /* eslint-disable no-unused-vars, lines-around-comment */ | ||
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; } | ||
@@ -61,8 +63,8 @@ /* eslint-disable react/no-set-state, react/no-did-mount-set-state */ | ||
_this.getIndexToScrollTo = function (_ref) { | ||
var totalItems = _ref.totalItems; | ||
var firstVisibleIndex = _ref.firstVisibleIndex; | ||
var direction = _ref.direction; | ||
var visibleItemsCount = _ref.visibleItemsCount; | ||
var scrollStepDistance = _ref.scrollStepDistance; | ||
_this.getIndexToScrollTo = function (_ref3) { | ||
var totalItems = _ref3.totalItems; | ||
var firstVisibleIndex = _ref3.firstVisibleIndex; | ||
var direction = _ref3.direction; | ||
var visibleItemsCount = _ref3.visibleItemsCount; | ||
var scrollStepDistance = _ref3.scrollStepDistance; | ||
@@ -86,12 +88,24 @@ var index = undefined, | ||
_this.isNextButtonVisible = function (firstVisibleIndex, totalItems, visibleItemsCount) { | ||
if (!(typeof firstVisibleIndex === 'number')) { | ||
throw new TypeError('Value of argument "firstVisibleIndex" violates contract, expected number got ' + (firstVisibleIndex === null ? 'null' : (typeof firstVisibleIndex === 'undefined' ? 'undefined' : _typeof(firstVisibleIndex)) === 'object' && firstVisibleIndex.constructor ? firstVisibleIndex.constructor.name || '[Unknown Object]' : typeof firstVisibleIndex === 'undefined' ? 'undefined' : _typeof(firstVisibleIndex))); | ||
} | ||
if (!(typeof totalItems === 'number')) { | ||
throw new TypeError('Value of argument "totalItems" violates contract, expected number got ' + (totalItems === null ? 'null' : (typeof totalItems === 'undefined' ? 'undefined' : _typeof(totalItems)) === 'object' && totalItems.constructor ? totalItems.constructor.name || '[Unknown Object]' : typeof totalItems === 'undefined' ? 'undefined' : _typeof(totalItems))); | ||
} | ||
if (!(typeof visibleItemsCount === 'number')) { | ||
throw new TypeError('Value of argument "visibleItemsCount" violates contract, expected number got ' + (visibleItemsCount === null ? 'null' : (typeof visibleItemsCount === 'undefined' ? 'undefined' : _typeof(visibleItemsCount)) === 'object' && visibleItemsCount.constructor ? visibleItemsCount.constructor.name || '[Unknown Object]' : typeof visibleItemsCount === 'undefined' ? 'undefined' : _typeof(visibleItemsCount))); | ||
} | ||
return firstVisibleIndex < totalItems - visibleItemsCount; | ||
}; | ||
_this.getVisibleItemsCount = function (_ref2) { | ||
var firstVisibleIndex = _ref2.firstVisibleIndex; | ||
var maxWidth = _ref2.maxWidth; | ||
var totalItems = _ref2.totalItems; | ||
var itemWidth = _ref2.itemWidth; | ||
var controlWidth = _ref2.controlWidth; | ||
var itemMargin = _ref2.itemMargin; | ||
_this.getVisibleItemsCount = function (_ref4) { | ||
var firstVisibleIndex = _ref4.firstVisibleIndex; | ||
var maxWidth = _ref4.maxWidth; | ||
var totalItems = _ref4.totalItems; | ||
var itemWidth = _ref4.itemWidth; | ||
var controlWidth = _ref4.controlWidth; | ||
var itemMargin = _ref4.itemMargin; | ||
@@ -138,2 +152,10 @@ var availableWidth = undefined, | ||
_this.handleScrollToDirection = function (direction, visibleItemsCount) { | ||
if (!(typeof direction === 'string')) { | ||
throw new TypeError('Value of argument "direction" violates contract, expected string got ' + (direction === null ? 'null' : (typeof direction === 'undefined' ? 'undefined' : _typeof(direction)) === 'object' && direction.constructor ? direction.constructor.name || '[Unknown Object]' : typeof direction === 'undefined' ? 'undefined' : _typeof(direction))); | ||
} | ||
if (!(typeof visibleItemsCount === 'number')) { | ||
throw new TypeError('Value of argument "visibleItemsCount" violates contract, expected number got ' + (visibleItemsCount === null ? 'null' : (typeof visibleItemsCount === 'undefined' ? 'undefined' : _typeof(visibleItemsCount)) === 'object' && visibleItemsCount.constructor ? visibleItemsCount.constructor.name || '[Unknown Object]' : typeof visibleItemsCount === 'undefined' ? 'undefined' : _typeof(visibleItemsCount))); | ||
} | ||
return function () { | ||
@@ -159,2 +181,6 @@ var index = undefined; | ||
_this.getItemJsx = function (visibleItemsCount) { | ||
if (!(typeof visibleItemsCount === 'number')) { | ||
throw new TypeError('Value of argument "visibleItemsCount" violates contract, expected number got ' + (visibleItemsCount === null ? 'null' : (typeof visibleItemsCount === 'undefined' ? 'undefined' : _typeof(visibleItemsCount)) === 'object' && visibleItemsCount.constructor ? visibleItemsCount.constructor.name || '[Unknown Object]' : typeof visibleItemsCount === 'undefined' ? 'undefined' : _typeof(visibleItemsCount))); | ||
} | ||
/** | ||
@@ -236,8 +262,3 @@ * Creates JSX for one item | ||
/** | ||
* Tells if the next button shall be visible or not | ||
* | ||
* @param {number} firstVisibleIndex Index of the item to which the carousel is scrolled to | ||
* @param {number} totalItems Total number of items shown in the carousel | ||
* @param {number} visibleItemsCount Number Number of items visible at the moment | ||
* @returns {boolean} | ||
* Tells if the next button shall be visible or not. | ||
*/ | ||
@@ -250,6 +271,8 @@ | ||
* Tells if the previous control button shall be visible or not. | ||
* @param {number} firstVisibleIndex Index of the item to which the carousel is scrolled to | ||
* @returns {boolean} | ||
*/ | ||
value: function isPrevButtonVisible(firstVisibleIndex) { | ||
if (!(typeof firstVisibleIndex === 'number')) { | ||
throw new TypeError('Value of argument "firstVisibleIndex" violates contract, expected number got ' + (firstVisibleIndex === null ? 'null' : (typeof firstVisibleIndex === 'undefined' ? 'undefined' : _typeof(firstVisibleIndex)) === 'object' && firstVisibleIndex.constructor ? firstVisibleIndex.constructor.name || '[Unknown Object]' : typeof firstVisibleIndex === 'undefined' ? 'undefined' : _typeof(firstVisibleIndex))); | ||
} | ||
return firstVisibleIndex > 0; | ||
@@ -372,9 +395,9 @@ } | ||
Carousel.defaultProps = { | ||
controlWidth: 30, | ||
firstVisibleIndex: 0, | ||
itemMargin: 1, | ||
itemWidth: 50, | ||
scrollStepDistance: 3, | ||
controlWidth: 30, | ||
itemMargin: 1 | ||
scrollStepDistance: 3 | ||
}; | ||
exports.default = (0, _reactCssModules2.default)(Carousel, _carousel2.default); | ||
//# sourceMappingURL=index.js.map |
@@ -11,3 +11,3 @@ { | ||
"babel-preset-stage-0": "^6.3.13", | ||
"css-loader": "^0.23.0", | ||
"css-loader": "^0.23.1", | ||
"extract-text-webpack-plugin": "^0.9.1", | ||
@@ -22,3 +22,3 @@ "node-sass": "^3.4.2", | ||
"react": "^0.14.3", | ||
"react-carousel": "^3.1.0", | ||
"react-carousel": "^3.1.1", | ||
"react-css-modules": "^3.6.3", | ||
@@ -25,0 +25,0 @@ "react-dom": "^0.14.3" |
{ | ||
"name": "react-carousel", | ||
"version": "3.1.1", | ||
"description": "Carousel react component", | ||
"main": "dist/index.js", | ||
"version": "3.1.2", | ||
"description": "React carousel component.", | ||
"main": "./dist/index.js", | ||
"license": "BSD-3-Clause", | ||
"scripts": { | ||
"pragmatist": "node ./node_modules/.bin/pragmatist --browser", | ||
"pragmatist": "node ./node_modules/.bin/pragmatist --browser --types", | ||
"lint": "npm run pragmatist lint", | ||
@@ -17,3 +18,3 @@ "test": "npm run pragmatist test", | ||
"type": "git", | ||
"url": "git@github.com:applaudience/react-carousel.git" | ||
"url": "git@github.com:gajus/react-carousel.git" | ||
}, | ||
@@ -27,6 +28,8 @@ "engines": { | ||
"devDependencies": { | ||
"babel-plugin-lodash": "^1.0.2", | ||
"chai": "^3.4.1", | ||
"mockery": "^1.4.0", | ||
"pragmatist": "^2.3.2", | ||
"pragmatist": "^2.3.5", | ||
"react": "^0.14.3", | ||
"react-css-modules": "^3.6.3", | ||
"react-dom": "^0.14.3", | ||
"sinon": "^1.17.2", | ||
@@ -33,0 +36,0 @@ "sinon-chai": "^2.8.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
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
79
0
48883
8
8
80
409