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-vz

v1.1.0-vz

Published

React modal, show quick modal

Downloads

5

Readme


Description

  • Simple/Quick show the modal
  • Single/Multiple the modal.
  • Append to portal
  • Remade: react-modal-e2z

Preview

React-Modal

Usage

Install the package

npm install --save react-modal-vz

Import the module in the place you want to use:

import "react-modal-vz/build/styles.css";
import Modal, { ModalBusUtils } from "react-modal-vz";

// Add modal to top AppFile

Snippet

option 1
    const [isShow, setShow] = React.useState(false);
    <Modal isOpen={isShow} center handleOpen={setShow}>
        This is modal
    </Modal>
option 2
    // App.ts[js]
    <Modal>
        This is modal
    </Modal>

    // sub file
    <button onClick={() => ModalBusUtils.showModal()}>
      Show Modal
    </button>

    <button onClick={() => ModalBusUtils.hideModal()}>
      Hide Modal
    </button>

    <button
          onClick={() => {
            ModalBusUtils.showModalWithProps({
              ...ModalProps, // props modal
            });
          }};
    >
        Show with props
    </button>
option multi modal
    // You must set the modalId, otherwise it will always show this
    // App.ts[js]
    <Modal
      modalId="modal-one"
      >
        This is modal
    </Modal>

    <Modal
      modalId="modal-two"
    >
        This is modal 2
    </Modal>

    // sub file
   <button
      onClick={() => {
        ModalBusUtils.showModaIdlWithProps('modal-two', {
          handleAccept: () => alert('abcd'),
        } as IModalProps);
      }}
    >
      Show Modal2
    </button>

    <button onClick={() => ModalBusUtils.hideModalId('modal-two')}>
      Hide Modal2
    </button>

ModalProps

see index.d.ts

| props | type | description | |------------------------------|---------------------------------------|----------------------------------------------------------------------------| | id?: string; | string | | | modalId?: string; | string | Support multi modal | | isOpen?: boolean; | boolean | | | center?: boolean; | boolean | false | | bottom?: boolean; | boolean | false | | className?: string; | string | | | fitHeight?: boolean; | boolean | | | tabIndex?: number; | number | | | animationType?: | AnimateType | default | | animationDuration?: | string | 1200ms | | showHeader?: boolean; | boolean | true | | showFooter?: boolean; | boolean | true | | modalTitle?: | string / React.ReactNode | | | modalHeader?: | string / React.ReactNode | | | modalFooter?: | string / React.ReactNode | | | customizeXClose?: | string / React.ReactNode | | | alignFooter?: | center / right / left | right | | fullButtonMobile?: | boolean | true | | showExtraButton?: | boolean | false | | showAcceptButton?: | boolean | true | | showCancelButton?: | boolean | true | | showXClose?: | boolean | true | | disabledClose?: | boolean | false | | escapeClose?: | boolean | true | | lockBodyScroll?: | boolean | true | | closeOnBackdrop?: | boolean | false | | showSplitBorder?: | boolean | true | | toggleTitle?: | boolean | false | | fullSceen?: | boolean | false | |  | | | | classNameAccept?: | string | | | classNameCancel?: | string | | | classNameExtra?: | string | | | labelAccept?: | string | | | labelCancel?: | string | | | labelExtra?: | string | | | backdropDark?: | boolean | false | | handleToggle?: | (toggle?: boolean) => any; | | | handleAccept?: | () => any; | | | handleCancel?: | () => any; | | | handleEscapse?: | () => any; | | | handleXClose?: | () => any; | | | handleExtra?: | () => any; | | | handleOpen?: | (isOpen: boolean) => any; | |

Animation

AnimateType =
  | 'slideInFromLeft'
  | 'slideInFromRight'
  | 'slideInFromTop'
  | 'slideInFromBottom'
  | 'fadeIn'
  | 'fadeInFromLeft'
  | 'fadeInFromRight'
  | 'fadeInFromTop'
  | 'fadeInFromBottom'
  | 'bounce'
  | 'popIn'
  | 'default' => // use default

BusModal

  // single modal
  ModalBusUtils.showModal();
  ModalBusUtils.hideModal();
  ModalBusUtils.showModalWithProps(ModalProps);

  // multi modal
  ModalBusUtils.showModalId(modalId);
  ModalBusUtils.hideModalId(modalId);
  ModalBusUtils.showModaIdlWithProps(modalId, ModalProps);

Note

  • class for button action: modal2-danger-button, modal2-light-button, modal2-primary-button, modal2-secondary-button
  • disabledClose => no apply escapse, no display cancel and xclose.
  • escapeClose => make sure you don't use 3rd library to close by escapse.
  • some case: set position: relative; for body

RUN

LIVE EXAMPLE

License

MIT