Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

PhoneInput: full country list + basic E.164 validation

未关闭
#32 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
55/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
react, typescript

调研方向

The payload names no file, so start by locating the existing PhoneInput component and its 50-country list in the repository. Replace the list with the full E.164 set, add the optional countries and preferredCountries props, and add basic digits-only, 15-digit validation that sets aria-invalid and calls onValidityChange(valid, e164). Done when the tests check every entry's ISO code and dial code, filtering, and the callback, and the PR notes the bundle size.

由索引模型根据 Issue 内容生成。

描述

enhancement help wanted priority: low

PhoneInput: full country list + basic E.164 validation

PhoneInput currently ships 50 countries, so users in most of the world (e.g. Sri Lanka, Nepal, Peru, Morocco, Ukraine) can't select their dial code.

Proposal
  1. Full list — all ITU-T E.164 country codes (~245 entries). Flags can be derived from the ISO code rather than stored, and English names via Intl.DisplayNames to keep bundle size down.
  2. Optional countries prop — allow consumers to restrict / reorder the list (e.g. ["IN", "US", "GB"]), plus preferredCountries pinned at the top.
  3. Basic validation — strip formatting characters, enforce digits-only and E.164 max length (15 digits incl. country code); expose aria-invalid and an onValidityChange(valid, e164) callback. Full per-country rules (libphonenumber) stay out of scope to keep zero extra deps.
Acceptance
  • Test that every entry has a valid ISO code and +-prefixed dial code
  • Tests for countries filtering and validation callback
  • Bundle size noted in the PR
主要语言
TypeScript
星标
39
派生
16
平均合并
2 天 5 小时
30 天内合并 PR
12

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

babelize/babelize-elements 的其他 Issue

查看 babelize/babelize-elements 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。