# pkovzz/ngx-otp-input architecture

> Architecture diagram of the GitHub repository pkovzz/ngx-otp-input, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pkovzz/ngx-otp-input
- Repository: https://github.com/pkovzz/ngx-otp-input

## Overview

##### Main Components Structure
a. Core Component Layer
b. Directive Layer
c. Public API Layer

##### Component Breakdown

- NgxOtpInputComponent (Core)
- Template (HTML)
- Styles (SCSS)
- Component Logic
- Configuration Options
- Form Controls
- State Management

##### Directive Layer
- AriaLabels Directive
- AutoBlur Directive
- AutoFocus Directive
- InputNavigations Directive
- Paste Directive

##### Integration Points
How the library integrates with:
- Angular Forms System
- Host Application
- Accessibility Layer (ARIA)

##### Data Flow Representation
- Input flow: options, OTP value, status
- Output flow: otpChange, otpComplete events
- Internal communication between directives and core component

##### Component Relationships
- Double lines: Data binding

##### Technical Details
- Angular version requirement (14+)
- Standalone component notation
- RegExp validation support
- ARIA integration points

Special Considerations:

##### Security Layer
How the hideInputValues option affects the component's rendering

##### Accessibility Features
ARIA labels integration and screen reader support

##### Input Handling
Demonstrate the input validation flow with RegExp

##### State Management
How the component handles:
- Disabled state
- Success/Failed states
- Form reset functionality

- Line types
- State indicators
- Flow direction conventions

Keep the abstraction level appropriate by:
- Focusing on component architecture rather than implementation details
- Highlighting integration points with host applications
- Showing clear boundaries between internal and external systems
- Emphasizing the standalone nature of the component

- How to integrate the component
- The flow of data through the system
- Available customization points
- Security and accessibility features
- Component's internal architecture

Remember to maintain a balance between showing enough detail to understand the system while keeping it clean and readable.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Library["ngx-otp-input Library"]
        subgraph Core["Core Component Layer"]
            CompLogic["Component Logic"]:::core
            Template["Template (HTML)"]:::core
            Styles["Styles (SCSS)"]:::core
            Config["Configuration Options"]:::config
            
            CompLogic --> Template
            CompLogic --> Styles
            Config --> CompLogic
        end

        subgraph Directives["Directive Layer"]
            AriaDir["AriaLabels Directive"]:::directive
            BlurDir["AutoBlur Directive"]:::directive
            FocusDir["AutoFocus Directive"]:::directive
            NavDir["InputNavigations Directive"]:::directive
            PasteDir["Paste Directive"]:::directive
        end

        subgraph API["Public API Layer"]
            PublicAPI["Public API"]:::api
        end

        subgraph Integration["Integration Points"]
            Forms["Angular Forms System"]:::external
            Host["Host Application"]:::external
            ARIA["Accessibility Layer"]:::external
        end

        %% Relationships
        PublicAPI --> CompLogic
        CompLogic --> Forms
        CompLogic --> Host
        
        AriaDir --> CompLogic
        BlurDir --> CompLogic
        FocusDir --> CompLogic
        NavDir --> CompLogic
        PasteDir --> CompLogic
        
        AriaDir --> ARIA
    end

    %% Legend
    subgraph Legend
        L1["Core Component"]:::core
        L2["Directive"]:::directive
        L3["Configuration"]:::config
        L4["External System"]:::external
        L5["API"]:::api
    end

    %% Styles
    classDef core fill:#2196F3,stroke:#1565C0,color:white
    classDef directive fill:#4CAF50,stroke:#2E7D32,color:white
    classDef config fill:#9C27B0,stroke:#6A1B9A,color:white
    classDef external fill:#9E9E9E,stroke:#616161,color:white
    classDef api fill:#FF9800,stroke:#EF6C00,color:white

    %% Click Events
    click CompLogic "https://github.com/pkovzz/ngx-otp-input/blob/master/projects/ngx-otp-input/src/lib/ngx-otp-input.component.ts"
    click Template "https://github.com/pkovzz/ngx-otp-input/blob/master/projects/ngx-otp-input/src/lib/ngx-otp-input.component.html"
    click Styles "https://github.com/pkovzz/ngx-otp-input/blob/master/projects/ngx-otp-input/src/lib/ngx-otp-input.component.scss"
    click Config "https://github.com/pkovzz/ngx-otp-input/blob/master/projects/ngx-otp-input/src/lib/default.config.ts"
    click PublicAPI "https://github.com/pkovzz/ngx-otp-input/blob/master/projects/ngx-otp-input/src/public-api.ts"
    click AriaDir "https://github.com/pkovzz/ngx-otp-input/blob/master/projects/ngx-otp-input/src/lib/directives/ariaLabels.directive.ts"
    click BlurDir "https://github.com/pkovzz/ngx-otp-input/blob/master/projects/ngx-otp-input/src/lib/directives/autoBlur.directive.ts"
    click FocusDir "https://github.com/pkovzz/ngx-otp-input/blob/master/projects/ngx-otp-input/src/lib/directives/autoFocus.directive.ts"
    click NavDir "https://github.com/pkovzz/ngx-otp-input/blob/master/projects/ngx-otp-input/src/lib/directives/inputNavigations.directive.ts"
    click PasteDir "https://github.com/pkovzz/ngx-otp-input/blob/master/projects/ngx-otp-input/src/lib/directives/paste.directive.ts"
```
