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

widjet-select-multiple

v1.2.2

Published

A widget to make multiple select more user friendly

Downloads

6

Readme

widjet-select-multiple Build Status codecov

A widget to make multiple select more user friendly.

Install

npm install widjet-select-multiple --save

Usage

import widgets from 'widjet'
import 'widjet-select-multiple'

widgets('select-multiple', 'select[multiple]', {on: 'load'})

The select-multiple widget operates on select inputs with the multiple attribute defined. It replaces the traditionnal list UI with a new DOM you can style as you see fit. From a single select element you end up with a div containing the original select, a new select that displays only the values that are not selected yet and another div containing the selected values represented as divs with a close button in them (this is the default value formatting, but it can be change through options or data attributes).

The widget behaviour is:

  • When an item is selected in the single select, that value is selected in the multiple select, disabled in the single select and displayed in the selected values div using the formatting function.
  • When clicking on the close button the inverse process is performed, the option is unselected in the multiple select, enabled in the single select and removed from the selected values div.

Custom Attributes

Name|Type|Description ---|---|--- data-format-value|string|The name of a function defined in the options object that will be used as the value formatting function.

Options

Option|Type|Description ---|---|--- wrapperClass|string|The class name to use for the wrapper div around the initial select. Defaults to select-multiple. itemsWrapperClass|string|The class name to use for the selected values wrapper. Defaults to values. itemClass|string|The class name for the selected values div. Defaults to option. itemLabelClass|string|The class name for the selected value labels. Defaults to label. itemCloseClass|string|The class name for the selected value close buttons. This class is used as the selector to bind events handler so that the selected values can be unselected when clicking on the buttons. Defaults to close. itemCloseIconClass|string|The class name for the close button icons. Defaults to fa fa-close. formatValue|function|A function that takes an option as argument and should return the DOM element that will represent this option in the selected values div.