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

v-phone-number

v1.3.2

Published

Phone number form input visually compatible with Vuetify projects running on Vue 2.x. Allows users to enter in their phone number in their localized, native format while giving your app an [E164](https://en.wikipedia.org/wiki/E.164) formatted string suita

Downloads

425

Readme

v-phone-number

Phone number form input visually compatible with Vuetify projects running on Vue 2.x. Allows users to enter in their phone number in their localized, native format while giving your app an E164 formatted string suitable for SMS and VoIP APIs.

Demo

Demo GIF

Requirements

Proven with the following minimum versions of Vue and Vuetify.

Installation

npm i -s v-phone-number

Add the component as normally to use in a single component or view

import VPhoneNumber from 'v-phone-number';
// ...
export default {
  components: {
    VPhoneNumber,
    // ..
  },
};

To add v-phone-number to the entire app, register the component in either plugins/vuetify.js or directly in main.js

import VPhoneNumber from 'v-phone-number';
// ...
Vue.component('v-phone-number', VPhoneNumber);

Usage

<v-phone-number label="Phone Number" v-model="phoneNumber" />

Props

Most v-text-field props but not:

  • counter
  • counter-value
  • hide-spin-buttons
  • rules (use landline, mobile, required and strict)
  • type (hard-coded to tel for optimal mobile experience)

The following props are enabled, but will make the input look bad unless you turn off the country selector or dig in with some unscoped CSS to support your use case (see "Advanced" below).

  • height
  • filled, label, placeholder, and persistent-placeholder simulataneously
  • prefix
  • reverse
  • solo-inverted
  • suffix

Additionally the following phone-specific properties are available.

Name | Type | Default | Description ---|---|---|--- default-country|string|'US'|ISO 3166 Country code to initialize the input with. If the input is created with a value, the country code of the E164 number given is always used. disable-country-select|boolean|false|Hide the country selector entirely. excluded-countries|array|[]|ISO 3166 country codes to exclude as choices for locality. Ignored if value is an empty array. If the input is created with a value, the country code of the E164 number given is always used. included-countries|array|[]|The complete list of ISO 3166 country codes to inlude as choices for locality. Ignored if value is an empty array. If the input is created with a value, the country code of the E164 number given is always used. hide-calling-code|boolean|false|Hide the calling code prefix of the selected country. hide-flag|boolean|false|Hide the flag emoji of the selected country. landline|boolean|false|Only accept fixed landline number. language|string|'en'|ISO 639 language code of the component's content. Languages with fewer than five million native speakers as of August 2023 may not be supported. National locales have no effect. mobile|boolean|false|Only accept mobile number. show-country-code|boolean|false|Display the ISO 3166 country code of the selected country. strict|boolean|false|If false, validation only checks there are enough digits in the phone number for the selected country. If true, the value itself will be checked (ie, no US area code begins with a zero). voip|boolean|false|Only accept voice over IP number.

Events

All v-text-field events and:

Name | Type | Description ---|---|--- phone-number|PhoneNumber|Underlying PhoneNumber object, see libphonenumber-js for structure update:country-code|string|ISO 3166 country code of the selected country from the menu

Slots

Most v-text-field slots but not:

  • counter
  • prepend-inner while disable-country-select is false
  • progress

Advanced

This project uses BEM (Block Element Modifier) class hierarchy for its components, allowing for precise control over the appearance of this input should the default Vuetify style defaults be found wanting. The block is v-phone-number, and contains the following elements:

  • country-code
  • country-code-display
  • country-code-search
  • country-list
  • number-input

There are no modifiers to these classes.