ng-otp-box 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +62 -12
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,24 +1,74 @@
1
1
  # NgOtpBox
2
2
 
3
- This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.1.0.
3
+ ng-otp-box is a flexible, reusable OTP (One-Time Password) input component for Angular applications.
4
+ It supports numeric, text, mixed, and password OTP, with built-in validation, paste handling, masking/unmasking, and Angular Reactive Forms support.
4
5
 
5
- ## Code scaffolding
6
+ ## Installation
6
7
 
7
- Run `ng generate component component-name --project ng-otp-box` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ng-otp-box`.
8
- > Note: Don't forget to add `--project ng-otp-box` or else it will be added to the default project in your `angular.json` file.
8
+ #### This library supports Angular version 15 and above
9
+ ```bash
10
+ npm install --save ng-otp-box
11
+ ```
9
12
 
10
- ## Build
13
+ ## Usage
11
14
 
12
- Run `ng build ng-otp-box` to build the project. The build artifacts will be stored in the `dist/` directory.
15
+ ### Import the Module
13
16
 
14
- ## Publishing
17
+ For **Modules**:
15
18
 
16
- After building your library with `ng build ng-otp-box`, go to the dist folder `cd dist/ng-otp-box` and run `npm publish`.
19
+ ```typescript
20
+ import { NgOtpBoxModule } from 'ng-otp-box';
17
21
 
18
- ## Running unit tests
22
+ @NgModule({
23
+ imports: [
24
+ ...otherModules,
25
+ NgOtpBoxModule,
26
+ ],
27
+ })
28
+ export class AppModule {}
29
+ ```
19
30
 
20
- Run `ng test ng-otp-box` to execute the unit tests via [Karma](https://karma-runner.github.io).
31
+ For **Standalone Components**:
21
32
 
22
- ## Further help
33
+ ```typescript
34
+ import { NgOtpBoxComponent } from 'ng-otp-box';
35
+
36
+ @Component({
37
+ standalone: true,
38
+ imports: [NgOtpBoxComponent],
39
+ })
40
+ export class YourComponent {}
41
+ ```
42
+
43
+ ```html
44
+ <ng-otp-input (otpChange)="onOtpChange($event)" [otpLength]="6" type="masked"></ng-otp-input>
45
+ ```
46
+
47
+
48
+ ## Component Inputs/Outputs
49
+
50
+ Name | Type | Required | Default | Description |
51
+ |-----------------|----------|----------|---------|-----------------------------------------------------------------------------|
52
+ | `onOtpChange` | `Output` | No | -- | Emits the OTP value on change it will give your message value and otp form valid state so. Not required if using `formControl`
53
+ | `pastValue` | function | No | -- | Allows to paste the value. |
54
+ | `config` | object | NO | `6` | Configuration object for customization it will take default otp length as 6 (see **Config Options** below). |
55
+
56
+
57
+ ## Config Options
58
+
59
+ Name | Type | Required | Default | Description |
60
+ |-----------------|----------|----------|---------|-----------------------------------------------------------------------------|
61
+ | `otpLength` | number | No | 6 | Number of OTP input fields. |
62
+ | `inputType` |'number' | 'text' | 'mixed' | 'masked' | No | `number` | Determines the allowed input type:-
63
+ `• number → digits only
64
+ • text → uppercase letters
65
+ • mixed → alphanumeric
66
+ • masked → password/masked input with checkbox to unmask` |
67
+ | `pasteAllowed` | boolean | No | 6 | Allows pasting a full OTP value. |
68
+
69
+
70
+
71
+ ## Contributing
72
+
73
+ Show your support by starring the repo!
23
74
 
24
- To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-otp-box",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^15.1.0",
6
6
  "@angular/core": "^15.1.0",
@@ -30,4 +30,4 @@
30
30
  "default": "./fesm2020/ng-otp-box.mjs"
31
31
  }
32
32
  }
33
- }
33
+ }