shepherd.js
Advanced tools
Comparing version 2.0.0-beta.29 to 2.0.0-beta.30
@@ -160,3 +160,3 @@ ## Shepherd | ||
- Function to be executed when the step is built. It must return one the three options above. | ||
- `title`: The steps title. It becomes an `h3` at the top of the step. | ||
- `title`: The step's title. It becomes an `h3` at the top of the step. | ||
- `attachTo`: What element the step should be attached to on the page. It can either be a string of the form `"element on"`, or an object with those properties. For example: `".some #element left"`, or `{element: '.some #element', | ||
@@ -177,4 +177,3 @@ on: 'left'}`. If you use the object syntax, `element` can also be a DOM element. If you don't specify an `attachTo` | ||
- `classes`: Extra classes to add to the step. `shepherd-theme-arrows` will give you our theme. | ||
- `buttons`: An array of buttons to add to the step. By default we add a Next button which triggers `next()`, set this to false | ||
to disable. Each button in the array is an object of the format: | ||
- `buttons`: An array of buttons to add to the step. These will be rendered in a footer below the main body text. Each button in the array is an object of the format: | ||
- `text`: The HTML text of the button | ||
@@ -181,0 +180,0 @@ - `classes`: Extra classes to apply to the `<a>` |
{ | ||
"name": "shepherd.js", | ||
"version": "2.0.0-beta.29", | ||
"version": "2.0.0-beta.30", | ||
"repository": { | ||
@@ -44,2 +44,3 @@ "type": "git", | ||
"test:unit:watch": "webpack-dev-server --config webpack.test.config.js", | ||
"view-coverage": "http-server -p 9003 ./coverage/lcov-report -o", | ||
"watch": "yarn clean && webpack --watch --mode development" | ||
@@ -46,0 +47,0 @@ }, |
@@ -6,3 +6,2 @@ import { | ||
isFunction, | ||
isPlainObject, | ||
isString, | ||
@@ -52,4 +51,4 @@ isUndefined | ||
* When the promise resolves, the rest of the `show` code for the step will execute. | ||
* @param {Object[]} options.buttons An array of buttons to add to the step. By default | ||
* we add a Next button which triggers `next()`, set this to `false` to disable. | ||
* @param {Object[]} options.buttons An array of buttons to add to the step. These will be rendered in a | ||
* footer below the main body text. | ||
* @param {function} options.buttons.button.action A function executed when the button is clicked on | ||
@@ -125,3 +124,3 @@ * @param {string} options.buttons.button.classes Extra classes to apply to the `<a>` | ||
_addButtons(content) { | ||
if (this.options.buttons) { | ||
if (!isEmpty(this.options.buttons)) { | ||
const footer = document.createElement('footer'); | ||
@@ -345,4 +344,2 @@ const buttons = createFromHTML('<ul class="shepherd-buttons"></ul>'); | ||
}); | ||
this._setupButtons(); | ||
} | ||
@@ -365,27 +362,2 @@ | ||
/** | ||
* Determines button options prior to rendering | ||
* | ||
* @private | ||
*/ | ||
_setupButtons() { | ||
const { buttons } = this.options; | ||
if (buttons) { | ||
const buttonsAreDefault = isUndefined(buttons) || isEmpty(buttons); | ||
if (buttonsAreDefault) { | ||
this.options.buttons = [{ | ||
text: 'Next', | ||
action: this.tour.next, | ||
classes: 'btn' | ||
}]; | ||
} else { | ||
const buttonsAreObject = isPlainObject(buttons); | ||
// Can pass in an object which will assume a single button | ||
if (buttonsAreObject) { | ||
this.options.buttons = [this.options.buttons]; | ||
} | ||
} | ||
} | ||
} | ||
/** | ||
* Triggers `before-show`, generates the tooltip DOM content, | ||
@@ -392,0 +364,0 @@ * sets up a tippy instance for the tooltip, then triggers `show`. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
663507
5219