Skip to content

Commit

Permalink
feat: new country question
Browse files Browse the repository at this point in the history
  • Loading branch information
inigomarquinez committed Feb 28, 2024
1 parent 84f6dc4 commit 246aa4a
Show file tree
Hide file tree
Showing 16 changed files with 431 additions and 3,086 deletions.
64 changes: 62 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ Reminder: A custom link it will be indicated by the start of a '#' in the markdo
https://user-images.githubusercontent.com/79102959/134894112-e4f38ced-0992-428c-95c3-bcdce20cd858.mp4



## Country
| Option | Description | Type | Default |
|--- |--- |:---: |:---: |
Expand Down Expand Up @@ -172,7 +171,7 @@ Reminder: the 'countryAndRegions' prop that can be sent in the ReactFormBuilder
```

### Custom list country example:
```yaml
```json
{
{
countryName: 'MyOwnCountry1',
Expand Down Expand Up @@ -212,6 +211,67 @@ https://user-images.githubusercontent.com/79102959/134897712-95e4391c-cfbb-42cd-







## Country v2

| Option | Description | Type | Default |
| ------ | ----------- | :---: | :---: |
| name* | Country component name | string | |
| type* | Must be `country_v2` | string | |
| label | Text shown over the country question | string | '' |
| placeholder | Placeholder displayed in the select | string | '' |
| **config** | See table below | json | {} |
| **errorMessages** | Validation errors | json | {} |
| **registerConfig** | Validation rules | json | {} |

### **config** options

| Option | Description | Type | Default |
| ------ | ----------- | :---: | :---: |
| whitelist | List of ISO 3166-1 alpha-2 codes of the countries allowed in the list. This is mutually exclusive with `blacklist` and `whitelist`takes precedence. | string[] | [] |
| blacklist | List of ISO 3166-1 alpha-2 codes of the countries not allowed in the list. This is mutually exclusive with `whitelist` and `whitelist`takes precedence. | string[] | [] |
| priorityOptions | List of ISO 3166-1 alpha-2 codes of the countries to be displayed first in the list. Ex: ['GB', 'ES'] | string[] | [] |
| language | ISO 639-1 code of the language to display countries names. [Available laguages](https://github.com/michaelwittig/node-i18n-iso-countries?tab=readme-ov-file#supported-languages-iso-639-1) | string | en |

### Country v2 example:

```json
{
"name": "country_of_residence",
"placeholder": "Select your country of residence",
"type": "country_v2",
"label": "Country of residence",
"errorMessages": {
"required": "This field is required"
},
"registerConfig": {
"required": true
},
"config": {
"whitelist": [
"DE",
"ES",
"FR",
"IT",
"PT"
],
"priorityOptions": [
"ES",
"PT"
]
}
}
```







## Date
| Option | Description | Type | Default |
|--- |--- |:---: |:---: |
Expand Down
Loading

0 comments on commit 246aa4a

Please sign in to comment.