Skip to content

Commit

Permalink
feat(countries): Added missing countries from ISO 3166 #3894
Browse files Browse the repository at this point in the history
  • Loading branch information
Anders.Breilid committed Sep 5, 2024
1 parent 388e0b2 commit 2992084
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ describe('Field.PhoneNumber', () => {
keyCode: 13,
})

expect(europe).toHaveLength(51)
expect(europe).toHaveLength(52)
})

it('should return correct value onChange event', async () => {
Expand Down
87 changes: 86 additions & 1 deletion packages/dnb-eufemia/src/extensions/forms/constants/countries.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/**
* Source: Wikipedia's official list of phone number country codes
* Sources:
* - https://en.wikipedia.org/wiki/List_of_country_calling_codes
* - https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
* - https://www.itu.int/rec/T-REC-E.164/en#:~:text=The%20international%20public%20telecommunication%20numbering%20plan
*
* cdc: Country Dialing Code
*/
Expand All @@ -19,6 +22,7 @@ export type CountryType = {
| 'Antarctica'
| 'North America'
| 'South America'
| 'None'
regions?: Array<'Scandinavia' | 'Nordic'>
}

Expand Down Expand Up @@ -284,6 +288,15 @@ const countries: Array<CountryType> = [
iso: 'BW',
continent: 'Africa',
},
{
i18n: {
en: 'Bouvet Island',
nb: 'Bouvetøya',
},
cdc: '47', // Uncertain, low to no population on these islands
iso: 'BV',
continent: 'Antarctica',
},
{
i18n: {
en: 'Brazil',
Expand Down Expand Up @@ -383,6 +396,15 @@ const countries: Array<CountryType> = [
iso: 'CV',
continent: 'Africa',
},
{
i18n: {
en: 'Bonaire, Saint Eustatius and Saba',
nb: 'Bonaire, Saint Eustatius og Saba',
},
cdc: '599',
iso: 'BQ',
continent: 'South America',
},
{
i18n: {
en: 'Cayman Islands',
Expand Down Expand Up @@ -719,6 +741,15 @@ const countries: Array<CountryType> = [
iso: 'PF',
continent: 'Oceania',
},
{
i18n: {
en: 'French Southern and Antarctic Lands',
nb: 'De franske sørterritorier',
},
cdc: '262', // Uncertain, low to no population on these islands
iso: 'TF',
continent: 'Africa',
},
{
i18n: {
en: 'Gabon',
Expand Down Expand Up @@ -873,6 +904,15 @@ const countries: Array<CountryType> = [
iso: 'HT',
continent: 'North America',
},
{
i18n: {
en: 'Heard Island and McDonald Islands',
nb: 'Heard- og McDonaldøyene',
},
cdc: '672',
iso: 'HM',
continent: 'Antarctica',
},
{
i18n: {
en: 'Honduras',
Expand Down Expand Up @@ -1243,6 +1283,15 @@ const countries: Array<CountryType> = [
iso: 'MH',
continent: 'Oceania',
},
{
i18n: {
en: 'Martinique',
nb: 'Martinique',
},
cdc: '596',
iso: 'MH',
continent: 'South America',
},
{
i18n: {
en: 'Mauritania',
Expand Down Expand Up @@ -1459,6 +1508,15 @@ const countries: Array<CountryType> = [
iso: 'NU',
continent: 'Oceania',
},
{
i18n: {
en: 'Norfolk Island',
nb: 'Norfolkøya',
},
cdc: '672',
iso: 'NF',
continent: 'Oceania',
},
{
i18n: {
en: 'North Korea',
Expand Down Expand Up @@ -1856,6 +1914,15 @@ const countries: Array<CountryType> = [
iso: 'ZA',
continent: 'Africa',
},
{
i18n: {
en: 'South Georgia and the South Sandwich Islands',
nb: 'Sør-Georgia og Sør-Sandwichøyene',
},
cdc: '500',
iso: 'GS',
continent: 'None',
},
{
i18n: {
en: 'South Korea',
Expand Down Expand Up @@ -2127,6 +2194,15 @@ const countries: Array<CountryType> = [
iso: 'US',
continent: 'North America',
},
{
i18n: {
en: 'United States Minor Outlying Islands',
nb: 'USAs ytre småøyer',
},
cdc: '1', // Uncertain, low to no population on these islands
iso: 'UM',
continent: 'None',
},
{
i18n: {
en: 'Uruguay',
Expand Down Expand Up @@ -2226,6 +2302,15 @@ const countries: Array<CountryType> = [
iso: 'ZW',
continent: 'Africa',
},
{
i18n: {
en: 'Åland Islands',
nb: 'Åland',
},
cdc: '358',
iso: 'AX',
continent: 'Europe',
},
]

export default countries

0 comments on commit 2992084

Please sign in to comment.