react-joyride
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -1,5 +0,5 @@ | ||
var React = require('react'), | ||
scroll = require('scroll'), | ||
Beacon = require('./Beacon'), | ||
Tooltip = require('./Tooltip'); | ||
var React = require('react'), | ||
scroll = require('scroll'), | ||
Beacon = require('./Beacon'), | ||
Tooltip = require('./Tooltip'); | ||
@@ -388,3 +388,3 @@ var defaultState = { | ||
hasSteps = Boolean(props.steps[state.index + 1]); | ||
this._toggleTooltip(hasSteps, state.index + 1); | ||
this._toggleTooltip(hasSteps, state.index + 1, 'next'); | ||
} | ||
@@ -467,3 +467,4 @@ } | ||
&& Boolean(props.steps[newIndex]) | ||
, newIndex); | ||
, newIndex | ||
, type); | ||
} | ||
@@ -476,7 +477,8 @@ }, | ||
* @param {Number} [index] - The tour's new index | ||
* @param {string} [action] | ||
*/ | ||
_toggleTooltip: function(show, index) { | ||
_toggleTooltip: function(show, index, action) { | ||
index = (index !== undefined ? index : this.state.index); | ||
var props = this.props; | ||
var props = this.props; | ||
this.setState({ | ||
@@ -489,7 +491,9 @@ play: props.steps[index] ? this.state.play : false, | ||
}, function() { | ||
if (!show && typeof props.stepCallback === 'function' && props.steps[this.state.index - 1]) { | ||
props.stepCallback(props.steps[this.state.index - 1]); | ||
var lastIndex = action === 'back' ? index + 1 : index - 1; | ||
if (action && typeof props.stepCallback === 'function' && props.steps[lastIndex]) { | ||
props.stepCallback(props.steps[lastIndex]); | ||
} | ||
if (props.steps.length && !props.steps[this.state.index]) { | ||
if (props.steps.length && !props.steps[index]) { | ||
if (typeof props.completeCallback === 'function') { | ||
@@ -663,2 +667,3 @@ props.completeCallback(props.steps, this.state.skipped); | ||
standalone: Boolean(state.tooltip), | ||
type: props.type, | ||
xPos: state.xPos, | ||
@@ -665,0 +670,0 @@ yPos: state.yPos, |
@@ -16,2 +16,3 @@ var React = require('react'), | ||
step: React.PropTypes.object.isRequired, | ||
type: React.PropTypes.string.isRequired, | ||
xPos: React.PropTypes.oneOfType([ | ||
@@ -266,3 +267,3 @@ React.PropTypes.number, | ||
style: styles.buttons.primary, | ||
'data-type': 'next', | ||
'data-type': props.type === 'single' ? 'close' : 'next', | ||
onClick: props.onClick | ||
@@ -269,0 +270,0 @@ }, props.buttons.primary) |
{ | ||
"name": "react-joyride", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "Create walkthroughs and guided tours for your apps", | ||
@@ -5,0 +5,0 @@ "author": "Gil Barbara <gilbarbara@gmail.com>", |
63938
1218