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

@norama.matema/solid-multiselect

v0.3.0

Published

This is a fork of [Solid MultiSelect](https://github.com/digichanges/solid-multiselect).

Downloads

23

Readme

MultiSelect

This is a fork of Solid MultiSelect.

The original Demo is deployed HERE.

Changes:

  • MultiSelect component is included in a SolidJS application containing examples from the Demo. The MultiSelect component source is moved to the src/components directory.

  • Major property changes, see below.

  • Added searchable property: search box with filtering if true, no filtering if false. Default: true. It is useful to set to false for simple selects with a few options only.

  • MultiSelect.css is no longer imported, copy to your project, include and modify accordingly.

Properties

  • type: selector type:
    • single: single select
    • multiChips: multi select with chip display in selector (default)
    • multiList: multi select with list display above selector
  • options: option array of strings, numbers or records
  • selectedValues: array of selected options
  • idKey: key of id field (unique ID for comparison) in case of record options
  • displayKey: key of field to display in case of record in case of record options (default: same as idKey)
  • selectedOptionDisplay: selected option display:
    • show: leave selected option in list and enable multiple selection of same item (default for type = 'single': leave item in list but no multiple selection)
    • hide: remove selected options from list (default for type = 'multiChips' and type = 'multiList')
    • checkbox: chow checkbox which toggles selected state
  • optionDisplay: (IOption) => 'show' | 'hide' | 'disabled' determines whether the option is to be shown / hidden / shown as disabled (default: 'show' for all)
  • selectionLimit: max number of selected items
  • searchable: true for quick search input in selector
  • caseSensitiveSearch: true for case sensitive quick search
  • disabled: true if disabled
  • id: widget id
  • showArrow: show down arrow
  • groupByKey: key of field for grouping options in case of record options, the key is also used for group title
  • groupByDefault: group if group-by-key is missing (default: 'Others')
  • onSelect: (selectedList: IOption[], selectedItem: IOption) => void select callback
  • onRemove: (selectedList: IOption[], removedItem: IOption) => void remove callback
  • onSearch: (value: string) => void search
  • placeholder: placeholder in search input (default: 'select')
  • emptyRecordMsg: no record matching search string message (default: 'No records found')
  • loading: true if loading state
  • loadingMessage: message shown in loading state (default: 'loading...')
  • style: custom styles grouped by components:
{
  multiSelectContainer?: JSX.CSSProperties
  optionListContainer?: JSX.CSSProperties
  selectedListContainer?: JSX.CSSProperties
  optionContainer?: JSX.CSSProperties
  option?: JSX.CSSProperties
  inputField?: JSX.CSSProperties
  notFound?: JSX.CSSProperties
  loadingMessage?: JSX.CSSProperties
}
  • CustomRemover: () => JSX.Element remover component which removes item from selection upon click (default: X sign, relevant only if type is not single)
  • CustomSelectedItem: (props: RemovableItemProps) => JSX.Element selected item renderer where RemovableItemProps is
{
  value: IOption
  displayKey?: string
  disabled: boolean
  style: JSX.CSSProperties
  RemoverComponent: ({ value }: {value: IOption}) => JSX.Element
}

RemoverComponent will be a wrapper around the possiby custom remover component, just render with the value, e.g.:

  CustomRemover={() => <div style={{ 'font-size': 'small' }}>🗑</div>}
  CustomSelectedItem={({ value, disabled, RemoverComponent }) => (
    <div
      style={{
        opacity: disabled ? 0.6 : 1,
        background: 'lightgreen',
        'border-radius': '5px',
        padding: '3px',
        margin: '0 3px',
        display: 'flex',
        'align-items': 'center',
        width: 'fit-content',
      }}
    >
      {value['value']}
      <Show when={!disabled}>
        <RemoverComponent value={value} />
      </Show>
    </div>
  )}

Install as npm package

npm i '@norama.matema/solid-multiselect'

Clone and Run project

Git clone

git clone https://github.com/norama/solid-multiselect.git .

Install dependencies

$ npm install # or pnpm install or yarn install

Build and publish npm package

npm run npmbuild

Creates the compiled component files in the npmdist directory.

npm publish

Publishes the component, also runs the above npm build script before. Do not forget to increase the version in package.json.

Solid-JS application with MultiSelect examples

In the project directory, you can run:

npm dev or npm start

Runs the app in the development mode.

Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.

npm run build

Builds the app for production to the dist folder.

It correctly bundles Solid in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.

Your app is ready to be deployed!

Deployment

You can deploy the dist folder to any static host provider (netlify, surge, now, etc.)