🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@lion/input-tel

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lion/input-tel

Input field for entering phone numbers, including validation, formatting and mobile keyboard support.

0.2.3
latest
Source
npm
Version published
Weekly downloads
287
58.56%
Maintainers
2
Weekly downloads
 
Created
Source

Input Tel >> Overview ||10

Input field for entering phone numbers, including validation, formatting and mobile keyboard support.

import { html } from '@mdjs/mdjs-preview';
import { ref, createRef } from '@lion/core';
import { PhoneUtilManager } from '@lion/input-tel';
import '@lion/input-tel/define';
import { loadDefaultFeedbackMessages } from '@lion/validate-messages';
import '../../../docs/fundamentals/systems/form/assets/h-output.js';
export const main = () => {
  loadDefaultFeedbackMessages();
  return html`
    <lion-input-tel
      .modelValue="${'+639921343959'}"
      live-format
      label="Telephone number"
      name="phoneNumber"
    ></lion-input-tel>
    <h-output
      .show="${[
        'activeRegion',
        {
          name: 'all or allowed regions',
          processor: el => JSON.stringify(el._allowedOrAllRegions),
        },
        'modelValue',
      ]}" 'modelValue']}"
      .readyPromise="${PhoneUtilManager.loadComplete}"
    ></h-output>
  `;
};

Features

  • Extends our input
  • Shows a mobile telephone keypad on mobile (by having a native <input inputmode="tel"> inside)
  • Can be configured with a list of allowed region codes
  • Will be preconfigured with region derived from locale
  • Has the e164 standard format as modelValue
  • Uses awesome-phonenumber (a performant, concise version of google-lib-phonenumber):
    • Formats phone numbers, based on region code
    • Validates phone numbers, based on region code
  • Lazy loads awesome-phonenumber, so that the first paint of this component will be brought to your screen as quick as possible

Installation

npm i --save @lion/input-tel
import { LionInputTel } from '@lion/input-tel';
// or
import '@lion/input-tel/define';

Keywords

input

FAQs

Package last updated on 08 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts