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

multi-select2

v1.0.2

Published

Auticomplete and multiple select library written in pure javascript

Downloads

8

Readme

MultiSelect2 JavaScript component

Installation

Yarn

yarn add multi-select2

Usage

//Import the MultiSelect2 library
import MultiSelect2 from "multi-select2";

//Or directly include the bundled JavaScript on the webpage.
<script src="bundle.min.js"></script>

new MultiSelect2(element, {
  options: [
    {
        label: 'London',
        value: 'Ln'
    },
    {
      label: 'New York',
      value: 'NY'
    }
  ],
  autocomplete: true, //if you want to add autocomplete functionality
  multiple: true, //if you want to add multiple values selection
  icon: "fa fa-times", //cross icon incase of multiple select to remove selected values
  onChange: value => {
    console.log(value);
  }
});

`element` // Required. Either selector or HTML node.

CSS

body {
    font-family: "Roboto", sans-serif;
}

.multi-select__select {
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
    cursor: pointer;
    display: flex;
    font-size: 16px;
    font-weight: 500;
    justify-content: left;
    min-height: 44px;
    padding: 5px 10px;
    position: relative;
    transition: 0.2s;
    width: 100%;
    height: auto;
    border-radius: 6px;
    border: none;
    border: 1px solid #aaaaaa;
    background: transparent;
    color: #aaaaaa;

}

.multi-select__autocomplete::placeholder {
    color: red;
}

.multi-select__options {
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
    color: #363b3e;
    display: none;
    left: 0;
    max-height: 221px;
    position: absolute;
    top: 50px;
    width: 100%;
    z-index: 5;
    overflow-y: scroll;
}

.multi-select__option:hover {
    background-color: #e9e9e9;
}

.multi-select__select--opened .multi-select__options {
    display: block;
}

.multi-select__option {
    background: #fff;
    border-bottom: 1px solid #e4e4e4;
    box-sizing: border-box;
    height: 44px;
    line-height: 25px;
    padding: 10px;
}

.multi-select__option-active {
    background-color: #59d9d4 !important;
    color: #ffffff;
}

.multi-select__option--selected {
    color: #e4e4e4;
    cursor: initial;
    pointer-events: none;
}

.multi-select__option--hidden {
    display: none;
}

.multi-select__selected-label {
    background: #58d8d3;
    border-radius: 4px;
    color: #fff;
    cursor: initial;
    display: inline-block;
    margin: 5px;
    padding: 3px 7px;
    font-size: 12px;
}

.multi-select__selected-label:last-of-type {
    margin-right: 0;
}

.multi-select__selected-label i {
    cursor: pointer;
    display: inline-block;
    margin-left: 7px;
}

.multi-select__selected-label i:hover {
    color: #e4e4e4;
}

.multi-select__autocomplete {
    background: #f9f9f8;
    border-bottom: 1px solid #e4e4e4;
    border-left: none;
    border-right: none;
    border-top: none;
    box-sizing: border-box;
    font-size: 16px;
    outline: none;
    padding: 10px;
    width: 100%;
}

TODO

  • [ ] Adding tags functionality
  • [ ] create ReactApp

License

MIT