From 72fc98aa6af06ee98907029e45a9016e1f04a026 Mon Sep 17 00:00:00 2001 From: Leandro Lemos Date: Sun, 17 May 2015 16:52:35 +1000 Subject: [PATCH] Generating version 0.1.1 for NPN --- lib/README.md | 1 + lib/__tests__/Carousel.js | 2 +- lib/__tests__/ImageGallery.js | 6 +----- lib/components/Carousel.js | 15 +++------------ lib/cssClasses.js | 17 ++++++++--------- lib/package.json | 5 ++--- 6 files changed, 16 insertions(+), 30 deletions(-) diff --git a/lib/README.md b/lib/README.md index cea0f8ea..6b2939a5 100644 --- a/lib/README.md +++ b/lib/README.md @@ -1,5 +1,6 @@ # React Responsive Carousel (WIP) +* Note: This version `0.1.1` was updated for use with React `0.13.3`. For React < `0.13.0` try the version `0.1.0`; ## Demo diff --git a/lib/__tests__/Carousel.js b/lib/__tests__/Carousel.js index 7f39acc5..b07016d3 100644 --- a/lib/__tests__/Carousel.js +++ b/lib/__tests__/Carousel.js @@ -31,7 +31,7 @@ describe("Carousel", function() { afterEach(function() { if (componentInstance && componentInstance.isMounted()) { // Only components with a parent will be unmounted - React.unmountComponentAtNode(componentInstance.getDOMNode().parent); + React.unmountComponentAtNode(componentInstance.getDOMNode()); } }); diff --git a/lib/__tests__/ImageGallery.js b/lib/__tests__/ImageGallery.js index b0eae4b2..2283e5d3 100644 --- a/lib/__tests__/ImageGallery.js +++ b/lib/__tests__/ImageGallery.js @@ -29,14 +29,10 @@ describe("ImageGallery", function() { afterEach(function() { if (componentInstance && componentInstance.isMounted()) { // Only components with a parent will be unmounted - React.unmountComponentAtNode(componentInstance.getDOMNode().parent); + React.unmountComponentAtNode(componentInstance.getDOMNode()); } }); - it("should be an instance of component", function(){ - expect(TestUtils.isCompositeComponent(componentInstance)).toBe(true); - }); - it("Should have a state currentImage", function () { expect(componentInstance.state.currentImage).toBeDefined(); }); diff --git a/lib/components/Carousel.js b/lib/components/Carousel.js index cb8227eb..005bff51 100644 --- a/lib/components/Carousel.js +++ b/lib/components/Carousel.js @@ -214,20 +214,11 @@ module.exports = React.createClass({displayName: "exports", getTotalWidth:function () { - if (this.isMounted()) { - return this.lastElementPosition + outerWidth(this.lastElement.getDOMNode()); - } else { - return 'auto'; - } + return this.itemSize * this.props.items.length || 'auto'; }, getNextPosition:function () { - if (this.isMounted()) { - var nextPosition = this.refs['item' + this.state.firstItem].getDOMNode().offsetLeft; - return - nextPosition; - } else { - return 0; - } + return - this.itemSize * this.state.firstItem || 0; }, changeItem:function (e) { @@ -274,7 +265,7 @@ module.exports = React.createClass({displayName: "exports", if (!this.props.showStatus) { return null } - return React.createElement("p", {className: "carousel-status"}, this.state.selectedItem, " of ", this.props.items.length); + return React.createElement("p", {className: "carousel-status"}, this.state.selectedItem + 1, " of ", this.props.items.length); }, render:function () { diff --git a/lib/cssClasses.js b/lib/cssClasses.js index 008bc874..0572c85a 100644 --- a/lib/cssClasses.js +++ b/lib/cssClasses.js @@ -1,23 +1,22 @@ -var React = require('react/addons'); -var classSet = React.addons.classSet; +var classNames = require('classnames'); module.exports = { CAROUSEL:function (isSlider) { - return classSet({ + return classNames({ "carousel": true, "carousel-slider": isSlider }); }, WRAPPER:function (isSlider) { - return classSet({ + return classNames({ "thumbs-wrapper": !isSlider, "slider-wrapper": isSlider }); }, SLIDER:function (isSlider, isSwiping){ - return classSet({ + return classNames({ "thumbs": !isSlider, "slider": isSlider, "swiping": isSwiping @@ -25,7 +24,7 @@ module.exports = { }, ITEM:function (isSlider, index, selectedItem) { - return classSet({ + return classNames({ "thumb": !isSlider, "slide": isSlider, "selected": index === selectedItem @@ -33,21 +32,21 @@ module.exports = { }, ARROW_LEFT:function (disabled) { - return classSet({ + return classNames({ "control-arrow control-left": true, "control-disabled": disabled }); }, ARROW_RIGHT:function (disabled) { - return classSet({ + return classNames({ "control-arrow control-right": true, "control-disabled": disabled }) }, DOT:function (selected) { - return classSet({ + return classNames({ "dot": true, 'selected': selected }) diff --git a/lib/package.json b/lib/package.json index ce9641fd..88fb972d 100644 --- a/lib/package.json +++ b/lib/package.json @@ -1,6 +1,6 @@ { "name": "react-responsive-carousel", - "version": "0.1.0", + "version": "0.1.1", "description": "React Responsive Carousel", "author": { "name": "Leandro Augusto Lemos", @@ -29,7 +29,6 @@ }, "homepage": "http://leandrowd.github.io/react-responsive-carousel/", "dependencies": { - "react": "~0.12.2", - "react-addons": "^0.9.0" + "react": "^0.13.3" } }