Implementation PR
No response
Reference Issues
No response
Summary
At the moment countriesList includes multiple options with different area codes for same country (e.g. Canada has options with patterns +1 (204) ..., +1 (226) ..., +1 (236) ... etc.) I believe it would be great to have an option for "basic" countries list, where there's one option per country (for Canada this would be single option with only country code in pattern+1 (...) ... ....)
I'd say for end users such list would be less overwhelming and easier to browse / find option with typing in focused <select />
Basic Example
At the moment you can do filtering / mapping on your own, something like, but it's quite cumbersome
const map = new Map<string, string[]>();
countriesList.forEach(([code, name, dial, pattern]) =>
map.set(code, [
code,
name,
dial,
pattern.replace(
/\((\d+)\)/,
(_, digits) => `(${'.'.repeat(digits.length)})`
)
])
);
const list = Array.from(map.values());
// additional, you'll need to extract country code from `pattern`,
// when rendering <select /> options in case you want to display it,
// as `dial` contains country code with area code
Drawbacks
The only drawback I can think of is overhead for maintainers generating / maintaining two separate .json lists
Unresolved questions
No response
Implementation PR
No response
Reference Issues
No response
Summary
At the moment
countriesListincludes multiple options with different area codes for same country (e.g. Canada has options with patterns+1 (204) ...,+1 (226) ...,+1 (236) ...etc.) I believe it would be great to have an option for "basic" countries list, where there's one option per country (for Canada this would be single option with only country code in pattern+1 (...) ... ....)I'd say for end users such list would be less overwhelming and easier to browse / find option with typing in focused
<select />Basic Example
At the moment you can do filtering / mapping on your own, something like, but it's quite cumbersome
Drawbacks
The only drawback I can think of is overhead for maintainers generating / maintaining two separate
.jsonlistsUnresolved questions
No response