react-shepherd 4.0.1 → 4.2.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/dist/index.d.ts CHANGED
@@ -1,9 +1,10 @@
1
- import React, { FunctionComponent } from 'react';
1
+ import React, { FC } 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
+ declare type StepType = 'back' | 'cancel' | 'next';
5
6
  export interface ShepherdButtonWithType extends Step.StepOptionsButton {
6
- type?: string;
7
+ type?: StepType;
7
8
  }
8
9
  export interface ShepherdOptionsWithType extends Step.StepOptions {
9
10
  buttons?: ReadonlyArray<Step.StepOptionsButton | ShepherdButtonWithType>;
@@ -11,10 +12,11 @@ export interface ShepherdOptionsWithType extends Step.StepOptions {
11
12
  interface ShepherdProps {
12
13
  steps: Array<ShepherdOptionsWithType>;
13
14
  tourOptions: Tour.TourOptions;
15
+ children: React.ReactNode;
14
16
  }
15
17
  declare const ShepherdTourContext: React.Context<Shepherd.Tour | null>;
16
18
  declare const ShepherdTourContextConsumer: React.Consumer<Shepherd.Tour | null>;
17
- export declare const ShepherdTour: FunctionComponent<ShepherdProps>;
19
+ export declare const ShepherdTour: FC<ShepherdProps>;
18
20
  export type { default as Step } from 'shepherd.js/src/types/step';
19
21
  export type { default as Tour } from 'shepherd.js/src/types/tour';
20
22
  export { ShepherdTourContextConsumer as TourMethods, ShepherdTourContext };
@@ -0,0 +1 @@
1
+ {"mappings":";;;;AAKA,uCAAwC,SAAQ,IAAI,CAAC,iBAAiB;IACpE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wCAAyC,SAAQ,IAAI,CAAC,WAAW;IAC/D,OAAO,CAAC,EAAE,aAAa,CAAC,KAAK,iBAAiB,GAAG,sBAAsB,CAAC,CAAC;CAC1E;AAED;IACE,KAAK,EAAE,KAAK,CAAC,uBAAuB,CAAC,CAAC;IACtC,WAAW,EAAE,KAAK,WAAW,CAAC;CAC/B;AAED,OAAA,MAAM,wDAA4D,CAAC;AACnE,OAAA,MAAM,iDAA0D,CAAC;AAwCjE,OAAO,MAAM,cAAc,kBAAkB,aAAa,CAezD,CAAC;AAEF,YAAY,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClE,YAAY,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,4BAA4B,CAAC","sources":["packages/lib/src/src/index.tsx","packages/lib/src/index.tsx"],"sourcesContent":[null,"import React, { FunctionComponent, useMemo } from 'react';\nimport Shepherd from 'shepherd.js';\nimport Step from 'shepherd.js/src/types/step';\nimport Tour from 'shepherd.js/src/types/tour';\n\nexport interface ShepherdButtonWithType extends Step.StepOptionsButton {\n type?: string;\n}\n\nexport interface ShepherdOptionsWithType extends Step.StepOptions {\n buttons?: ReadonlyArray<Step.StepOptionsButton | ShepherdButtonWithType>;\n}\n\ninterface ShepherdProps {\n steps: Array<ShepherdOptionsWithType>;\n tourOptions: Tour.TourOptions;\n}\n\nconst ShepherdTourContext = React.createContext<Tour | null>(null);\nconst ShepherdTourContextConsumer = ShepherdTourContext.Consumer;\n\n/**\n * Take a set of steps and formats to use actions on the buttons in the current context\n * @param {Array} steps\n * @param {Array} tour\n * @private\n */\nconst addSteps = (steps: Array<Step.StepOptions>, tour: Tour) => {\n // Return nothing if there are no steps\n if (!steps.length) {\n return [];\n }\n\n const parsedStepsforAction = steps.map((step: Step.StepOptions): Step.StepOptions => {\n const { buttons } = step;\n\n if (buttons) {\n step.buttons = buttons.map((button: ShepherdButtonWithType) => {\n const { action, classes, disabled, label, secondary, text, type } = button;\n return {\n // TypeScript doesn't have great support for dynamic method calls with\n // bracket notation, so we use the `any` escape hatch\n action: (tour as any)[type!] || action,\n classes,\n disabled,\n label,\n secondary,\n text,\n type\n };\n });\n }\n\n return step;\n });\n\n parsedStepsforAction.forEach((step: any) => tour.addStep(step));\n};\n\nexport const ShepherdTour: FunctionComponent<ShepherdProps> = props => {\n const { tourOptions, steps } = props;\n const tourObject = useMemo(() => {\n const tourObject = new Shepherd.Tour(tourOptions);\n\n addSteps(steps, tourObject);\n\n return tourObject;\n }, [tourOptions, steps]);\n\n return (\n <ShepherdTourContext.Provider value={tourObject}>\n {props.children}\n </ShepherdTourContext.Provider>\n );\n};\n\nexport type { default as Step } from 'shepherd.js/src/types/step';\nexport type { default as Tour } from 'shepherd.js/src/types/tour';\nexport { ShepherdTourContextConsumer as TourMethods, ShepherdTourContext };\n"],"names":[],"version":3,"file":"index.d.ts.map","sourceRoot":"../../../"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-shepherd",
3
- "version": "4.0.1",
3
+ "version": "4.2.0",
4
4
  "description": "A React wrapper for the site tour library Shepherd",
5
5
  "homepage": "https://shipshapecode.github.io/react-shepherd/",
6
6
  "repository": {
@@ -19,16 +19,19 @@
19
19
  "prebuild": "tsc --project ./tsconfig-declarations.json",
20
20
  "build": "rollup -c",
21
21
  "predeploy": "cd example && yarn && yarn build",
22
- "deploy": "gh-pages -d example/build",
23
22
  "prepare": "install-peers",
24
23
  "problems": "tsc --noEmit",
25
24
  "release": "release-it",
26
25
  "start": "rollup -c -w",
27
- "test": "cross-env CI=1 react-scripts test",
28
- "test:watch": "react-scripts test"
26
+ "test": "cross-env CI=1 jest",
27
+ "test:watch": "jest --watch",
28
+ "lint": "eslint src --ext js,jsx,ts,tsx --max-warnings 0",
29
+ "lint:ci": "TIMING=all yarn lint --format junit --output-file reports/junit/junit.xml",
30
+ "lint:fix": "yarn lint --fix"
29
31
  },
30
32
  "dependencies": {
31
- "shepherd.js": "^10.0.0"
33
+ "resize-observer-polyfill": "^1.5.1",
34
+ "shepherd.js": "^11.0.1"
32
35
  },
33
36
  "devDependencies": {
34
37
  "@babel/core": "^7.5.4",
@@ -51,41 +54,42 @@
51
54
  "@babel/plugin-syntax-import-meta": "^7.2.0",
52
55
  "@babel/preset-env": "^7.5.4",
53
56
  "@babel/preset-react": "^7.0.0",
54
- "@svgr/rollup": "^5.1.0",
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",
57
+ "@svgr/rollup": "^6.2.1",
58
+ "@testing-library/react": "^13.3.0",
59
+ "@types/jest": "^29.0.0",
60
+ "@types/node": "^18.0.3",
61
+ "@types/react": "^18.0.15",
62
+ "@types/react-dom": "^18.0.6",
63
+ "@typescript-eslint/eslint-plugin": "^5.30.5",
64
+ "@typescript-eslint/parser": "^5.30.5",
60
65
  "cross-env": "^7.0.0",
61
- "eslint": "6.8.0",
62
- "eslint-config-standard": "^14.0.0",
63
- "eslint-config-standard-react": "^9.0.0",
64
- "eslint-plugin-import": "^2.18.0",
65
- "eslint-plugin-node": "^11.0.0",
66
- "eslint-plugin-promise": "^4.2.1",
67
- "eslint-plugin-react": "^7.14.2",
68
- "eslint-plugin-standard": "^5.0.0",
69
- "gh-pages": "^2.0.1",
66
+ "eslint": "^7.32.0 || ^8.2.0",
67
+ "eslint-config-airbnb": "^19.0.4",
68
+ "eslint-import-resolver-typescript": "^3.2.5",
69
+ "eslint-plugin-import": "^2.25.3",
70
+ "eslint-plugin-jsx-a11y": "^6.5.1",
71
+ "eslint-plugin-react": "^7.28.0",
72
+ "eslint-plugin-react-hooks": "^4.3.0",
70
73
  "install-peers-cli": "^2.2.0",
71
- "react-scripts": "^3.4.3",
72
- "react-syntax-highlighter": "^15.3.0",
74
+ "jest": "^28.1.2",
75
+ "jest-environment-jsdom": "^29.0.1",
73
76
  "release-it": "^14.0.2",
74
- "release-it-lerna-changelog": "^3.1.0",
77
+ "release-it-lerna-changelog": "^4.0.1",
75
78
  "rollup": "^2.6.1",
76
79
  "rollup-plugin-babel": "^4.3.3",
77
80
  "rollup-plugin-commonjs": "^10.0.1",
78
81
  "rollup-plugin-node-resolve": "^5.2.0",
79
82
  "rollup-plugin-peer-deps-external": "^2.2.0",
80
- "rollup-plugin-postcss": "^3.1.1",
83
+ "rollup-plugin-postcss": "^4.0.2",
81
84
  "rollup-plugin-typescript": "^1.0.1",
82
85
  "rollup-plugin-url": "^3.0.0",
86
+ "ts-jest": "^28.0.5",
83
87
  "tslib": "^2.0.1",
84
- "typescript": "^4.0.2"
88
+ "typescript": "^4.7.4"
85
89
  },
86
90
  "peerDependencies": {
87
- "react": "^17.0.2",
88
- "react-dom": "^17.0.2"
91
+ "react": "^17.0.2 || 18.x",
92
+ "react-dom": "^17.0.2 || 18.x"
89
93
  },
90
94
  "engines": {
91
95
  "node": ">=14",