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

@irfanismail/mon-modal

v1.0.9

Published

MonModal is a feature-rich Vue2 modal component. Perfect for Vue developers who wants simple to advanced control in a modal lifecycle, while also giving the freedom to style the component with CSS libraries like Tailwind. Also can be used to create your o

Downloads

9

Readme

mon-modal

MonModal a feature-rich modal Vue2 component. It focuses on bringing the best of Vue's features to achieve common & advanced behavior patterns while giving you the freedom to style the component to your liking. Built-to-work with TailwindCSS.

mon-modal-gif

Demo

Getting Started

// npm
npm i @irfanismail/mon-modal


// yarn
yarn add @irfanismail/mon-modal

Usage

  1. Table of Props

| Props | Type | Default | Description | | ------------- |------------- | :-----------------: | --------------- | | title | string | - | Title of the modal | | label | string | - | Button label for default modal implementation | | titleClass | string | 'mon-modal-title' | Class for title (Tailwind compatible) | | labelClass | string | - | Class for button label for default modal implementation (Tailwind compatible) | | backdropClass | string | 'mon-modal' | Class for modal backdrop (Tailwind compatible) | | modalClass | string | 'mon-modal-container' | Class for modal container (Tailwind compatible) | | headerClass | string | 'mon-modal-header' | Class for modal header (Tailwind compatible) | | bodyClass | string | 'mon-modal-body' | Class for modal body (Tailwind compatible) | | footerClass | string | 'mon-modal-footer' | Class for modal footer (Tailwind compatible) | | persistent | boolean | false | Content rendered inside modal persists even when modal is closed. By default, the content rendered will be destroyed once user closes the modal | | disableClickAway | boolean | false | Disables modal close behavior when user interacts with out of modal content. By default, modal will close when user clicks away. | | disableEsc | boolean | false | Disables modal close behavior when user presses Esc key. By default, modal will close when user presses Esc key. | | openOnMount | boolean | false | Modal will open on mounted(). Refer to Vue's mounted lifecycle for more information | | enter | string | 'mon-modal-enter' | Custom transition class for modal enter phase | | enterActive | string | 'mon-modal-enter-active'| Custom transition class for modal enter-active phase | | enterTo | string | 'mon-modal-enter-to' | Custom transition class for modal enter-to phase | | leave | string | 'mon-modal-leave' | Custom transition class for modal leave phase | | leaveActive | string | 'mon-modal-leave-active'| Custom transition class for modal leave-active phase | | leaveTo | boolean | 'mon-modal-leave-to' | Custom transition class for modal leave-to phase |

  1. Combinations of Slots & Props
<!-- Basic Modal -->
props: 
* title
* label 
  <mon-modal [...props]>
      <template #body>...</template>
      <template #footer="{ close }">...</template>
  </mon-modal>
  
<!-- Custom Header & Content -->
props: 
* label 
  <mon-modal [...props]>
    <template #header="{ close }">...</template>
    <template #custom="{ open, close }">...</template>
  </mon-modal>

<!-- Custom Trigger -->
props: 
 * title
  <mon-modal [...props]>
    <template #trigger="{ open }"></template>
    <template #body>...</template>
  </mon-modal>


<!-- Custom Transition Class -->
props: 
 * title
 * enter
 * enter-active
 * enter-to
 * leave
 * leave-active
 * leave-to
  <mon-modal [...props]>
   ...
  </mon-modal>
  1. Component Lifecycle Hooks

If you need to do logic based on the modal's lifecycle, you can utilize the predefined hooks given below!

| Hooks | Type | Description | | ------------- |------------- | ------------------- | | before-open | function | Called before the modal opens | | after-open | function | Called after the modal opens | | before-close | function | Called before the modal closes | | after-close | function | Called after modal closes |

Example Implementation

<mon-modal 
    @before-open="..."
    @after-open="..."
    @before-close="..."
    @after-close="...">
    ...
</mon-modal>

Check the Demo on how to use modal lifecycle hooks

  1. Handling Modal Behavior outside Usual Scope

There will be times, you will find yourselves needing to trigger modal behaviors outside of the normal scope (eg. clicking a button). MonModal provides two (2) internal functions that can be accessed through Vue's ref="..." & $refs.

The two functions are:

  • openModal()
  • closeModal()

Check the Demo on how to use modal's internal functions

License

MIT License

Author

Irfan Ismail - @irfancoder - [email protected]