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

inferno-popper

v7.0.1

Published

Inferno wrapper around PopperJS.

Downloads

57

Readme

inferno-popper

gzip size

Inferno wrapper for PopperJS ported from inferno-popper.

Compatibility

inferno-popper 7.x supports Inferno v7

inferno-popper 6.x supports Inferno v6

inferno-popper 5.x supports Inferno v5

inferno-popper 4.x supports Inferno v4

inferno-popper 3.x supports Inferno v3 (code in InfernoV3 branch)

Install

$ npm install --save inferno-popper

Usage

NOTE: There is an example of a dynamic popper if you check the browser test.

import { Manager, Target, Popper, Arrow } from 'inferno-popper'

const PopperExample = () => (
  <Manager>
    <Target style={{ width: 120, height: 120, background: '#b4da55' }}>
      Target Box
    </Target>
    <Popper placement="left" className="popper">
      Left Content
      <Arrow className="popper__arrow"/>
    </Popper>
    <Popper placement="right" className="popper">
      Right Content
      <Arrow className="popper__arrow"/>
    </Popper>
  </Manager>
)

Usage w/ child function

This is a useful way to interact with custom components. Just make sure you pass down the refs properly.

import { Manager, Target, Popper, Arrow } from 'inferno-popper'

const PopperExample = () => (
  <Manager>
    <Target>
      {({ targetProps }) => (
        <div {...targetProps}>
          Target Box
        </div>
      )}
    </Target>
    <Popper placement="left">
      {({ popperProps, restProps }) => (
        <div
          className="popper"
          {...popperProps}
        >
          Popper Content
          <Arrow>
            {({ arrowProps, restProps }) => (
              <span
                className="popper__arrow"
                {...arrowProps}
              />
            )}
          </Arrow>
        </div>
      )}
    </Popper>
  </Manager>
)

Shared Props

Target, Popper, and Arrow all share the following props

component: PropTypes.oneOfType([PropTypes.node, PropTypes.func])

A valid DOM tag or custom component to render. If using a custom component, an innerRef prop will be passed down that must be attached to the child component ref.

innerRef: PropTypes.func

Use this prop to access the internal ref. Does not apply to the Manager component since we do not interact with its ref.

Manager

This is a special component that provides the Target component to the Popper component. Pass any props as you normally would here.

tag: PropTypes.oneOfType([PropTypes.string, PropTypes.bool])

A valid DOM tag to render. Allows rendering just children by passing false. Once React 16 is out, this prop will most likely go away since we will be able to return an array and all this currently does is subscribe Target and Popper.

Target

This is just a simple component that subscribes to PopperManager, so Popper can make use of it. Again, pass any props as you normally would here.

Each Target must be wrapped in a Manager, and each Manager can wrap only one Target.

children: PropTypes.oneOfType([PropTypes.node, PropTypes.func])

A Target's child may be one of the following:

  • a React element[s]

  • a function accepting the following object (all props must be passed down in order for the PopperJS to work properly)

    {
      targetProps: {
        ref // a function that accepts the target component as an argument
      },
      restProps // any other props that came through the Target component
    }

Popper

Your popper that gets attached to the Target component.

Each Popper must be wrapped in a Manager, and each Manager can wrap multiple Popper components.

placement: PropTypes.oneOf(Popper.placements)

eventsEnabled: PropTypes.bool

modifiers: PropTypes.object

Passes respective options to a new Popper instance. As for onCreate and onUpdate, these callbacks were intentionally left out in favor of using the component lifecycle methods. If you have a good use case for these please feel free to file and issue and I will consider adding them in.

children: PropTypes.oneOfType([PropTypes.node, PropTypes.func])

A Popper's child may be one of the following:

  • a React element[s]

  • a function accepting the following object (all props must be passed down in order for the PopperJS to work properly)

    {
      popperProps: {
        ref, // a function that accepts the popper component as an argument
        style, // the styles to apply to the popper element
        ['data-placement'] // the placement of the Popper
      },
      restProps // any other props that came through the Popper component
    }

Arrow

Another component that subscribes to the Popper component as an arrow modifier. Must be a child of Popper.

children: PropTypes.oneOfType([PropTypes.node, PropTypes.func])

An Arrow's child may be one of the following:

  • a React element[s]

  • a function accepting the following object (all props must be passed down in order for the PopperJS to work properly)

    {
      arrowProps: {
        ref, // a function that accepts the arrow component as an argument
        style // the styles to apply to the arrow element
      },
      restProps // any other props that came through the Arrow component
    }

Running Brower Test Locally

clone repo

git clone [email protected]:jhsware/inferno-popper.git

move into folder

cd ~/inferno-popper

install dependencies

npm install

run browser test

$ npm run build && npm run build-test && node test/browser/server.js

open your browser and visit: http://localhost:8080/