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 🙏

© 2026 – Pkg Stats / Ryan Hefner

ic-autocomplete

v0.2.0

Published

accessible autocomplete ember component

Downloads

76

Readme

ic-autocomplete

Build Status

WAI-ARIA accessible autocomplete component (combobox) for Ember.js.

Demo

http://instructure.github.io/ic-autocomplete

Installation

$ npm install ic-autocomplete

or ...

$ bower install ic-autocomplete

or just grab your preferred distribution from dist/.

Then include the script(s) into your application:

npm+browserify

require('ic-autocomplete')

amd

Register ic-autocomplete as a package, then:

define(['ic-autocomplete'], ...)

named-amd

You ought to know what you're doing if this is the case.

globals

<script src="bower_components/ic-styled/main.js"></script> <script src="bower_components/ic-autocomplete/dist/globals/main.js"></script>

{{ic-autocomplete}} Usage

{{#ic-autocomplete

  <!-- like other input types, `value` is two-way bound to `state` -->
  value=state

  <!--
    you are responsible to filter the items, you might want to do
    ajax, or client-side, or match both ids and labels of options (like
    UT and Utah).

    Map `on-input` to an action on your controller that is called when
    the user types
  -->
  on-input="filterStates"

  <!-- 
    When the user makes a selection, this action is sent, which is a
    great opportunity to reset your data so the list is fully populated
    when the user opens the menu again
  -->
  on-select="selectState"

  placeholder="Pick a state"
}}

  <!--
    inside the autocomplete you should iterate some list of data, this
    is the data you should filter in your `on-input` handler. So as the
    user types, the data changes.
  -->
    {{#each filteredStates}}
      <!-- finally create autocomplete-options with a value and label -->
      {{#ic-autocomplete-option value=id label=name}}
        {{name}}
      {{/ic-autocomplete-option}}
    {{else}}
      <div>No results</div>
    {{/each}}
{{/ic-autocomplete}}

And the JavaScript:

App.ApplicationController = Ember.Controller.extend({

  actions: {
    // the `on-input` actions sends the autocomplete component as the
    // first argument, and the search term the user entered as the
    // second
    filterStates: function(autocomplete, term) {
      // then we simply set the filteredStates, our `{{#each}}` will
      // respond and we'll get a new set of `ic-autocomplete-option`s
      this.set('filteredStates', this.filterStatesBy(term));    
    },

    filterWithXHR: function(autocomplete, term) {
      // you could do something like this too:
      ic.ajax.request('user_search?term='+term).then(function(states) {
        this.set('filteredStates', response.states);
      }.bind(this));
    }
  },

  states: [{label: 'Utah', id: 'UT'}, {label: 'Illinois', id: 'IL'}],

  filterStatesBy: function(term) {
    var term = this.get('stateFilterTerm');
    if (term == '') return this.get('states');
    var filter = new RegExp('^'+term, 'i');
    return this.get('states').filter(function(state) {
      // filtering is up to you because you might want to do something
      // awesome like this, searching on name and id
      return filter.test(state.name) || filter.test(state.id);
    });
  }

});

Contributing

$ git clone <this repo>
$ npm install
$ npm test
# during dev
$ broccoli serve
# localhost:4200/globals/main.js instead of dist/globals/main.js
# new tab
$ karma start

Make a new branch, send a pull request, squashing commits into one change is preferred.