react-shepherd 4.2.0 → 5.0.0-alpha.0
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/README.md +75 -0
- package/dist/index.d.ts +24 -22
- package/dist/index.js +4132 -0
- package/dist/index.umd.cjs +27 -0
- package/package.json +39 -84
- package/src/index.tsx +50 -0
- package/dist/Shepherd.es.js +0 -4450
- package/dist/Shepherd.es.js.map +0 -1
- package/dist/Shepherd.js +0 -4460
- package/dist/Shepherd.js.map +0 -1
- package/dist/__tests__/shepherd.test.d.ts +0 -1
- package/dist/index.d.ts.map +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# react
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@shepherdpro/react)
|
|
4
|
+
|
|
5
|
+
This is a React wrapper for the [Shepherd](https://github.com/@shepherdpro/react) tour library.
|
|
6
|
+
It's mainly a wrapper around the Shepherd library that exposes the tour object and methods to the context object
|
|
7
|
+
that can be passed into props for dynamic interactivity.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
Use this simple NPM command or whatever package manager is your favorite.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install --save @shepherdpro/react
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
### Via Provider/Context
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { Component, useContext } from 'react';
|
|
23
|
+
import { ShepherdJourneyProvider, useShepherd } from '@shepherdpro/react';
|
|
24
|
+
import newSteps from './steps';
|
|
25
|
+
|
|
26
|
+
const tourOptions = {
|
|
27
|
+
defaultStepOptions: {
|
|
28
|
+
cancelIcon: {
|
|
29
|
+
enabled: true
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
useModalOverlay: true
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
function Button() {
|
|
36
|
+
const shepherd = useShepherd(ShepherdTourContext);
|
|
37
|
+
const tour = shepherd.Tour({
|
|
38
|
+
...tourOptions,
|
|
39
|
+
steps: newSteps
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<button className="button dark" onClick={tour.start}>
|
|
44
|
+
Start Tour
|
|
45
|
+
</button>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export default function App() {
|
|
50
|
+
return (
|
|
51
|
+
<div>
|
|
52
|
+
<ShepherdJourneyProvider>
|
|
53
|
+
<Button />
|
|
54
|
+
</ShepherdJourneyProvider>
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Configuration
|
|
61
|
+
|
|
62
|
+
The following configuration options for a tour can be set on the `useShepherd` hook 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). You can also pass an API Key to use [Shepherd Pro](https://shepherdpro.com) features for analytics related events tracking.
|
|
63
|
+
|
|
64
|
+
### apiKey
|
|
65
|
+
|
|
66
|
+
`PropTypes.string`
|
|
67
|
+
Used to connect your tours to a Pro instance to get additional user information and feedback.
|
|
68
|
+
|
|
69
|
+
## Steps
|
|
70
|
+
|
|
71
|
+
The options are the same as Shepherd [options](https://shepherdjs.dev/docs/Step.html).
|
|
72
|
+
|
|
73
|
+
## License
|
|
74
|
+
|
|
75
|
+
MIT
|
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
declare
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export
|
|
1
|
+
import { Consumer } from 'react';
|
|
2
|
+
import { Context } from 'react';
|
|
3
|
+
import { FC } from 'react';
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
|
+
import { ShepherdPro } from 'shepherd.js/tour';
|
|
6
|
+
|
|
7
|
+
export declare const JourneyMethods: Consumer<ShepherdContextType | undefined>;
|
|
8
|
+
|
|
9
|
+
declare interface ShepherdContextType {
|
|
10
|
+
Shepherd: typeof ShepherdPro;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export declare const ShepherdJourneyContext: Context<ShepherdContextType | undefined>;
|
|
14
|
+
|
|
15
|
+
export declare const ShepherdJourneyProvider: FC<ShepherdProviderProps>;
|
|
16
|
+
|
|
17
|
+
declare interface ShepherdProviderProps {
|
|
18
|
+
apiKey?: string;
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export declare const useShepherd: () => ShepherdPro;
|
|
23
|
+
|
|
24
|
+
export { }
|