GithubHelp home page GithubHelp logo

haldiggs / ember-power-select Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cibernox/ember-power-select

0.0 1.0 0.0 1.32 MB

The extensible select component built for ember.

Home Page: http://www.ember-power-select.com

License: MIT License

JavaScript 59.45% HTML 34.60% CSS 5.95%

ember-power-select's Introduction

Build Status Ember Observer Score Code Climate npm version

Ember-Power-Select

Ember Power Select is an pure ember select component focused in flexibility and extensibility.

Installation

Ember Power Select works in Ember 1.13.9+ or 2.0+, including beta and canary, with no deprecations whatsoever. Any deprecation will be considered a bug.

As any other ember-cli addon, run:

ember install ember-power-select

Usage

Check the full documentation with live examples at www.ember-power-select.com and please open an issue if something doesn't work or is not clear enough.

Good docs are important :)

Extensions

Ember-power-select's focus on flexibility enables the community to build richer and more tailor made components on top of it, focused in solving one particular problem, using composition.

Check the addons section to see some and if you create one that you want to open source open a PR to include it in the list.

Browser support

This component was just tested it in modern browsers but there is no technical reason it wouldn't work in IE9+. If you find any problem please file an issue.

Testing

In testing it requires phantomjs 2.0+. This component also provides some convenient test helpers to interact with the component in acceptance tests.

Contributing

Any contribution is welcome. Please read our guidelines.

Troubleshooting

If something doesn't work visit the Troubleshooting section of the docs first and if your problem persist open an issue.

Motivation

Why reinvent the wheel when there are already good framework-agnostic libraries out there that are battle tested and can be wrapped?

โ€” Your brain, now.

Believe me, I tried. And it worked for a while. Two good ember examples of addons doing that are ember-cli-selectize and https://github.com/iStefo/ember-select-2.

However this approach has inherent downsides.

By accepting to use a framework agnostic library one needs to renounce to take advantage of the more higher level primitives that Ember and HTMLBars provide.

Let's say that you need to build a mildly complex select which, as you type in a search-box, shows you a list of users that match that search with their avatars, names, and other information, and if there is no match it shows some message. When you select one user you navigate to the user profile.

Using components and blocks this can be expressed very naturally.

{{#my-select search=(action "findUsers") onchange=(action "seeProfile") as |user|}}
  <img src="{{user.avatarUrl}}" alt="{{t 'alts.avatar-of' user=user.fullName}}">
  <strong>{{user.fullName}}</strong>
  <em>{{user.email}}</em>
{{else}}
  <img src="sad-face.svg">
  <p>{{t "users.sorry-no-matches-try-again"}}</p>
{{/my-select}}

This is the kind of expressiveness I wanted to find but is actually not possible to achieve translating between the "Ember world" where we solve problems in terms of actions and templates and the lower level world of those libraries where things are expressed in terms of events and DOM nodes.

Even for things that are not impossible to do, translating between the bindings and data structures we use in ember and those in the libraries requires a surprising amount of glue code and is a very tricky task.

Also those libraries tend to be quite complex and bloated with functionality not directly related with the task they have to solve, like internationalization for example. We don't need that code making this libraries weight ~100KB when we already have better and more natural ways to do it already.

I thought that we deserved a select component for ember projects built with from scratch with ember in mind. That also allowed this library to weight <10KB (JS + CSS + images) when gzipped.

ember-power-select's People

Contributors

cibernox avatar miguelcobain avatar dremora avatar tyleriguchi avatar cah-brian-gantzler avatar willrax avatar behnoodk avatar felixkiss avatar elwayman02 avatar karellm avatar machty avatar btecu avatar gcheung55 avatar jasonmit avatar ember-tomster avatar samdemaeyer avatar snewcomer avatar toranb avatar

Watchers

H Diggs avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.