|
| 1 | +--- |
| 2 | +description: General information based on the latest ./README.md content |
| 3 | +globs: |
| 4 | +--- |
| 5 | +Update it if APIs change: |
| 6 | + |
| 7 | +# TS-Inputs |
| 8 | + |
| 9 | +A TypeScript library providing specialized input handling and formatting for various data types. |
| 10 | + |
| 11 | +## Overview |
| 12 | + |
| 13 | +TS-Inputs is a modular library that provides specialized input handling, formatting, and validation for different types of data. It's designed to be used in web applications where precise input control and formatting are required. |
| 14 | + |
| 15 | +## Features |
| 16 | + |
| 17 | +- **Credit Card Input**: Formatting and validation for credit card numbers |
| 18 | +- **Date Input**: Specialized date input handling |
| 19 | +- **Time Input**: Time format handling |
| 20 | +- **Numeral Input**: Number formatting and validation |
| 21 | +- **General Input**: Common input handling utilities |
| 22 | +- **Cursor Tracker**: Input cursor position tracking |
| 23 | + |
| 24 | +## Project Structure |
| 25 | + |
| 26 | +``` |
| 27 | +src/ |
| 28 | +├── common/ # Shared utilities and types |
| 29 | +│ ├── types.ts # Common type definitions |
| 30 | +│ └── utils.ts # Shared utility functions |
| 31 | +├── credit-card/ # Credit card input handling |
| 32 | +├── cursor-tracker/ # Cursor position tracking |
| 33 | +├── date/ # Date input handling |
| 34 | +├── general/ # General input utilities |
| 35 | +├── numeral/ # Number formatting |
| 36 | +└── time/ # Time input handling |
| 37 | +``` |
| 38 | + |
| 39 | +## Common Utilities |
| 40 | + |
| 41 | +The library provides several common utilities and types: |
| 42 | + |
| 43 | +- `RequireExactlyOne`: Type utility for requiring exactly one property from a set |
| 44 | +- `DelimiterType`: Type definition for input delimiters |
| 45 | +- `BlocksType`: Type for input block definitions |
| 46 | +- Various interfaces for input formatting and delimiter handling |
| 47 | + |
| 48 | +## Usage |
| 49 | + |
| 50 | +```typescript |
| 51 | +import { creditCard, date, numeral, time } from 'ts-inputs' |
| 52 | + |
| 53 | +// Example usage with credit card input |
| 54 | +const formattedCard = creditCard.format('4111111111111111') |
| 55 | +// Result: '4111 1111 1111 1111' |
| 56 | +``` |
| 57 | + |
| 58 | +## Installation |
| 59 | + |
| 60 | +```bash |
| 61 | +npm install ts-inputs |
| 62 | +# or |
| 63 | +yarn add ts-inputs |
| 64 | +``` |
| 65 | + |
| 66 | +## Contributing |
| 67 | + |
| 68 | +Contributions are welcome! Please feel free to submit a Pull Request. |
| 69 | + |
| 70 | +## Testing |
| 71 | + |
| 72 | +```bash |
| 73 | +bun test |
| 74 | +``` |
0 commit comments