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

react-popover-wrapper

v2.2.0

Published

This is a simple wrapper that makes react-popover a little easier to use.

Downloads

17

Readme

React Popover Wrapper

This is a simple wrapper that makes react-popover a little easier to use.

Install

npm install react-popover-wrapper --save

This package is not yet compiled with babel so you will need to do that. If you are using webpack, set up your loaders to include this file (often webpack loaders will ignore npm).

  rules: [
      {
          test: /\.js$/,
          use: ['babel-loader'],
          exclude: /node_modules/
      },{
          test: /\.js$/,
          use: ['babel-loader'],
          include: [
              path.resolve(__dirname, 'node_modules/react-popover-wrapper'),
          ],
      },

Example

import Popover from 'react-popover-wrapper';

// Then add it to your react components JSX:

<Popover trigger="hover" preferPlace="above">
  <div>Trigger element</div>
  <div className="popover">
    <a>You can put your content here</a>
    <a>The second element will be treated as the popover content</a>
  </div>
</Popover>

Some basic CSS should be added. Something like this is a good place to start:

.Popover-body {
  display: inline-flex;
  flex-direction: column;
  background: white;
  z-index: 1;
  margin-top: -1px;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.Popover-tipShape {
  fill: white;
  stroke-width: 1;
  stroke: rgba(0, 0, 0, 0.15);
}

.Popover {
  z-index: 100;
  transform: translateY(0px) !important;
}

Usage

This component makes changing the trigger action very simple. There are several different attributes which can be used with this component:


The prefered location of the popover

Default: 'above'

preferPlace: PropTypes.oneOf(['above', 'below', 'left', 'right'])


Is the popover open? Often used with trigger === 'none' to control state externally

Default: undefined

open: PropTypes.bool


The type of event to trigger the popver

Default: 'click'

trigger: PropTypes.oneOf(['click', 'hover', 'hoverDelay', 'hoverSingleDelay', 'none'])


Toggle delay period. To be used with 'hoverDelay' or 'hoverSingleDelay'.

Default: 200

toggleDelayTime: PropTypes.number


This will stop the popup closing when the overlay is clicked.

Default: false

disableClickClose: PropTypes.bool


Size of the arrow.

Default: 6

tipSize: PropTypes.number


Should the popup content inherit the 'isOpen' prop?

Default: false

inheritIsOpen: PropTypes.bool


Two children should be passed in - children[0] is the trigger, children[1] is the popup content

children: PropTypes.node.isRequired