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

react-item-box-input

v2.1.1

Published

An input box with arrangable/removable items

Downloads

13

Readme

React Item Box Input

npm package Code Climate Test Coverage

This component implements an input box with a list of items inside the input box. It is possible to navigate the items with the arrow keys or by clicking on them. It is also possible to set trigger keys which fire a callback.

Using Item Box Input

var items = Immutable.fromJS([
  { data: { id: 1, text: 'aaa' }, template: SomeComponent },
  { data: { id: 2, text: 'bbb' } }
]);
<ItemBox
  items={items}
  itemTemplate={DifferentTemplate}
  value={this.state.value}
  onChange={this.onChange}
  triggerKeys={[KEY_CODE_COMMA]}
  onTrigger={this.onTrigger}
/>

Each item is rendered with by a template. If the item specifies its own template, that template is used. Next, the box checks for a prop supplied default (itemTemplate). Finally, ItemBox has a dumb default implementation.

The text entry is done with an input element. Whenever the user types, it is passed up via the onChange prop. There is also an onTrigger prop that will trigger when a keyUp event (useful for tracking keys like tab or escape that do not trigger onChange).

Changelog

2.1.1

  • fix bug where hitting backspace on item in list causes the browser to go back in history 2.1.0
  • style updates so it looks more like a single input (2.2 will probably be an update to add better style control)

2.0.0 updated to work with React 0.14.0-rc1

1.1.1 fixed to work in environments that lack browser layout abilities (tests/isomorphic).

  • added a defaultWidth prop that will specify the width of the container for the item list when it cannot be determined from the browser

1.1.0 added component level itemTemplate prop to supply a default template.

1.0.0 initial release