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

@wudev/pop-up

v1.0.0

Published

A PopUp component for React.

Downloads

4

Readme

PopUp

Version Author

A PopUp component for React.

Installation

To install ButtonFor you can use npm:

npm install @wudev/pop-up

Check online

Usage

Simple Use

Import the component and put the content in the PopUp. It is possible to use the ButtonFor component to make interaction with the component much easier.

import PopUp from '@wudev/pop-up';
import ButtonFor from '@wudev/button-for';

<ButtonFor htmlFor="pop-up">Open PopUp</ButtonFor>
<PopUp id="pop-up">...</PopUp>

Use close button

By default the close button is enabled, with the useCloseBtn attribute, it is possible disable the close button.

import PopUp from '@wudev/pop-up';
import ButtonFor from '@wudev/button-for';

<ButtonFor htmlFor="pop-up">Open PopUp</ButtonFor>
<PopUp id="pop-up" useCloseBtn={false}>...</PopUp>

Use close in PopUp

With the useCloseInPopUp attribute, it is possible to close the PopUp by clicking outside the content.

import PopUp from '@wudev/pop-up';
import ButtonFor from '@wudev/button-for';

<ButtonFor htmlFor="pop-up">Open PopUp</ButtonFor>
<PopUp id="pop-up" useCloseInPopUp={true}>...</PopUp>

Use close outside the content

With the useCloseOutsideContent attribute, it is possible to close the PopUp by clicking outside the content.

import PopUp from '@wudev/pop-up';
import ButtonFor from '@wudev/button-for';

<ButtonFor htmlFor="pop-up">Open PopUp</ButtonFor>
<PopUp id="pop-up" useCloseOutsideContent={true}>...</PopUp>

Use close button in content

It is possible to put the close button into the content with the class use-close-btn-in-content.

import PopUp from '@wudev/pop-up';
import ButtonFor from '@wudev/button-for';

<ButtonFor htmlFor="pop-up">Open PopUp</ButtonFor>
<PopUp id="pop-up" className="use-close-btn-in-content">...</PopUp>

Use Animation

It is possible to change the animation with the following CSS variables:

#pop-up-id, .pop-up {
    --animation-open-name: slideInRight;
    --animation-open-duration: 0.5s;
    --animation-open-timing-function: linear;

    --animation-close-name: slideOutLeft;
    --animation-close-duration: 0.5s;
    --animation-close-timing-function: linear;

    --animation-duration: 0.5s;
    --animation-timing-function: linear;
}

Where:

  • --animation-open-name The name of the animation when opening. By default slideInRight, this animation is included in the component's CSS, so it will not be necessary to replace it.
  • --animation-open-duration The duration of the animation when opening. By default 0.5s;
  • --animation-open-timing-function The speed curve of the animation when opening. By default linear;
  • --animation-close-name The name of the animation when closing. By default slideOutLeft, This animation is included in the component's CSS, so it will not be necessary to replace it.
  • --animation-close-duration The duration of the animation when closing. By default 0.5s;
  • --animation-close-timing-function The speed curve of the animation when closing. By default linear;
  • --animation-duration The duration of the animation when opening and closing. By default 0.5s;
  • --animation-timing-function The speed curve of the animation when opening and closing. By default linear;

Globally, the following variables can be used:

:root, body {
	--pop-up-animation-open-name: slideInUp;
	--pop-up-animation-open-duration: 0.25s;
	--pop-up-animation-open-timing-function: ease-in;

	--pop-up-animation-close-name: slideOutDown;
	--pop-up-animation-close-duration: 0.25s;
	--pop-up-animation-close-timing-function: ease-out;

	--pop-animation-duration: 0.25s;
	--pop-animation-timing-function: ease;
}

Where:

  • --pop-up-animation-open-name The name of the animation when opening.
  • --pop-up-animation-open-duration The duration of the animation when opening.
  • --pop-up-animation-open-timing-function The speed curve of the animation when opening.
  • --pop-up-animation-close-name The name of the animation when closing.
  • --pop-up-animation-close-duration The duration of the animation when closing.
  • --pop-up-animation-close-timing-function The speed curve of the animation when closing.
  • --pop-animation-duration The duration of the animation when opening and closing.
  • --pop-animation-timing-function The speed curve of the animation when opening and closing.

It is possible disable the animation with useAnimation attribute.

import PopUp from '@wudev/pop-up';
import ButtonFor from '@wudev/button-for';

<ButtonFor htmlFor="pop-up">Open PopUp</ButtonFor>
<PopUp id="pop-up" useAnimation={false}>...</PopUp>

Use Animation in content

It is possible to animate the content with useAnimationInContent attribute.

import PopUp from '@wudev/pop-up';
import ButtonFor from '@wudev/button-for';

<ButtonFor htmlFor="pop-up">Open PopUp</ButtonFor>
<PopUp id="pop-up" useAnimationInContent={true}>...</PopUp>

Once the useAnimationInContent attribute is activated, it will be necessary to define the open and close animations.
It is possible to use the following configurations to define the animations, as well as change their duration and speed curve:

#pop-up-id, .pop-up {
    --animation-content-open-name: fadeIn;
    --animation-content-open-duration: 0.5s;
    --animation-content-open-timing-function: linear;

    --animation-content-close-name: fadeOut;
    --animation-content-close-duration: 0.5s;
    --animation-content-close-timing-function: linear;
}

Where:

  • --animation-content-open-name The name of the animation when opening.
  • --animation-content-open-duration The duration of the animation when opening. By default the value defined in the --animation-duration variable;
  • --animation-content-open-timing-function The speed curve of the animation when opening. By default the value defined in the --animation-timing-function variable;
  • --animation-content-close-name The name of the animation when closing.
  • --animation-content-close-duration The duration of the animation when closing. By default the value defined in the --animation-duration variable;
  • --animation-content-close-timing-function The speed curve of the animation when closing. By default the value defined in the --animation-timing-function variable;

Globally, the following variables can be used:

:root, body {
    --pop-up-animation-content-open-name: fadeIn;
    --pop-up-animation-content-open-duration: 0.25s;
    --pop-up-animation-content-open-timing-function: ease-in;

    --pop-up-animation-content-close-name: fadeOut;
    --pop-up-animation-content-close-duration: 0.25s;
    --pop-up-animation-content-close-timing-function: ease-out;
}

Where:

  • --pop-up-animation-content-open-name The name of the animation when opening.
  • --pop-up-animation-content-open-duration The duration of the animation when opening.
  • --pop-up-animation-content-open-timing-function The speed curve of the animation when opening.
  • --pop-up-animation-content-close-name The name of the animation when closing.
  • --pop-up-animation-content-close-duration The duration of the animation when closing.
  • --pop-up-animation-content-close-timing-function The speed curve of the animation when closing.

Author

sgb004

License

MIT