react-country-kit-core 1.1.3 → 1.2.0

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 CHANGED
@@ -20,26 +20,32 @@ npm install react-country-kit-core
20
20
  ## 🛠 Utility Functions
21
21
 
22
22
  ### Localized Metadata
23
+
23
24
  Get labels and placeholders for billing/registration forms:
24
25
 
25
26
  ```tsx
26
- import {
27
- getTaxLabelByCountry,
28
- getTaxPlaceholderByCountry,
29
- getPostalLabelByCountry
30
- } from 'react-country-kit-core';
31
-
32
- const label = getTaxLabelByCountry('US'); // "EIN / SSN"
33
- const placeholder = getTaxPlaceholderByCountry('US'); // "00-0000000"
34
- const postalLabel = getPostalLabelByCountry('JP'); // "Postal Code (〒)"
27
+ import {
28
+ getTaxLabelByCountry,
29
+ getTaxPlaceholderByCountry,
30
+ getPostalLabelByCountry,
31
+ } from "react-country-kit-core";
32
+
33
+ const label = getTaxLabelByCountry("US"); // "EIN / SSN"
34
+ const placeholder = getTaxPlaceholderByCountry("US"); // "00-0000000"
35
+ const postalLabel = getPostalLabelByCountry("JP"); // "Postal Code (〒)"
35
36
  ```
36
37
 
37
38
  ### Data Retrieval
38
- ```tsx
39
- import { getAllCountries, getCountryByIso2, searchCountries } from 'react-country-kit-core';
40
39
 
41
- const usa = getCountryByIso2('US');
42
- const results = searchCountries('united');
40
+ ```tsx
41
+ import {
42
+ getAllCountries,
43
+ getCountryByIso2,
44
+ searchCountries,
45
+ } from "react-country-kit-core";
46
+
47
+ const usa = getCountryByIso2("US");
48
+ const results = searchCountries("united");
43
49
  ```
44
50
 
45
51
  ## 🧠 Headless Hooks
@@ -47,17 +53,23 @@ const results = searchCountries('united');
47
53
  Our hooks handle state, filtering, and interaction logic so you can focus on the UI:
48
54
 
49
55
  ```tsx
50
- import { useCountryPicker } from 'react-country-kit-core';
56
+ import { useCountryPicker } from "react-country-kit-core";
51
57
 
52
58
  function CustomPicker() {
53
- const { filteredItems, searchQuery, setSearchQuery, selectItem } = useCountryPicker();
54
-
59
+ const { filteredItems, searchQuery, setSearchQuery, selectItem } =
60
+ useCountryPicker();
61
+
55
62
  return (
56
63
  <div>
57
- <input value={searchQuery} onChange={(e) => setSearchQuery(e.target.value)} />
64
+ <input
65
+ value={searchQuery}
66
+ onChange={(e) => setSearchQuery(e.target.value)}
67
+ />
58
68
  <ul>
59
- {filteredItems.map(c => (
60
- <li key={c.iso2} onClick={() => selectItem(c)}>{c.name}</li>
69
+ {filteredItems.map((c) => (
70
+ <li key={c.iso2} onClick={() => selectItem(c)}>
71
+ {c.name}
72
+ </li>
61
73
  ))}
62
74
  </ul>
63
75
  </div>
@@ -73,6 +85,7 @@ export interface Country {
73
85
  iso2: string;
74
86
  iso3: string;
75
87
  phone_code: string;
88
+ division_type: string;
76
89
  flag: string;
77
90
  flag_url: string;
78
91
  currency_code: string;
package/dist/index.d.ts CHANGED
@@ -5,11 +5,7 @@ export declare interface Country {
5
5
  iso2: string;
6
6
  iso3: string;
7
7
  phone_code: string;
8
- phone_format?: PhoneFormat;
9
- currency?: Currency;
10
8
  division_type: string;
11
- divisions?: Division[];
12
- timezones?: Timezone[];
13
9
  /** Emoji flag computed from iso2 */
14
10
  flag: string;
15
11
  /** SVG/Image URL for the country flag */
@@ -19,11 +15,11 @@ export declare interface Country {
19
15
  /** Default currency code for the country */
20
16
  currency_code: string;
21
17
  /** Label for tax identification number (e.g. "VAT", "SSN", "ABN") */
22
- tax_id_label?: string;
18
+ tax_id_label: string;
23
19
  /** Placeholder for tax identification number */
24
- tax_id_placeholder?: string;
20
+ tax_id_placeholder: string;
25
21
  /** Label for postal/zip code (e.g. "ZIP Code", "Postcode", "PIN Code") */
26
- postal_code_label?: string;
22
+ postal_code_label: string;
27
23
  }
28
24
 
29
25
  export declare interface CountryMultiSelectProps {
@@ -243,7 +239,6 @@ export declare interface LanguagePickerProps {
243
239
  export declare const PHONE_FORMATS: PhoneFormat[];
244
240
 
245
241
  export declare interface PhoneFormat {
246
- countryCode?: string;
247
242
  iso2: string;
248
243
  dialCode: string;
249
244
  patterns: string;
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "react-country-kit-core",
3
- "version": "1.1.3",
3
+ "version": "1.2.0",
4
+ "type": "module",
4
5
  "description": "Core datasets, utilities, and hooks for react-country-kit. Comprehensive data for countries, currencies, timezones, languages, and divisions.",
5
6
  "author": "Kishor Mainali",
6
7
  "license": "MIT",