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

ember-power-select-with-fallback

v0.3.0

Published

The default blueprint for ember-cli addons.

Downloads

8

Readme

Ember-power-select-with-fallback

This is a addon on top Ember Power Select that based on some criteria decides if renders the rich {{#power-select}} component or fallbacks to a simpler <select>.

This is particularly useful if you want to use native selects on iOS/Android devices, when screen readers are detected, or any other criteria you decide.

Take into account that since this components will try to fallback to a simple select, many features availables in Ember Power Select won't work with the fallback.

The component during development will try to warn you when you use some feature that cannot be safely translated to a regular select. **TODO: Not done :trollface: **

Disclaimer: This component is the fruit of 1h of work. I'm sure it can be greatly improved. PR welcomed.

DEMO

https://ember-power-select-with-fallback.pagefrontapp.com/

Installation

  • ember install ember-power-select-with-fallback

Usage

If your options are just strings, this component is a drop in replacement of ember-power-select.

{{#power-select-with-fallback options=options selected=selected onchange=(action (mut selected)) as |opt|}}
  {{opt}}
{{/power-select-with-fallback}}

If your options are objects, you will need to pass a labelPath property to hint the component what field should display when it fallback to the native component.

{{#power-select-with-fallback options=users selected=user onchange=(action (mut user)) labelPath="fullName" as |opt|}}
  {{opt.fullName}}
{{/power-select-with-fallback}}

If you by default you will see that non of the previous examples is displayed as a native select. Why? Because fallback to native is an opt-in behaviour.

You can either pass mustFallback=<true|false> to customize this behaviour:

{{#power-select-with-fallback mustFallback=true options=options selected=selected onchange=(action (mut selected)) as |opt|}}
  {{opt}}
{{/power-select-with-fallback}}

or, more likely, specify a fallback strategy, with fallback-when=<fallback-strategy>. There is 4 fallback strategies included in the component:

  • ios: Fallbacks only in ios devices.
  • android: Fallbacks only in android devices.
  • windows-phone: Fallbacks only in windows phones.
  • mobile: Fallbacks in any of the previous cases.
{{#power-select-with-fallback fallback-when="mobile" options=options selected=selected onchange=(action (mut selected)) as |opt|}}
  {{opt}}
{{/power-select-with-fallback}}

Known limitations

  • All the options must be available upfront. You cannot populate options using the search action.
  • Accepts nested groups up to 1 level deep.

Upcoming features

  • Implement some developer warnings that make very clear to the users that they're using some functionality that cannot be translated.

  • Support passing a promise that resolves to a collection as options. The component should be disabled until that promise resolves.

  • Fallback multiple select too.