4

GitHub - gyurielf/svelte-tel-input: Svelte Tel Input

 1 year ago
source link: https://github.com/gyurielf/svelte-tel-input
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Svelte Tel Input

Lightweight svelte tel/phone input standardizer.

Under development!

Do not use it before 1.0, it won't works properly!

Lightweight phone input standardization.


Installation

Svelte Tel Input is distributed via npm.

npm install --save svelte-tel-input

Usage

<script lang="ts">
    import { TelInput } from 'svelte-tel-input';
    import type { CountryCode } from 'svelte-tel-input'

    // Any Country Code Alpha-2 (ISO 3166)
    let country: CountryCode = 'US'

    let parsedPhoneInput: NormalizedPhoneNumber | null = null;
</script>

<TelInput {country} bind:parsedPhoneInput class="any class passed down" />

(back to top)

Features

  • Parse and validate phone number.
  • Standardize parsed phone numbers. You can store one exact format, no matter how users type their phone numbers.
  • Mask typed inputs (country specificly), to make it more readable.
  • Automatically set the user's current country using an IP lookup.

(back to top)

Dependencies

libphonenumber-js

(back to top)

Changelog

(back to top)

Roadmap

  • Add Changelog
  • Add CI/CD
  • Integrate libphonenumber
  • Implement parser
  • Add basics docs and examples
  • Add advanced examples
  • Improve A11Y
  • Default country sould be optional. ( ip | browserLang |off )
  • Simlify code and types
  • Multi-language Support

See the open issues for a list of proposed features (and known issues).

(back to top)

Support

(back to top)

License

Distributed under the MIT License. See LICENSE.md for more information.

(back to top)


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK