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

bs-companion

v1.3.6

Published

The perfect Bootstrap companion

Downloads

57

Readme

bs-companion

NPM Downloads

Components with super powers for your Bootstrap apps!

This packages includes:

  • Responsive Table: Nice responsive tables without ugly scrollbars
  • BS Tabs: Improved tabs, that collapse down to a dropdown and with linkable tabs
  • Toaster: Generate beautiful toast message without markup
  • Toasts: Easily generate basic ui toasts (success, warning, error) and enforce default styling
  • Modalizer: Generate beautiful modals without markup
  • Form Validator: Consistent validator that works across tabs and accordions
  • BS Progress: indeterminate and top page progress bars

Tabs

Simply wrap your regular tabs in a bs-tabs component

<bs-tabs responsive>
  <ul class="nav nav-tabs" id="myTab" role="tablist" style="width: 100%">
    <li class="nav-item" role="presentation">...</li>
    <li class="nav-item" role="presentation">...</li>
    <li class="nav-item" role="presentation">...</li>
  </ul>
</bs-tabs>

Supported features (add attributes)

  • Linkable: clicking on the tab will update the hash
  • Responsive: when there is not enough space to fit everything on one line, it will collapse to a dropdown

It can also lazy load content in the tabs. It will trigger a lazyload on any lazy-loadable element

Modals

Basic usage using the modalizer function

modalizer({
  body: "Hello!",
  title: "This is a modal",
  icon: btn.dataset.icon,
});

For confirm modals, you can use

modalizerConfirm(
  {
    body: btn.dataset.confirm,
    icon: "question",
  },
  (res) => {
    // form elements are exposed as FormData inside detail
    let name = res.detail.get("your_name");

    console.log("accepted", res);
  },
  (res) => {
    console.log("denied", res);
  }
);

Toasts

Basic usage using the toaster function

// You can simply pass a string
toaster("Hello world");
// Or an array
toaster({
  body: "Hello world <a href='#'>some link here</a>",
  header: `<div class="d-flex align-items-center"><l-i name="star" class="me-2"></l-i> My header</div>`,
  autohide: false,
});

However, it can be bothersome to always specify all options. Enters the Toasts class

Toasts.success("Hello world");

Form validation

You can easily validate all your forms using FormValidator

<script type="module">
    FormValidator.init();
</script>
<form action="" class="needs-validation" data-validation-message="Some fields are not valid">...</form>

Simply set a needs-validation class. You can also set a message that will be shown in case some fields are invalid. It will also checks in tabs and accordion and show invalid icons.

Validation on trigger

You can validate on blur or keydown.

<input type="email" class="form-control" id="email-input" value="" data-validation-trigger="blur" />

Custom validation

You can use custom validation rules. Multiple rules are supported using a , as separator.

<input type="password" class="form-control" id="confirm-password" data-validation-rules="same #password" data-validation-trigger="blur">

Built-in rules:

  • same {fieldSelector}: check if the value is the same
  • digits: contains only digits
  • number: is a valid number
  • alnum: contains only alnum

You can register custom rules using FormValidation.registerRule.

Also check out