react-shepherd 3.3.0 → 3.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Shepherd.es.js +2454 -2302
- package/dist/Shepherd.es.js.map +1 -1
- package/dist/Shepherd.js +2455 -2302
- package/dist/Shepherd.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/package.json +38 -34
- package/README.md +0 -137
package/dist/index.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import React, { FunctionComponent } from 'react';
|
|
|
2
2
|
import Shepherd from 'shepherd.js';
|
|
3
3
|
import Step from 'shepherd.js/src/types/step';
|
|
4
4
|
import Tour from 'shepherd.js/src/types/tour';
|
|
5
|
-
interface ShepherdButtonWithType extends Step.StepOptionsButton {
|
|
5
|
+
export interface ShepherdButtonWithType extends Step.StepOptionsButton {
|
|
6
6
|
type?: string;
|
|
7
7
|
}
|
|
8
|
-
interface ShepherdOptionsWithType extends Step.StepOptions {
|
|
8
|
+
export interface ShepherdOptionsWithType extends Step.StepOptions {
|
|
9
9
|
buttons?: ReadonlyArray<Step.StepOptionsButton | ShepherdButtonWithType>;
|
|
10
10
|
}
|
|
11
11
|
interface ShepherdProps {
|
|
@@ -15,4 +15,6 @@ interface ShepherdProps {
|
|
|
15
15
|
declare const ShepherdTourContext: React.Context<Shepherd.Tour | null>;
|
|
16
16
|
declare const ShepherdTourContextConsumer: React.Consumer<Shepherd.Tour | null>;
|
|
17
17
|
export declare const ShepherdTour: FunctionComponent<ShepherdProps>;
|
|
18
|
+
export type { default as Step } from 'shepherd.js/src/types/step';
|
|
19
|
+
export type { default as Tour } from 'shepherd.js/src/types/tour';
|
|
18
20
|
export { ShepherdTourContextConsumer as TourMethods, ShepherdTourContext };
|
package/package.json
CHANGED
|
@@ -1,35 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-shepherd",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.4",
|
|
4
4
|
"description": "A React wrapper for the site tour library Shepherd",
|
|
5
|
+
"homepage": "https://shipshapecode.github.io/react-shepherd/",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/shipshapecode/react-shepherd.git"
|
|
9
|
+
},
|
|
5
10
|
"license": "MIT",
|
|
6
|
-
"repository": "shipshapecode/react-shepherd",
|
|
7
11
|
"main": "dist/Shepherd.js",
|
|
8
12
|
"module": "dist/Shepherd.es.js",
|
|
9
13
|
"jsnext:main": "dist/Shepherd.es.js",
|
|
10
14
|
"types": "dist/index.d.ts",
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"npm": ">=5"
|
|
15
|
-
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
16
18
|
"scripts": {
|
|
17
|
-
"prepare": "install-peers",
|
|
18
|
-
"test": "cross-env CI=1 react-scripts test",
|
|
19
|
-
"test:watch": "react-scripts test",
|
|
20
19
|
"prebuild": "tsc --project ./tsconfig-declarations.json",
|
|
21
20
|
"build": "rollup -c",
|
|
21
|
+
"predeploy": "cd example && yarn && yarn build",
|
|
22
|
+
"deploy": "gh-pages -d example/build",
|
|
23
|
+
"prepare": "install-peers",
|
|
22
24
|
"problems": "tsc --noEmit",
|
|
25
|
+
"release": "release-it",
|
|
23
26
|
"start": "rollup -c -w",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
27
|
+
"test": "cross-env CI=1 react-scripts test",
|
|
28
|
+
"test:watch": "react-scripts test"
|
|
26
29
|
},
|
|
27
30
|
"dependencies": {
|
|
28
|
-
"shepherd.js": "^8.0.
|
|
29
|
-
},
|
|
30
|
-
"peerDependencies": {
|
|
31
|
-
"react": "^16.8.0",
|
|
32
|
-
"react-dom": "^16.8.0"
|
|
31
|
+
"shepherd.js": "^8.0.2"
|
|
33
32
|
},
|
|
34
33
|
"devDependencies": {
|
|
35
34
|
"@babel/core": "^7.5.4",
|
|
@@ -52,13 +51,12 @@
|
|
|
52
51
|
"@babel/plugin-syntax-import-meta": "^7.2.0",
|
|
53
52
|
"@babel/preset-env": "^7.5.4",
|
|
54
53
|
"@babel/preset-react": "^7.0.0",
|
|
55
|
-
"@sheerun/mutationobserver-shim": "^0.3.3",
|
|
56
54
|
"@svgr/rollup": "^5.1.0",
|
|
57
|
-
"@testing-library/react": "^
|
|
58
|
-
"@types/jest": "^
|
|
59
|
-
"@types/node": "^
|
|
60
|
-
"@types/react": "^
|
|
61
|
-
"@types/react-dom": "^
|
|
55
|
+
"@testing-library/react": "^10.0.0",
|
|
56
|
+
"@types/jest": "^26.0.10",
|
|
57
|
+
"@types/node": "^14.6.4",
|
|
58
|
+
"@types/react": "^17.0.0",
|
|
59
|
+
"@types/react-dom": "^17.0.0",
|
|
62
60
|
"cross-env": "^7.0.0",
|
|
63
61
|
"eslint": "6.8.0",
|
|
64
62
|
"eslint-config-standard": "^14.0.0",
|
|
@@ -67,11 +65,13 @@
|
|
|
67
65
|
"eslint-plugin-node": "^11.0.0",
|
|
68
66
|
"eslint-plugin-promise": "^4.2.1",
|
|
69
67
|
"eslint-plugin-react": "^7.14.2",
|
|
70
|
-
"eslint-plugin-standard": "^
|
|
68
|
+
"eslint-plugin-standard": "^5.0.0",
|
|
71
69
|
"gh-pages": "^2.0.1",
|
|
72
70
|
"install-peers-cli": "^2.2.0",
|
|
73
|
-
"react-scripts": "^3.4.
|
|
74
|
-
"react-syntax-highlighter": "^
|
|
71
|
+
"react-scripts": "^3.4.3",
|
|
72
|
+
"react-syntax-highlighter": "^15.3.0",
|
|
73
|
+
"release-it": "^14.0.2",
|
|
74
|
+
"release-it-lerna-changelog": "^3.1.0",
|
|
75
75
|
"rollup": "^2.6.1",
|
|
76
76
|
"rollup-plugin-babel": "^4.3.3",
|
|
77
77
|
"rollup-plugin-commonjs": "^10.0.1",
|
|
@@ -80,14 +80,18 @@
|
|
|
80
80
|
"rollup-plugin-postcss": "^3.1.1",
|
|
81
81
|
"rollup-plugin-typescript": "^1.0.1",
|
|
82
82
|
"rollup-plugin-url": "^3.0.0",
|
|
83
|
-
"tslib": "^
|
|
84
|
-
"typescript": "^
|
|
83
|
+
"tslib": "^2.0.1",
|
|
84
|
+
"typescript": "^4.0.2"
|
|
85
85
|
},
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"
|
|
86
|
+
"peerDependencies": {
|
|
87
|
+
"react": "^17.0.2",
|
|
88
|
+
"react-dom": "^17.0.2"
|
|
89
|
+
},
|
|
90
|
+
"engines": {
|
|
91
|
+
"node": ">=8",
|
|
92
|
+
"npm": ">=5"
|
|
93
|
+
},
|
|
94
|
+
"publishConfig": {
|
|
95
|
+
"registry": "https://registry.npmjs.org"
|
|
92
96
|
}
|
|
93
97
|
}
|
package/README.md
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
# react-shepherd
|
|
2
|
-
|
|
3
|
-
<div>
|
|
4
|
-
<a href="https://shipshape.io">
|
|
5
|
-
<img align="left" src="http://i.imgur.com/DWHQjA5.png" alt="Ship Shape" width="50" height="50"/>
|
|
6
|
-
</a>
|
|
7
|
-
|
|
8
|
-
**[react-shepherd is built and maintained by Ship Shape. Contact us for web app consulting, development, and training for your project](https://shipshape.io/)**.
|
|
9
|
-
|
|
10
|
-
</div>
|
|
11
|
-
|
|
12
|
-
[](https://www.npmjs.com/package/react-shepherd)
|
|
13
|
-
[](https://travis-ci.org/shipshapecode/react-shepherd)
|
|
14
|
-
[](https://codeclimate.com/github/shipshapecode/react-shepherd/maintainability)
|
|
15
|
-
[](https://codeclimate.com/github/shipshapecode/react-shepherd/test_coverage)
|
|
16
|
-
[](https://greenkeeper.io/)
|
|
17
|
-
[](https://standardjs.com)
|
|
18
|
-
|
|
19
|
-
This is a React wrapper for the [Shepherd](https://github.com/shipshapecode/shepherd), site tour, library.
|
|
20
|
-
It's mainly a wrapper around the Shepherd library that exposes the tour object and methods to the context object
|
|
21
|
-
that can be passed into props for dynamic interactivity.
|
|
22
|
-
|
|
23
|
-
## Install
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
npm install --save react-shepherd
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## Usage
|
|
30
|
-
|
|
31
|
-
```jsx
|
|
32
|
-
import React, { Component } from 'react'
|
|
33
|
-
import {ShepherdTour, ShepherdTourContext} from 'react-shepherd'
|
|
34
|
-
import newSteps from './steps'
|
|
35
|
-
|
|
36
|
-
const tourOptions = {
|
|
37
|
-
defaultStepOptions: {
|
|
38
|
-
cancelIcon: {
|
|
39
|
-
enabled: true
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
useModalOverlay: true
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
function Button() {
|
|
46
|
-
const tour = useContext(ShepherdTourContext);
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<button className="button dark" onClick={tour.start}>
|
|
50
|
-
Start Tour
|
|
51
|
-
</button>
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
class App extends Component {
|
|
56
|
-
render() {
|
|
57
|
-
return (
|
|
58
|
-
<div>
|
|
59
|
-
<ShepherdTour steps={newSteps} tourOptions={tourOptions}>
|
|
60
|
-
<Button />
|
|
61
|
-
</ShepherdTour>
|
|
62
|
-
</div>
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
## Configuration
|
|
68
|
-
|
|
69
|
-
The following configuration options for a tour can be set on the ShepherdTour to control the way that Shepherd is used. This is simply a POJO passed to Shepherd to use the options noted in the Shepherd Tour [options](https://shepherdjs.dev/docs/Tour.html).
|
|
70
|
-
**The only required option is `steps`, which is an array passed to the props.**
|
|
71
|
-
|
|
72
|
-
### tourOptions
|
|
73
|
-
|
|
74
|
-
`PropTypes.object`
|
|
75
|
-
Used to set the options that will be applied to each step by default. You can pass in any of the options that you can with Shepherd.
|
|
76
|
-
|
|
77
|
-
### steps
|
|
78
|
-
|
|
79
|
-
`PropTypes.array`
|
|
80
|
-
You must pass an array of steps to `steps`, something like this:
|
|
81
|
-
|
|
82
|
-
```js
|
|
83
|
-
const steps = [
|
|
84
|
-
{
|
|
85
|
-
id: 'intro',
|
|
86
|
-
attachTo: '.first-element bottom',
|
|
87
|
-
beforeShowPromise: function() {
|
|
88
|
-
return new Promise(function(resolve) {
|
|
89
|
-
setTimeout(function() {
|
|
90
|
-
window.scrollTo(0, 0);
|
|
91
|
-
resolve();
|
|
92
|
-
}, 500);
|
|
93
|
-
});
|
|
94
|
-
},
|
|
95
|
-
buttons: [
|
|
96
|
-
{
|
|
97
|
-
classes: 'shepherd-button-secondary',
|
|
98
|
-
text: 'Exit',
|
|
99
|
-
type: 'cancel'
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
classes: 'shepherd-button-primary',
|
|
103
|
-
text: 'Back',
|
|
104
|
-
type: 'back'
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
classes: 'shepherd-button-primary',
|
|
108
|
-
text: 'Next',
|
|
109
|
-
type: 'next'
|
|
110
|
-
}
|
|
111
|
-
],
|
|
112
|
-
classes: 'custom-class-name-1 custom-class-name-2',
|
|
113
|
-
highlightClass: 'highlight',
|
|
114
|
-
scrollTo: false,
|
|
115
|
-
showCancelLink: true,
|
|
116
|
-
title: 'Welcome to React-Shepherd!',
|
|
117
|
-
text: ['React-Shepherd is a JavaScript library for guiding users through your React app.'],
|
|
118
|
-
when: {
|
|
119
|
-
show: () => {
|
|
120
|
-
console.log('show step');
|
|
121
|
-
},
|
|
122
|
-
hide: () => {
|
|
123
|
-
console.log('hide step');
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
...
|
|
128
|
-
]);
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
## Steps
|
|
132
|
-
|
|
133
|
-
The options are the same as Shepherd [options](https://shepherdjs.dev/docs/Step.html).
|
|
134
|
-
|
|
135
|
-
## License
|
|
136
|
-
|
|
137
|
-
MIT
|