react-responsive-carousel
Advanced tools
Comparing version 3.0.11 to 3.0.12
@@ -36,3 +36,3 @@ var React = require('react'); | ||
} | ||
}, | ||
}, | ||
@@ -45,3 +45,3 @@ getInitialState:function () { | ||
} | ||
}, | ||
}, | ||
@@ -58,3 +58,3 @@ componentWillReceiveProps:function (props, state) { | ||
componentWillMount:function() { | ||
// as the widths are calculated, we need to resize | ||
// as the widths are calculated, we need to resize | ||
// the carousel when the window is resized | ||
@@ -73,3 +73,3 @@ window.addEventListener("resize", this.updateSizes); | ||
componentDidMount:function (nextProps) { | ||
// when the component is rendered we need to calculate | ||
// when the component is rendered we need to calculate | ||
// the container size to adjust the responsive behaviour | ||
@@ -79,3 +79,3 @@ this.updateSizes(); | ||
this.isHorizontal = this.props.axis === 'horizontal'; | ||
var defaultImg = ReactDOM.findDOMNode(this.item0).getElementsByTagName('img')[0]; | ||
@@ -102,3 +102,3 @@ defaultImg && defaultImg.addEventListener('load', this.setMountState); | ||
handler(index, item); | ||
} | ||
} | ||
@@ -110,3 +110,3 @@ if (index !== this.state.selectedItem) { | ||
} | ||
}, | ||
}, | ||
@@ -118,4 +118,4 @@ handleOnChange:function (index, item) { | ||
handler(index, item); | ||
} | ||
}, | ||
} | ||
}, | ||
@@ -149,6 +149,6 @@ handleClickThumb:function(index, item) { | ||
var isHorizontal = this.props.axis === 'horizontal'; | ||
var initialBoundry = 0; | ||
var currentPosition = - this.state.selectedItem * 100; | ||
var currentPosition = - this.state.selectedItem * 100; | ||
var finalBoundry = - (this.props.children.length - 1) * 100; | ||
@@ -162,3 +162,3 @@ | ||
} | ||
// prevent user from swiping right out of boundaries | ||
@@ -170,3 +170,3 @@ if (currentPosition === finalBoundry && axisDelta < 0) { | ||
var position = currentPosition + (100 / (this.wrapperSize / axisDelta)) + '%'; | ||
[ | ||
@@ -197,3 +197,3 @@ 'WebkitTransform', | ||
position = position >= this.props.children.length - 1 ? this.props.children.length - 1 : position; | ||
this.selectItem({ | ||
@@ -212,3 +212,3 @@ // if it's not a slider, we don't need to set position here | ||
}, | ||
selectItem:function (state) { | ||
@@ -223,3 +223,3 @@ this.setState(state); | ||
var itemClass = klass.ITEM(true, index === this.state.selectedItem); | ||
return ( | ||
@@ -238,3 +238,3 @@ React.createElement("li", {ref: function(node) {return this["item" + index] = node;}.bind(this), key: "itemKey" + index, className: itemClass, | ||
} | ||
return ( | ||
@@ -255,3 +255,3 @@ React.createElement("ul", {className: "control-dots"}, | ||
return React.createElement("p", {className: "carousel-status"}, this.state.selectedItem + 1, " of ", this.props.children.length); | ||
}, | ||
}, | ||
@@ -268,3 +268,3 @@ renderThumbs:function () { | ||
); | ||
}, | ||
}, | ||
@@ -280,3 +280,3 @@ render:function () { | ||
// show left arrow? | ||
// show left arrow? | ||
var hasPrev = canShowArrows && this.state.selectedItem > 0; | ||
@@ -288,7 +288,7 @@ // show right arrow | ||
var currentPosition = - this.state.selectedItem * 100 + '%'; | ||
var currentPosition = - this.state.selectedItem * 100 + '%'; | ||
// if 3d is available, let's take advantage of the performance of transform | ||
var transformProp = CSSTranslate(currentPosition, this.props.axis); | ||
itemListStyles = { | ||
@@ -333,3 +333,3 @@ 'WebkitTransform': transformProp, | ||
React.createElement("div", {className: klass.CAROUSEL(true)}, | ||
React.createElement("button", {className: klass.ARROW_PREV(!hasPrev), onClick: this.decrement}), | ||
React.createElement("button", {type: "button", className: klass.ARROW_PREV(!hasPrev), onClick: this.decrement}), | ||
React.createElement("div", {className: klass.WRAPPER(true, this.props.axis), style: containerStyles, ref: function(node) {return this.itemsWrapper = node;}.bind(this)}, | ||
@@ -340,4 +340,4 @@ React.createElement(Swipe, React.__spread({tagName: "ul"}, swiperProps), | ||
), | ||
React.createElement("button", {className: klass.ARROW_NEXT(!hasNext), onClick: this.increment}), | ||
React.createElement("button", {type: "button", className: klass.ARROW_NEXT(!hasNext), onClick: this.increment}), | ||
this.renderControls(), | ||
@@ -347,7 +347,6 @@ this.renderStatus() | ||
this.renderThumbs() | ||
) | ||
) | ||
); | ||
} | ||
}); | ||
@@ -13,3 +13,3 @@ var React = require('react'); | ||
module.exports = React.createClass({displayName: "exports", | ||
propsTypes: { | ||
@@ -25,3 +25,3 @@ children: React.PropTypes.element.isRequired, | ||
} | ||
}, | ||
}, | ||
@@ -46,3 +46,3 @@ getInitialState:function () { | ||
componentWillMount:function() { | ||
// as the widths are calculated, we need to resize | ||
// as the widths are calculated, we need to resize | ||
// the carousel when the window is resized | ||
@@ -61,3 +61,3 @@ window.addEventListener("resize", this.updateStatics); | ||
componentDidMount:function (nextProps) { | ||
// when the component is rendered we need to calculate | ||
// when the component is rendered we need to calculate | ||
// the container size to adjust the responsive behaviour | ||
@@ -74,3 +74,3 @@ this.updateStatics(); | ||
this.itemSize = outerWidth(this.thumb0); | ||
this.visibleItems = Math.floor(this.wrapperSize / this.itemSize); | ||
this.visibleItems = Math.floor(this.wrapperSize / this.itemSize); | ||
this.lastPosition = total - this.visibleItems; | ||
@@ -89,3 +89,3 @@ this.showArrows = this.visibleItems < total; | ||
handler(index, item); | ||
} | ||
} | ||
}, | ||
@@ -109,5 +109,5 @@ | ||
var wrapperSize = list.clientWidth; | ||
var visibleItems = Math.floor(wrapperSize / this.itemSize); | ||
var visibleItems = Math.floor(wrapperSize / this.itemSize); | ||
var currentPosition = - this.state.firstItem * this.itemSize; | ||
var currentPosition = - this.state.firstItem * this.itemSize; | ||
var lastLeftBoundry = - this.visibleItems * this.itemSize; | ||
@@ -120,3 +120,3 @@ | ||
} | ||
// prevent user from swiping right out of boundaries | ||
@@ -155,3 +155,3 @@ if (currentPosition === lastLeftBoundry && deltaX < 0) { | ||
position = position >= this.lastPosition ? this.lastPosition : position; | ||
this.setState({ | ||
@@ -173,3 +173,3 @@ firstItem: position, | ||
firstItem = this.lastPosition; | ||
} | ||
} | ||
@@ -190,7 +190,7 @@ if (selectedItem < (this.state.firstItem + this.visibleItems)) { | ||
var itemClass = klass.ITEM(false, index === this.state.selectedItem && this.state.hasMount); | ||
var img = item; | ||
if (item.type !== "img") { | ||
img = item.props.children.filter(function(children) {return children.type === "img";})[0]; | ||
img = item.props.children.filter(function(children) {return children.type === "img";})[0]; | ||
} | ||
@@ -201,3 +201,3 @@ | ||
} | ||
return ( | ||
@@ -217,3 +217,3 @@ React.createElement("li", {key: index, ref: function(node) {return this["thumb" + index] = node;}.bind(this), className: itemClass, | ||
// show left arrow? | ||
// show left arrow? | ||
var hasPrev = this.showArrows && this.state.firstItem > 0; | ||
@@ -225,3 +225,3 @@ // show right arrow | ||
var currentPosition = - this.state.firstItem * this.itemSize + 'px'; | ||
var currentPosition = - this.state.firstItem * this.itemSize + 'px'; | ||
@@ -242,3 +242,3 @@ var transformProp = CSSTranslate(currentPosition, this.props.axis); | ||
React.createElement("div", {className: klass.WRAPPER(false), ref: function(node) {return this.itemsWrapper = node;}.bind(this)}, | ||
React.createElement("button", {className: klass.ARROW_PREV(!hasPrev), onClick: this.slideRight}), | ||
React.createElement("button", {type: "button", className: klass.ARROW_PREV(!hasPrev), onClick: this.slideRight}), | ||
React.createElement(Swipe, {tagName: "ul", | ||
@@ -256,9 +256,8 @@ selectedItem: this.state.selectedItem, | ||
), | ||
React.createElement("button", {className: klass.ARROW_NEXT(!hasNext), onClick: this.slideLeft}) | ||
React.createElement("button", {type: "button", className: klass.ARROW_NEXT(!hasNext), onClick: this.slideLeft}) | ||
) | ||
) | ||
) | ||
); | ||
} | ||
}); | ||
{ | ||
"name": "react-responsive-carousel", | ||
"version": "3.0.11", | ||
"version": "3.0.12", | ||
"description": "React Responsive Carousel", | ||
@@ -5,0 +5,0 @@ "author": { |
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
Sorry, the diff of this file is not supported yet
89073