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

vue-bs4-modal

v1.0.0

Published

Opinionated Bootstrap 4 modal component for Vue

Downloads

2

Readme

Vue Bootstrap 4 Modal

This is an opinionated bootstrap 4 modal component. Use this if you want to quickly open a Bootstrap 4 modal, implement a custom handler for the primary action button or listen to show / hide events.

Add to Your Project

Will be added to npm registry soon. Until then you can,

yarn add https://github.com/swiftmade/vue-bs4-modal

Or you can just copy src/Bs4Modal.vue into your project... Then do this:

Vue.component('bs4-modal', require('vue-bs4-modal'));

Caveats

  • Make sure jQuery is globally accessible via $.
  • You must include Bootstrap 4 script and stylesheet in your project.

Properties

| Prop | Type | Description | |-------------|---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------| | handler | Function -> Promise | The handler will be called when the action button is pressed. You MUST return a promise from your handler. UI will be in busy state until your promise is resolved. | | actionLabel | String | Label of your action button. By default, it will read "OK" | | cancelLabel | String | Label of your cancel button. By default, it will read "Cancel" | | isLarge | Boolean | Pass true to make your modal large (modal-lg). Otherwise, modal-default will be used. |

Example Usage

In the following example, pressing "Open Modal" will open a bootstrap 4 modal. Pressing "OK" will put the modal in busy state for 5 seconds. Then the modal will close and waitForResponse() call will be resolved. If you cancel or close the modal without pressing OK, waitForResponse() call will receive a rejection.

<template>
  <div>
    <bs4-modal ref="modal" :handler="modalHandler">
      <div slot="header">Your Modal's Title</div>
      <div>Your Modal's body! Pressing OK will make you wait 5 seconds...</div>
    </bs4-modal>

    <button @click="openModal()">Open Modal</button>
  </div>
</template>

<script>
export default {
  methods: {
    
    openModal() {
      this.$refs.modal.show()
        .then(() => {
          console.log('Modal is shown!');
          return this.$refs.modal.waitForResponse();
        })
        .then(
          () => {
            console.log('Modal action is completed!');
          },
          () => {
            console.log('Modal is cancelled !');
          }
        );
    },
    
    modalHandler() {
      return new Promise(resolve => {
        setTimeout(resolve, 5000);
      });
    },
  }
}
</script>