react-shepherd 4.2.0 → 4.3.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
@@ -2,7 +2,7 @@ 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
+ type StepType = 'back' | 'cancel' | 'next';
6
6
  export interface ShepherdButtonWithType extends Step.StepOptionsButton {
7
7
  type?: StepType;
8
8
  }
@@ -16,6 +16,7 @@ interface ShepherdProps {
16
16
  }
17
17
  declare const ShepherdTourContext: React.Context<Shepherd.Tour | null>;
18
18
  declare const ShepherdTourContextConsumer: React.Consumer<Shepherd.Tour | null>;
19
+ export declare const useShepherdTour: ({ tourOptions, steps }: Pick<ShepherdProps, 'steps' | 'tourOptions'>) => Shepherd.Tour;
19
20
  export declare const ShepherdTour: FC<ShepherdProps>;
20
21
  export type { default as Step } from 'shepherd.js/src/types/step';
21
22
  export type { default as Tour } from 'shepherd.js/src/types/tour';
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "react-shepherd",
3
- "version": "4.2.0",
3
+ "version": "4.3.0",
4
4
  "description": "A React wrapper for the site tour library Shepherd",
5
- "homepage": "https://shipshapecode.github.io/react-shepherd/",
5
+ "homepage": "https://react-shepherd.vercel.app/",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/shipshapecode/react-shepherd.git"
@@ -54,8 +54,8 @@
54
54
  "@babel/plugin-syntax-import-meta": "^7.2.0",
55
55
  "@babel/preset-env": "^7.5.4",
56
56
  "@babel/preset-react": "^7.0.0",
57
- "@svgr/rollup": "^6.2.1",
58
- "@testing-library/react": "^13.3.0",
57
+ "@svgr/rollup": "^8.1.0",
58
+ "@testing-library/react": "^14.0.0",
59
59
  "@types/jest": "^29.0.0",
60
60
  "@types/node": "^18.0.3",
61
61
  "@types/react": "^18.0.15",
@@ -92,7 +92,7 @@
92
92
  "react-dom": "^17.0.2 || 18.x"
93
93
  },
94
94
  "engines": {
95
- "node": ">=14",
95
+ "node": ">=16",
96
96
  "npm": ">=7"
97
97
  },
98
98
  "publishConfig": {
@@ -1 +0,0 @@
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":"../../../"}