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-intl-tel-input2

v2.0.3

Published

An Ember.js addon for entering and validating international telephone numbers.

Downloads

85

Readme

ember-intl-tel-input2

Build Status npm version Dependency Status devDependency Status

An Ember.js addon for entering and validating international telephone numbers. This project is a fork of justin-lau/ember-intl-tel-input that is outdated.

Please check out the demo page to see the addon in action.

For more information on using ember-cli, visit http://www.ember-cli.com/.

Installation

$ ember install ember-intl-tel-input2

Basic Usage

Just place the {{intl-tel-input}} component in the handlebars template, as you would have guessed.

{{intl-tel-input}}

The component derives from Ember.TextField, anything you can do with the input helper can also be done with this component.

{{intl-tel-input value="555-5555"}}

With Utilities Script

With the utilities script included, the autoPlaceholder option is automatically enabled.

// ember-cli-build.js
module.exports = function(defaults) {
  let app = new EmberApp(defaults, {
    ...
    'ember-intl-tel-input': {
      includeUtilsScript: true, // default to false
    },
    ...
  });
  ...
};

Or if you want to specify your own compatible utils script (like a custom build).

// ember-cli-build.js
module.exports = function(defaults) {
  let app = new EmberApp(defaults, {
    ...
    'ember-intl-tel-input': {
      utilsScript: 'path/to/utilsScript.js',
    },
    ...
  });
  ...
};

If you use both options the default utilsScript will be exported to the path specified.

{{intl-tel-input}}

Properties Binding

Use the following properties for binding:

  • value for input value
  • selectedCountryData for data of the currently selected country
  • number for formatted phone number
  • extension for the extension part of the number
  • numberType for the type of the current number
  • isValidNumber for the validity of the number
  • validationError for information about a validation error
{{intl-tel-input
  allowExtensions=true
  value=value
  selectedCountryData=selectedCountryData
  number=number
  extension=extension
  numberType=numberType
  isValidNumber=isValidNumber
  validationError=validationError}}

Lookup User's Country

intl-tel-input provides a convenient way to look up the user's country based on their IP addresses. This example uses ipinfo.io for demonstration.

// controller
...
geoIpLookupFunc: function(callback) {
  $.getJSON('http://ipinfo.io/')
   .always(function(resp) {
     if (!resp || !resp.country_code) {
       callback('');
     }

     callback(resp.country_code);
   });
}
...
{{intl-tel-input
  initialCountry="auto"
  geoIpLookup=geoIpLookupFunc}}

Running The Demo Page Locally

Run ember server, and visit the demo page at http://localhost:4200.

Credits

This is a wrapper library. It simply wraps the API of the original jQuery plugin created by Jack O'Connor into an Ember.js component.

The original jQuery plugin also depends on several other open-source libraries:

  • Flag images from region-flags
  • Original country data from mledoze's World countries in JSON, CSV and XML
  • Formatting/validation/example number code from Google's libphonenumber
  • Lookup user's country using ipinfo.io

~~This addon's demo page uses Telize for a fast, SSL-supported, yet FREE Geo IP service.~~

Telize no longer provide free services due to heavy abuse. The demo has switched over to ipinfo.io.

The layout and color theme of the demo page comes from Twitter's Bootstrap and Ember.js, respectively.