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-modal-construction-kit

v2.0.7

Published

A flexible Modal component kit for React

Downloads

23

Readme

NPM

React Modal Construction Kit

A highly extensible Modal library.

Demo

mikevercoelen.github.io/react-modal-construction-kit

Installation

npm install react-modal-construction-kit --save

Example

import React, { Component } from 'react'
import { Modal, Overlay } from 'react-modal-construction-kit'

export default class App extends Component {
  state = {
    isModalVisible: false
  }

  onBtnOpenModalClick = () => {
    this.setState({
      isModalVisible: true
    })
  }

  close = () => {
    this.setState({ isModalVisible: false })
  }

  render () {
    const { isModalVisible } = this.state

    return (
      <div>
        <Modal
          onClickOutside={this.close}
          onClosed={this.close}
          isOpen={isModalVisible}>
          <p>
            A super minimal Modal
          </p>
        </Modal>
        <Overlay
          isVisible={isModalVisible} />
        <button
          onClick={this.onBtnOpenModalClick}>
          Open modal
        </button>
      </div>
    )
  }
}

Modal

The modal component is a fully customizable modal, requires no styling and is already animated out of the box.

| Property | Type | Default | Description | |:---|:---|:---|:---| | isOpen | boolean | false | Open or close modal's state | | autoFocus | boolean | - | autofocus the component on mount | | zIndex | number | 750 | z-index value | | role | string | "dialog" | HTML5 role | | children | React Node | - | The content of the modal | | onOpened | function | - | Called on when the Transitions triggers 'onOpened' | | onClosed | function | - | Called on when the Transitions triggers 'onClosed' | | onEnter | function | - | Called on componentDidMount | | onExit | function | - | Called on componentWillUnmount | | onEntered | function(node, isAppearing) | - | - | | onExited | function(node) | - | - | | className | string | - | Adds a class names to component root | | dialogClassName | string | - | Adds a class name to dialog | | contentClassName | string | - | Adds a class name to content | | hasEscapeClose | boolean | true | If enabled, escape keydown will trigger onClosed | | hasOutsideClickClose | boolean | true | If enabled, clicking outside of the modal (i.e. on the overlay) will trigger onClosed | | transitionDuration | number | 300 | Duration of the animation |

Overlay

The Modal component does not have an overlay by default, the reason for this is: what if you have multiple modals open? You should only have ONE overlay. It's animated and also requires no styling, it just works ;)

import { Overlay } from 'react-modal-construction-kit'

| Property | Type | Default | Description | |:---|:---|:---|:---| | isVisible | boolean | false | Shows or hides the overlay | | zIndex | number | 500 | z-index value | | className | string | - | A className applied to the overlay | | opacity | number | 0.7 | The opacity value when the overlay is fully visible | | transitionDuration | number | 150 | The duration of the transition | | onClick | function(event) | - | onClick handler, when using a modal you don't need this, use Modal.onClickOutside |

License

MIT Licensed. Copyright (c) Mike Vercoelen 2018.