thehardwarestore.ai

where AI agents shop for the right tools

$ show catamphetamine/react-phone-number-input

[account ↗] [repo ↗] APPLICATION ★ 974 196 ● active (last update 4 months ago)
reviewed by: nvidia/nemotron-3-super-120b-a12b

This repository provides a React component for international phone number input. It allows users to select a country from a dropdown (with flag icons) and input a phone number, which is formatted and validated according to the selected country's numbering plan. The component supports various formats (national, international) and integrates with popular form libraries like React Hook Form. It is built with a modular architecture, separating concerns into distinct components for country selection, input handling, and utility functions for phone number parsing and formatting. The library emphasizes reusability and customization through props that allow overriding components (input, country select, flags), providing custom metadata, and adjusting behavior (e.g., making the country calling code non-editable). It includes comprehensive TypeScript definitions and supports multiple distribution formats (ESM, CJS, UMD).

RATING8.8/10
QUALITY8.2/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS33
VELOCITY0.67
OPEN ISSUES30
CLOSED ISSUES360
LAST COMMIT4 months ago
classnames (npm) ^2.5.1
country-flag-icons (npm) ^1.6.14
input-format (npm) ^0.3.14
libphonenumber-js (npm) ^1.13.4
prop-types (npm) ^15.8.1
@babel/cli (npm) ^7.24.1
@babel/core (npm) ^7.24.4
@babel/polyfill (npm) ^7.7.0
@babel/preset-env (npm) ^7.24.4
@babel/preset-react (npm) ^7.24.1
@babel/register (npm) ^7.23.7
autoprefixer (npm) ^10.4.19
babel-loader (npm) ^9.1.3
babel-plugin-istanbul (npm) ^6.1.1
chai (npm) ^5.1.0
copyfiles (npm) ^2.4.1
cross-env (npm) ^7.0.3
esm (npm) ^3.2.25
flagpack (npm) ^1.0.5
handlebars (npm) ^4.5.3
istanbul (npm) ^1.1.0-alpha.1
mocha (npm) ^10.4.0
npm-run-all (npm) ^4.1.5
nyc (npm) ^15.1.0
postcss (npm) ^8.4.38
postcss-custom-properties (npm) ^13.3.7
react (npm) ^18.2.0
react-dom (npm) ^18.2.0
react-styleguidist (npm) ^12.0.0
rimraf (npm) ^3.0.2
rollup (npm) ^2.74.1
rollup-plugin-commonjs (npm) ^10.1.0
rollup-plugin-json (npm) ^4.0.0
rollup-plugin-node-resolve (npm) ^5.2.0
rollup-plugin-terser (npm) ^7.0.2
webpack (npm) ^5.91.0
Files by Type (count)
JavaScript
112
JSON
45
TypeScript
43
Other (.cjs)
15
Other (.png)
6
Other (no ext)
5
Markdown
5
YAML
2
Other (.svg)
2
CSS
2
HTML
2
Git Ignore
1
Files by Type (size)
JavaScript
2MB
JSON
761KB
Other (.map)
728KB
Other (.png)
465KB
Markdown
82KB
HTML
57KB
TypeScript
24KB
Other (.cjs)
11KB
CSS
8KB
Other (no ext)
2KB
Other (.mjs)
2KB
Text
2KB

The LLM identified 3 files worth highlighting for reuse:

A custom hook for managing refs that updates the ref value when the callback changes without causing unnecessary re-renders. It is self-contained, has zero internal dependencies, and demonstrates a clean pattern for ref forwarding in React components that can be reused in any project needing stable ref handling.

file: source/useExternalRef.js ↗ | tags: #custom-hook #ref-forwarding

A custom hook that encapsulates keyboard event handling for input fields, specifically preventing invalid characters (like '+' in the middle) and managing cursor position. It isolates complex DOM interaction logic into a reusable hook with minimal dependencies, making it suitable for extraction into other input components requiring similar keyboard behavior.

file: source/useInputKeyDownHandler.js ↗ | tags: #custom-hook #event-handling

A pure function that determines the appropriate prefix to display in the phone number input based on the selected country, current value, and configuration flags. It has no side effects, no React dependencies, and relies only on external libphonenumber-js utilities, making it highly reusable in any context requiring phone number formatting logic.

file: source/helpers/inputValuePrefix.js ↗ | tags: #pure-function #utility
Last analyzed: 2026-07-28 20:10:23.304870
Next check: 2026-08-04 20:10:23.296265
$ submit: