npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@rrrapha/reactour

v1.9.5

Published

Tourist Guide into your React Components

Downloads

14

Readme

This is a fork from: https://github.com/elrumordelaluz/reactour

Install

npm i --save reactour styled-components
yarn add reactour styled-components

From v1.8.6 styled-components it isn't bundled into the package.

Initialize

Add the Tour Component in your Application:

import Tour from 'reactour'

class App extends Component {
  // ...

  render  (
    <div>
      { /* other stuff */}
      <Tour
        steps={steps}
        isOpen={this.state.isTourOpen}
        onRequestClose={this.closeTour} />
    </div>
  )
}

const steps = [
  {
    selector: '.first-step',
    content: 'This is my first Step',
  },
  // ...
]

PropTypes

| Prop | Desc | Type | Default | Is Required | | --------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------- | ---------------------------------------------------- | ----------- | | accentColor | Change --reactour-accent color (helper number + dots) | string | #007aff | | | badgeContent | Function to customize Badge content (current, total) => {} | func | | | | children | Elements to appear after the Mask (need to be styled correctly to have a position and z-index higher than Mask) | node|elem | false | | | className | Custom class to add to the helper | string | | | | closeWithMask | Close clicking the mask | bool | true | | | disableDotsNavigation | Isn't possible to interact with helper dots | bool | | | | disableInteraction | Isn't possible to interact with highlighted elements | bool | | | | disableKeyboardNavigation | Isn't possible to interact with keyboard arrows | bool | | | | getCurrentStep | Function triggered each time current step change | func | step => { /* 'step' is the current step index */ } | | | goToStep | Programmatically change current step | number | | | | highlightedMaskClassName | Custom class name for element which is overlaid target element | string | | | | inViewThreshold | Scroll element to show when is outiside viewport adding this threshold value | number | | | | isOpen | You know… | bool | | ✅ | | lastStepNextButton | Change Next button in last step into a custom button to close the Tour | node | | | | maskClassName | Custom class to add to the mask | string | | | | maskSpace | Padding between elemente showed and mask | number | 10 | | | nextButton | Next navigation button text | node | | | | nextStep | Override default nextStep function to use a custom one | func | | | | onAfterOpen | Function triggered after open | func | () => { document.body.style.overflowY = 'hidden' } | | | onBeforeClose | Function triggered before close | func | () => { document.body.style.overflowY = 'auto' } | | | onRequestClose | Function triggered to close | func | | | | prevButton | Prev navigation button text | node | | | | prevStep | Override default prevStep function to use a custom one | func | | | | rounded | Beautify helper + mask with border-radius (in px) | number | 0 | | | scrollDuration | Smooth scroll duration when positioning the target element | number | 1 | | | scrollOffset | Offset when positioning the target element | number | calculates the vertical center of the page | | | showButtons | Show helper navigation buttons | bool | true | | | showCloseButton | Show close button | bool | true | | | showNavigation | Show helper navigation dots | bool | true | | | showNavigationNumber | Show number when hovers on each navigation dots | bool | true | | | showNumber | Show helper number badge | bool | true | | | showTooltipArrow | Show tooltip arrows pointing to target element | bool | true | | | startAt | Starting step each time the Tour is open | number | | | | steps | Array of steps with info and props | [view bellow] | | ✅ | | update | Value to listen if a forced update is needed | string | | | | updateDelay | Delay time when forcing update. Useful when there are known animation/transitions | number | 1 | |

steps: PropTypes.arrayOf(PropTypes.shape({
  'follow': PropTypes.bool, // Should the guide follow the element when scrolling
  'selector': PropTypes.string,
  'content': PropTypes.oneOfType([
    PropTypes.node,
    PropTypes.element,
    PropTypes.func,
  ]).isRequired,
  'position': PropTypes.oneOf(['top', 'right', 'bottom', 'left', 'center']),
  'action': PropTypes.func,
  'style': PropTypes.object,
  'stepInteraction': PropTypes.bool,
  'maskClickHandler': PropTypes.func,
})),

Steps example

const steps = [
  {
    selector: '[data-tour="my-first-step"]',
    content: ({ goTo, inDOM }) => (
      <div>
        Lorem ipsum <button onClick={() => goTo(4)}>Go to Step 5</button>
        <br />
        {inDOM && '🎉 Look at your step!'}
      </div>
    ),
    position: 'top',
    action: node => {
      node.focus()
      console.log('yup, the target element is also focused!')
    },
    style: {
      backgroundColor: '#bada55',
    },
  },
  // ...
]