# sang-minkim/react-ksmodal architecture

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

- Interactive diagram: https://gitdiagram.com/sang-minkim/react-ksmodal
- Repository: https://github.com/sang-minkim/react-ksmodal

## Overview

##### Main Components Identification

The system should be represented with these key components:

a) Public API Layer
- Entry points (src/index.ts)
- Component exports
- Hook exports

b) Core Components
- Modal Component (Ksmodal.tsx)
- Modal Hook (useModal.tsx)
- Modal Factory (createKsmodal.tsx)

c) Supporting Utilities
- Type definitions
- Styling modules

**┌─ Public API Layer ─────────────────────┐**

- ┌─ Component Exports ──┐              │
- Ksmodal           │              │
- createKsmodal     │              │
- ┘              │

- ┌─ Hook Exports ───────┐              │
- useModal          │              │
- ┘              │
- ┘

- ▼
**┌─ Core Implementation ─────────────────┐**

- ┌─ Components ────────┐              │
- Ksmodal Component   │◄────────┐    │
- ┘         │    │

- ┌─ Hooks ────────────┐          │    │
- useModal Hook      │          │    │
- ┘          │    │

- ┌─ Factory ──────────┐          │    │
- createKsmodal      │─────────┘    │
- ┘              │
- ┘

- ▼
**┌─ Supporting Layer ──────────────────────┐**

- ┌─ Types ───────────┐                  │
- Component Types │                  │
- Global Types    │                  │
- ┘                  │

- ┌─ Styles ──────────┐                  │
- CSS Modules     │                  │
- ┘                  │
- ┘

##### Important Elements to Highlight

a) Component Creation Flow:
- How createKsmodal factory creates Modal instances
- How useModal hook manages modal state
- Demonstrate the relationship between components and their types

b) State Management:
- UseModal hook's role in managing visibility
- How duration and visibility state flow through the system

##### Implementation Details

- Props interface with all available options
- State management flow
- Animation handling
- Event handling for show/hide operations

- Component relationships
- Type dependencies

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Public API Layer"
        API[Entry Point]
        CompExp[Component Exports]
        HookExp[Hook Exports]
        UtilExp[Utility Exports]
    end

    subgraph "Core Implementation"
        Modal[Ksmodal Component]
        Hook[useModal Hook]
        Factory[createKsmodal Factory]
    end

    subgraph "Supporting Layer"
        Types[Component Types]
        GlobalTypes[Global Types]
        Styles[CSS Modules]
    end

    %% Relationships
    API --> CompExp
    API --> HookExp
    API --> UtilExp
    
    CompExp --> Modal
    HookExp --> Hook
    UtilExp --> Factory
    
    Factory --> Modal
    Hook --> Modal
    Types --> Modal
    Types --> Hook
    GlobalTypes --> Modal
    Styles --> Modal

    %% Click Events
    click API "https://github.com/Sang-minKIM/react-ksmodal/blob/main/src/index.ts"
    click CompExp "https://github.com/Sang-minKIM/react-ksmodal/blob/main/src/components/index.ts"
    click HookExp "https://github.com/Sang-minKIM/react-ksmodal/blob/main/src/hook/index.ts"
    click UtilExp "https://github.com/Sang-minKIM/react-ksmodal/blob/main/src/utils/index.ts"
    click Modal "https://github.com/Sang-minKIM/react-ksmodal/blob/main/src/components/Ksmodal.tsx"
    click Hook "https://github.com/Sang-minKIM/react-ksmodal/blob/main/src/hook/useModal.tsx"
    click Factory "https://github.com/Sang-minKIM/react-ksmodal/blob/main/src/utils/createKsmodal.tsx"
    click Types "https://github.com/Sang-minKIM/react-ksmodal/blob/main/src/components/types.ts"
    click GlobalTypes "https://github.com/Sang-minKIM/react-ksmodal/blob/main/src/global.d.ts"
    click Styles "https://github.com/Sang-minKIM/react-ksmodal/blob/main/src/components/ksmodal.module.css"

    %% Styling
    classDef api fill:#2374ab
    classDef core fill:#2a9d8f
    classDef support fill:#95a5a6
    classDef dataFlow stroke:#e63946,stroke-width:2px

    class API,CompExp,HookExp,UtilExp api
    class Modal,Hook,Factory core
    class Types,GlobalTypes,Styles support

    %% Legend
    subgraph Legend
        L1[Public API]:::api
        L2[Core Components]:::core
        L3[Supporting Utilities]:::support
        L4[Data Flow]:::dataFlow
    end
```
