$ show jackocnr/intl-tel-input
intl-tel-input is a mature, widely-used frontend library for international telephone number input. It provides a rich set of features including country selection with search, real-time phone number formatting, validation (powered by Google's libphonenumber), and E.164 extraction. The library is framework-agnostic at its core, with official thin wrappers for React, Vue, Angular, and Svelte, making it easy to integrate into any modern web stack. The architecture follows a modular monorepo pattern: the core package (`packages/core`) contains the main JavaScript class, UI logic, country data, locale translations, and formatting/validation utilities. The framework wrappers are minimal adapters that re-export the core functionality with framework-specific props, events, and lifecycle management. A separate static documentation site (`site/`) provides interactive examples, a playground for testing options, and generated code snippets for all supported frameworks. The codebase demonstrates strong engineering practices: TypeScript throughout, extensive unit/integration/e2e tests (Vitest and Playwright), custom build scripts (esbuild, Closure Compiler for libphonenumber), and a well-organized locale system with 50+ translations. Key reusable components include the numeral conversion logic, country search algorithm, and caret positioning helper, which can be extracted for other projects requiring digit script normalization, token-based search, or input formatting.
The LLM identified 3 files worth highlighting for reuse:
A self-contained class that converts between ASCII digits and non-ASCII digit scripts (Arabic-Indic, Persian, etc.) using Unicode code point ranges. It identifies the digit script of a given string, converts to/from ASCII, and handles edge cases like mixed scripts. Can be extracted and reused in any project that needs to normalize digit input across different numeral systems.
Implements a pure-function search algorithm that tokenizes a query string and matches against a dataset using multiple buckets: ISO2 code, country name, dial code, initials, and word fallback. The algorithm returns matched items with relevance scores. The functions are side-effect-free, easily testable, and can be extracted for any search or autocomplete feature requiring multi-field matching.
A focused module that preserves cursor position during real-time input formatting. It uses a position-for-index mapping to track where the cursor should be after formatting replaces characters, and handles edge cases like deletion, insertion, and formatting changes. This pattern is directly reusable for any masked input or formatted text field implementation.