Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nuka-carousel

Package Overview
Dependencies
Maintainers
1
Versions
145
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuka-carousel - npm Package Compare versions

Comparing version 0.0.17 to 0.0.18

36

lib/carousel.js

@@ -123,4 +123,9 @@ 'use strict';

this.bindEvents();
this.setExternalData();
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
this.setDimensions();
},
componentWillUnmount: function componentWillUnmount() {

@@ -132,3 +137,3 @@ this.unbindEvents();

var self = this;
var children = this.formatChildren(this.props.children);
var children = _React2['default'].Children.count(this.props.children) > 1 ? this.formatChildren(this.props.children) : this.props.children;
return _React2['default'].createElement(

@@ -296,3 +301,3 @@ 'div',

if (this.touchObject.direction === 1) {
if (this.state.currentSlide >= this.props.children.length - this.props.slidesToScroll) {
if (this.state.currentSlide >= _React2['default'].Children.count(this.props.children) - this.props.slidesToScroll) {
this.animateSlide(_tweenState2['default'].easingTypes[this.props.edgeEasing]);

@@ -355,3 +360,3 @@ } else {

var self = this;
if (index >= this.props.children.length || index < 0) {
if (index >= _React2['default'].Children.count(this.props.children) || index < 0) {
return;

@@ -369,3 +374,3 @@ }

var self = this;
if (this.state.currentSlide + this.props.slidesToScroll >= this.props.children.length) {
if (this.state.currentSlide + this.props.slidesToScroll >= _React2['default'].Children.count(this.props.children)) {
return;

@@ -464,3 +469,3 @@ }

var self = this;
return children.map(function (child, index) {
return _React2['default'].Children.map(children, function (child, index) {
return _React2['default'].createElement(

@@ -488,3 +493,3 @@ 'li',

frameWidth: this.props.vertical ? frameHeight : '100%',
slideCount: this.props.children.length,
slideCount: _React2['default'].Children.count(this.props.children),
slideWidth: slideWidth

@@ -507,4 +512,8 @@ }, function () {

firstSlide = frame.childNodes[0].childNodes[0];
firstSlide.style.height = 'auto';
slideHeight = firstSlide.offsetHeight * this.props.slidesToShow;
if (firstSlide) {
firstSlide.style.height = 'auto';
slideHeight = firstSlide.offsetHeight * this.props.slidesToShow;
} else {
slideHeight = 100;
}

@@ -529,7 +538,8 @@ if (typeof this.props.slideWidth !== 'number') {

frameWidth: this.props.vertical ? frameHeight : frame.offsetWidth,
slideCount: this.props.children.length,
slideWidth: slideWidth
slideCount: _React2['default'].Children.count(this.props.children),
slideWidth: slideWidth,
left: this.props.vertical ? 0 : this.getTargetLeft(),
top: this.props.vertical ? this.getTargetLeft() : 0
}, function () {
self.setLeft();
self.setExternalData();
});

@@ -556,4 +566,4 @@ },

getListStyles: function getListStyles() {
var listWidth = this.state.slideWidth * this.props.children.length;
var spacingOffset = this.props.cellSpacing * this.props.children.length;
var listWidth = this.state.slideWidth * _React2['default'].Children.count(this.props.children);
var spacingOffset = this.props.cellSpacing * _React2['default'].Children.count(this.props.children);
return {

@@ -560,0 +570,0 @@ position: 'relative',

{
"name": "nuka-carousel",
"version": "0.0.17",
"version": "0.0.18",
"description": "Pure React Carousel",

@@ -11,5 +11,2 @@ "main": "index.js",

},
"peerDependencies": {
"react": "0.13.x"
},
"devDependencies": {

@@ -45,3 +42,3 @@ "babel-core": "^4.7.16",

"mocha": "^2.2.1",
"react": "0.13.x",
"react": "^0.13.3",
"react-hot-loader": "^1.0.7",

@@ -48,0 +45,0 @@ "sinon": "^1.14.1",

@@ -102,4 +102,9 @@ 'use strict';

this.bindEvents();
this.setExternalData();
},
componentWillReceiveProps(nextProps) {
this.setDimensions();
},
componentWillUnmount() {

@@ -111,3 +116,3 @@ this.unbindEvents();

var self = this;
var children = this.formatChildren(this.props.children);
var children = React.Children.count(this.props.children) > 1 ? this.formatChildren(this.props.children) : this.props.children;
return (

@@ -285,3 +290,3 @@ <div className={['slider', this.props.className || ''].join(' ')} ref="slider" style={assign(this.getSliderStyles(), this.props.style || {})}>

if (this.touchObject.direction === 1) {
if (this.state.currentSlide >= this.props.children.length - this.props.slidesToScroll) {
if (this.state.currentSlide >= React.Children.count(this.props.children) - this.props.slidesToScroll) {
this.animateSlide(tweenState.easingTypes[this.props.edgeEasing]);

@@ -345,3 +350,3 @@ } else {

var self = this;
if (index >= this.props.children.length || index < 0) {
if (index >= React.Children.count(this.props.children) || index < 0) {
return;

@@ -359,3 +364,3 @@ }

var self = this;
if ((this.state.currentSlide + this.props.slidesToScroll) >= this.props.children.length) {
if ((this.state.currentSlide + this.props.slidesToScroll) >= React.Children.count(this.props.children)) {
return;

@@ -451,3 +456,3 @@ }

var self = this;
return children.map(function(child, index) {
return React.Children.map(children, function(child, index) {
return <li className="slider-slide" style={self.getSlideStyles()} key={index}>{child}</li>

@@ -466,4 +471,4 @@ });

this.setState({
frameWidth: this.props.vertical ? frameHeight : "100%",
slideCount: this.props.children.length,
frameWidth: this.props.vertical ? frameHeight : '100%',
slideCount: React.Children.count(this.props.children),
slideWidth: slideWidth

@@ -481,4 +486,8 @@ }, function() {

firstSlide = frame.childNodes[0].childNodes[0];
firstSlide.style.height = 'auto';
slideHeight = firstSlide.offsetHeight * this.props.slidesToShow;
if (firstSlide) {
firstSlide.style.height = 'auto';
slideHeight = firstSlide.offsetHeight * this.props.slidesToShow;
} else {
slideHeight = 100;
}

@@ -503,7 +512,8 @@ if (typeof this.props.slideWidth !== 'number') {

frameWidth: this.props.vertical ? frameHeight : frame.offsetWidth,
slideCount: this.props.children.length,
slideWidth: slideWidth
slideCount: React.Children.count(this.props.children),
slideWidth: slideWidth,
left: this.props.vertical ? 0 : this.getTargetLeft(),
top: this.props.vertical ? this.getTargetLeft() : 0
}, function() {
self.setLeft();
self.setExternalData();
self.setLeft()
});

@@ -530,4 +540,4 @@ },

getListStyles() {
var listWidth = this.state.slideWidth * this.props.children.length;
var spacingOffset = this.props.cellSpacing * this.props.children.length;
var listWidth = this.state.slideWidth * React.Children.count(this.props.children);
var spacingOffset = this.props.cellSpacing * React.Children.count(this.props.children);
return {

@@ -534,0 +544,0 @@ position: 'relative',

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