1.0.7 • Published 5 years ago

verify-number v1.0.7

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

verify-number

WebComponent that provides opportunity to verify number.

Usage

Installation

npm i verify-number

In HTML file

<html>
  <head>
  </head>
  <body>
    <verify-number mask="+7(985)0II-**-**" errortext="Wrong number"></verify-number>
    <script type="text/javascript" src="index.js"></script>
  </body>
</html>

In head of your index.js

import 'verify-number';

Attributes

interface IAttributes {
  mask: string;
  /**
  	 * Following values of symbol:
  	 * "I" - single input for entering a single digit
  	 * "X" - gray block with "X"
  	 * "*" - gray block with "●"
  	 * <number> - gray block with digit
  	 * <other> - symbol display inline
  Example: mask="+7(985)III-II-I*"
  	 */
  errortext: string;
      // A string representation of the error text that can appears under input
      // Example: errortext="Wrong number" 
  iserror: string;
    /** Changes the error state
      	 * Following values:
      	 * "false"
      	 * "true"
      Example: iserror="false"
      	 */
  value: string;
  // Example: "1,2,,3" 
}

Attention

You need to only refer to verify-number element after its defining. See demo

window.customElements.whenDefined('verify-number').then(() => {
  //your code
});

Contributing

Instructions for running demo locally:

Installation

git clone git@github.com:FedorBilichenko/verify-number.git
cd verify-number
npm i

Running the demo locally

npm start

and visit http://0.0.0.0:9001

Running test

npm run test
1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago