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-focus-component

v1.2.2

Published

A react component that brings other components into visual focus/highlight by placing an overlay over all other elements on the page

Downloads

31

Readme

react-focus-component

Build Status

A react component that brings other components into visual focus/highlight by placing an overlay over all other elements on the page. Requires React 16 or higher

Example: https://react-focus-component.now.sh/

Usage


import { FocusOverlay } from 'react-focus-component';

class BasicExample extends React.Component {
    constructor(props) {
        super(props);
        this.component = React.createRef();
    }

    render() {
        return (
            <div>
                <div ref={this.component}>
                    This element will be highlighted because the "ref" is passed to the FocusOverlay as the focusComponent prop.
                </div>

                <FocusOverlay focusComponent={this.component.current} onExit={() => alert('runs when the user clicks in the overlay')} />
            </div>
        );
    }
}

API

  • focusComponent - A DOM element instance or an array of DOM elements to calculate the outer boundries of the focus point. This can also be a custom set of coordinates ({ height, width, x, y }), but note that these coordinates are reletive to the scroll position and will not automatically update on page scroll. This should be managed outside of the component.
  • onExit - called when the user clicks on the overlay.
  • target - Determines where the children (if any) will be rendered. Possible values: topleft, top, topright, left, right, bottomleft, bottom (DEFAULT), bottomright.

Development

  • Dependencies: Node 8 or greater.
  • Running examples: npm start.
  • Testing: npm test or npm run unittest or npm run test-watch. Write tests in __tests__ folder.
  • Linting: npm test or npm run lint. Fix: npm run lint-fix.
  • Build & publish: npm publish to build transpiled output to dist folder and publish it to the NPM registry. Requires environment variable NPM_TOKEN.
  • Deploy: npm run deploy deploys to ZEIT Now. Requires environment variable NOW_TOKEN.

License

MIT