Socket
Socket
Sign inDemoInstall

@ne1410s/popup

Package Overview
Dependencies
1
Maintainers
1
Versions
109
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @ne1410s/popup

A lightweight configurable popup.


Version published
Weekly downloads
225
decreased by-0.44%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

@ne1410s/popup

A lightweight & configurable modal popup.

<ne14-pop>
  <p>Hello world</p>
</ne14-pop>
  • Use: <script src="PATH_TO_UMD_SCRIPT"></script>
  • Extend: npm i @ne1410s/popup

Attributes

<ne14-pop move resize>YO' STUFF<ne14-pop></ne14-pop></ne14-pop>
  • move: User can drag the popup around
  • resize: User can alter the size of the popup
  • shrink: (Requires resize: User can reduce size below that initially presented)
  • open: The popup is opened immediately
  • no-close: The close icon is not made available
  • style: If supplied inline, the following styles are propagated to the element. They are fairly self-explanatory
    • background-color
    • border-radius
    • box-shadow

Events

const pop = document.querySelector('ne14-pop');

pop.addEventListener('open', () => {
  console.log('Just opened!');
});
  • open: Fired when the popup is opened
  • close: Fired when the popup is closed
  • confirmaccept: Fired when the confirm callback allowed the popup to close
  • confirmreject: Fired when the confirm callback prevented the popup from closing
  • dismissaccept: Fired when the dismiss callback allowed the popup to close
  • dismissreject: Fired when the dismiss callback prevented the popup from closing

Methods

  • open(): Opens the popup
  • close(): Closes the popup
  • wrap(): Wraps existing html element(s) in a new popup
  • confirm(): Closes the popup, unless confirmCallback is provided and returns false
  • dismiss(): Closes the popup, unless dismissCallback is provided and returns false.

Properties

  • confirmCallback: () => boolean: Return false to prevent a call to confirm from closing the popup
  • dismissCallback: () => boolean: Return false to prevent a call to dismiss from closing the popup

CSS Variables

Some degree of custom styling can be provided, by way of css variables:

ne14-pop {
  --background: rgba(0, 0, 0, 0.5);
  --border-radius: 5px;
  --box-shadow: 5px 5px 20px black;
}
  • --background Background behind the popup. Defaults to: rgba(0, 0, 0, .85)
  • --border-radius Border radius for the popup.
  • --box-shadow Box shadow for the popup (when stationary).

Keywords

FAQs

Last updated on 30 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc