react-country-kit-core 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,18 +1,67 @@
|
|
|
1
|
-
#
|
|
1
|
+
# react-country-kit-core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The engine behind `react-country-kit`. This package provides all the data, hooks, and utilities needed to build your own custom country-related UI components.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- **
|
|
8
|
-
- **
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
7
|
+
- **250+ Countries**: Comprehensive dataset with ISO codes (2 & 3), flags, and phone codes.
|
|
8
|
+
- **Administrative Divisions**: State/Province data for major countries.
|
|
9
|
+
- **Currencies & Timezones**: Linked data for every country.
|
|
10
|
+
- **Native Language Support**: English and Native names for languages.
|
|
11
|
+
- **Headless Hooks**: Logic-only hooks (`useCountryPicker`, `usePhoneInput`, etc.) for building custom UI.
|
|
12
|
+
- **Phone Formatting**: Integrated `libphonenumber-js` for accurate phone number handling.
|
|
11
13
|
|
|
12
14
|
## Installation
|
|
13
15
|
|
|
14
16
|
```bash
|
|
15
|
-
npm install
|
|
17
|
+
npm install react-country-kit-core
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Available Hooks
|
|
21
|
+
|
|
22
|
+
### `useCountryPicker(initialValue?, onChange?)`
|
|
23
|
+
|
|
24
|
+
Manages country selection and searching.
|
|
25
|
+
|
|
26
|
+
### `usePhoneInput(initialValue?, onChange?, defaultCountryIso2?)`
|
|
27
|
+
|
|
28
|
+
Handles complex phone number input logic, including country switching and validation.
|
|
29
|
+
|
|
30
|
+
### `useDivisionPicker(countryIso2, initialValue?, onChange?)`
|
|
31
|
+
|
|
32
|
+
Manages state/province selection for a specific country.
|
|
33
|
+
|
|
34
|
+
### `useCurrencyPicker(initialValue?, onChange?)`
|
|
35
|
+
|
|
36
|
+
Manages currency selection.
|
|
37
|
+
|
|
38
|
+
### `useTimezonePicker(initialValue?, onChange?, countryIso2?)`
|
|
39
|
+
|
|
40
|
+
Manages timezone selection, optionally filtered by country.
|
|
41
|
+
|
|
42
|
+
## Utility Functions
|
|
43
|
+
|
|
44
|
+
- `getAllCountries()`
|
|
45
|
+
- `getCountryByIso2(iso2)`
|
|
46
|
+
- `getDivisionsByCountry(iso2)`
|
|
47
|
+
- `getTimezonesByCountry(iso2)`
|
|
48
|
+
- `searchCountries(query)`
|
|
49
|
+
- ...and many more.
|
|
50
|
+
|
|
51
|
+
## Data Structure
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
export interface Country {
|
|
55
|
+
name: string;
|
|
56
|
+
iso2: string;
|
|
57
|
+
iso3: string;
|
|
58
|
+
phone_code: string;
|
|
59
|
+
flag: string;
|
|
60
|
+
flag_url: string;
|
|
61
|
+
currency_code: string;
|
|
62
|
+
language_code: string;
|
|
63
|
+
division_type: string;
|
|
64
|
+
}
|
|
16
65
|
```
|
|
17
66
|
|
|
18
67
|
## License
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-country-kit-core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Core datasets, utilities, and hooks for react-country-kit. Comprehensive data for countries, currencies, timezones, languages, and divisions.",
|
|
5
5
|
"author": "Kishor Mainali",
|
|
6
6
|
"license": "MIT",
|