react-country-kit 1.0.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 +258 -0
- package/dist/components/CountryMultiSelect/CountryMultiSelect.d.ts +3 -0
- package/dist/components/CountryPicker/CountryPicker.d.ts +3 -0
- package/dist/components/CurrencyMultiSelect/CurrencyMultiSelect.d.ts +3 -0
- package/dist/components/CurrencyPicker/CurrencyPicker.d.ts +3 -0
- package/dist/components/DivisionPicker/DivisionPicker.d.ts +3 -0
- package/dist/components/LanguagePicker/LanguagePicker.d.ts +3 -0
- package/dist/components/PhoneInput/PhoneInput.d.ts +3 -0
- package/dist/components/TimezonePicker/TimezonePicker.d.ts +3 -0
- package/dist/components/shared/PickerBase.d.ts +14 -0
- package/dist/components/shared/SearchInput.d.ts +8 -0
- package/dist/data/countries.d.ts +10 -0
- package/dist/data/languages.d.ts +3 -0
- package/dist/hooks/useBasePicker.d.ts +6 -0
- package/dist/hooks/useCountryPicker.d.ts +2 -0
- package/dist/hooks/useCurrencyPicker.d.ts +2 -0
- package/dist/hooks/useDivisionPicker.d.ts +2 -0
- package/dist/hooks/useLanguagePicker.d.ts +2 -0
- package/dist/hooks/useMultiSelect.d.ts +6 -0
- package/dist/hooks/usePhoneInput.d.ts +17 -0
- package/dist/hooks/useTimezonePicker.d.ts +2 -0
- package/dist/index.d.ts +21 -0
- package/dist/react-country-kit.cjs.js +2 -0
- package/dist/react-country-kit.cjs.js.map +1 -0
- package/dist/react-country-kit.d.ts +354 -0
- package/dist/react-country-kit.es.js +841 -0
- package/dist/react-country-kit.es.js.map +1 -0
- package/dist/style.css +1 -0
- package/dist/types/index.d.ts +185 -0
- package/dist/ui/components/CountryMultiSelect.d.ts +2 -0
- package/dist/ui/components/CountryPicker.d.ts +2 -0
- package/dist/ui/components/CurrencyMultiSelect.d.ts +2 -0
- package/dist/ui/components/CurrencyPicker.d.ts +2 -0
- package/dist/ui/components/DivisionPicker.d.ts +2 -0
- package/dist/ui/components/LanguagePicker.d.ts +2 -0
- package/dist/ui/components/PhoneInput.d.ts +3 -0
- package/dist/ui/components/TimezonePicker.d.ts +2 -0
- package/dist/ui/components/primitives.d.ts +73 -0
- package/dist/ui/index.d.ts +38 -0
- package/dist/ui/lib/utils.d.ts +6 -0
- package/dist/ui.cjs.js +2 -0
- package/dist/ui.cjs.js.map +1 -0
- package/dist/ui.d.ts +413 -0
- package/dist/ui.es.js +1141 -0
- package/dist/ui.es.js.map +1 -0
- package/dist/useTimezonePicker-BMFPsn3E.mjs +36086 -0
- package/dist/useTimezonePicker-BMFPsn3E.mjs.map +1 -0
- package/dist/useTimezonePicker-zHCM2pUC.js +2 -0
- package/dist/useTimezonePicker-zHCM2pUC.js.map +1 -0
- package/dist/utils/countries.d.ts +46 -0
- package/dist/utils/currencies.d.ts +13 -0
- package/dist/utils/languages.d.ts +13 -0
- package/dist/utils/timezones.d.ts +13 -0
- package/package.json +88 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Country, Currency, Division, Timezone } from '../types';
|
|
2
|
+
import { iso2ToFlag as _iso2ToFlag } from '../data/countries';
|
|
3
|
+
/**
|
|
4
|
+
* Convert ISO2 code to emoji flag
|
|
5
|
+
* Re-exported from the generated data module.
|
|
6
|
+
*/
|
|
7
|
+
export { _iso2ToFlag as iso2ToFlag };
|
|
8
|
+
/**
|
|
9
|
+
* Returns all countries
|
|
10
|
+
*/
|
|
11
|
+
export declare function getAllCountries(): Country[];
|
|
12
|
+
/**
|
|
13
|
+
* Find a country by its ISO2 code (case-insensitive)
|
|
14
|
+
*/
|
|
15
|
+
export declare function getCountryByIso2(iso2: string): Country | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Find a country by its ISO3 code (case-insensitive)
|
|
18
|
+
*/
|
|
19
|
+
export declare function getCountryByIso3(iso3: string): Country | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Find a country by its name (partial, case-insensitive)
|
|
22
|
+
*/
|
|
23
|
+
export declare function getCountryByName(name: string): Country | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Search countries by name, iso2, iso3 or phone code
|
|
26
|
+
*/
|
|
27
|
+
export declare function searchCountries(query: string): Country[];
|
|
28
|
+
/**
|
|
29
|
+
* Get all divisions for a country
|
|
30
|
+
*/
|
|
31
|
+
export declare function getDivisionsByCountry(iso2: string): Division[];
|
|
32
|
+
/**
|
|
33
|
+
* Get all timezones for a country
|
|
34
|
+
*/
|
|
35
|
+
export declare function getTimezonesByCountry(iso2: string): Timezone[];
|
|
36
|
+
/**
|
|
37
|
+
* Get the currency of a country
|
|
38
|
+
*/
|
|
39
|
+
export declare function getCurrencyByCountry(iso2: string): Currency | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Get the min and max phone number lengths for a country
|
|
42
|
+
*/
|
|
43
|
+
export declare function getPhoneLengths(iso2: string): {
|
|
44
|
+
min?: number;
|
|
45
|
+
max?: number;
|
|
46
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Currency } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Returns all unique currencies across all countries
|
|
4
|
+
*/
|
|
5
|
+
export declare function getAllCurrencies(): Currency[];
|
|
6
|
+
/**
|
|
7
|
+
* Find a currency by its code (e.g. "USD")
|
|
8
|
+
*/
|
|
9
|
+
export declare function getCurrencyByCode(code: string): Currency | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Search currencies by code, name, or symbol
|
|
12
|
+
*/
|
|
13
|
+
export declare function searchCurrencies(query: string, countryIso2?: string): Currency[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Language } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Returns all languages
|
|
4
|
+
*/
|
|
5
|
+
export declare function getAllLanguages(): Language[];
|
|
6
|
+
/**
|
|
7
|
+
* Find a language by its BCP-47 code
|
|
8
|
+
*/
|
|
9
|
+
export declare function getLanguageByCode(code: string): Language | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Search languages by english name, native name, or code
|
|
12
|
+
*/
|
|
13
|
+
export declare function searchLanguages(query: string): Language[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Timezone } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Returns all unique timezones across all countries
|
|
4
|
+
*/
|
|
5
|
+
export declare function getAllTimezones(): Timezone[];
|
|
6
|
+
/**
|
|
7
|
+
* Find a timezone by its IANA name (e.g. "America/New_York")
|
|
8
|
+
*/
|
|
9
|
+
export declare function getTimezoneByName(name: string): Timezone | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Search timezones by name, abbreviation, or offset string
|
|
12
|
+
*/
|
|
13
|
+
export declare function searchTimezones(query: string, countryIso2?: string): Timezone[];
|
package/package.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-country-kit",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A comprehensive React component library for country, currency, timezone, language, and division picking. Supports both vanilla CSS and shadcn/Tailwind CSS variants.",
|
|
5
|
+
"author": "Kishor Mainali",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"react",
|
|
9
|
+
"country-picker",
|
|
10
|
+
"currency-picker",
|
|
11
|
+
"timezone-picker",
|
|
12
|
+
"language-picker",
|
|
13
|
+
"division-picker",
|
|
14
|
+
"country",
|
|
15
|
+
"currency",
|
|
16
|
+
"timezone",
|
|
17
|
+
"shadcn",
|
|
18
|
+
"tailwindcss",
|
|
19
|
+
"radix-ui"
|
|
20
|
+
],
|
|
21
|
+
"main": "dist/react-country-kit.cjs.js",
|
|
22
|
+
"module": "dist/react-country-kit.es.js",
|
|
23
|
+
"types": "dist/react-country-kit.d.ts",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"import": "./dist/react-country-kit.es.js",
|
|
27
|
+
"require": "./dist/react-country-kit.cjs.js",
|
|
28
|
+
"types": "./dist/react-country-kit.d.ts"
|
|
29
|
+
},
|
|
30
|
+
"./ui": {
|
|
31
|
+
"import": "./dist/ui.es.js",
|
|
32
|
+
"require": "./dist/ui.cjs.js",
|
|
33
|
+
"types": "./dist/ui.d.ts"
|
|
34
|
+
},
|
|
35
|
+
"./styles": "./dist/style.css"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist"
|
|
39
|
+
],
|
|
40
|
+
"sideEffects": [
|
|
41
|
+
"*.css"
|
|
42
|
+
],
|
|
43
|
+
"scripts": {
|
|
44
|
+
"dev": "vite",
|
|
45
|
+
"build": "vite build",
|
|
46
|
+
"build:types": "tsc --emitDeclarationOnly",
|
|
47
|
+
"preview": "vite preview",
|
|
48
|
+
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"@radix-ui/react-popover": ">=1.0.0",
|
|
52
|
+
"class-variance-authority": ">=0.7.0",
|
|
53
|
+
"clsx": ">=2.0.0",
|
|
54
|
+
"react": ">=17.0.0",
|
|
55
|
+
"react-dom": ">=17.0.0",
|
|
56
|
+
"tailwind-merge": ">=2.0.0"
|
|
57
|
+
},
|
|
58
|
+
"peerDependenciesMeta": {
|
|
59
|
+
"@radix-ui/react-popover": {
|
|
60
|
+
"optional": true
|
|
61
|
+
},
|
|
62
|
+
"tailwind-merge": {
|
|
63
|
+
"optional": true
|
|
64
|
+
},
|
|
65
|
+
"clsx": {
|
|
66
|
+
"optional": true
|
|
67
|
+
},
|
|
68
|
+
"class-variance-authority": {
|
|
69
|
+
"optional": true
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"devDependencies": {
|
|
73
|
+
"@radix-ui/react-popover": "^1.1.0",
|
|
74
|
+
"@types/node": "^25.6.0",
|
|
75
|
+
"@types/react": "^18.2.0",
|
|
76
|
+
"@types/react-dom": "^18.2.0",
|
|
77
|
+
"@vitejs/plugin-react": "^4.2.0",
|
|
78
|
+
"class-variance-authority": "^0.7.0",
|
|
79
|
+
"clsx": "^2.1.0",
|
|
80
|
+
"tailwind-merge": "^2.3.0",
|
|
81
|
+
"typescript": "^5.2.2",
|
|
82
|
+
"vite": "^5.0.0",
|
|
83
|
+
"vite-plugin-dts": "^3.7.0"
|
|
84
|
+
},
|
|
85
|
+
"dependencies": {
|
|
86
|
+
"libphonenumber-js": "^1.12.42"
|
|
87
|
+
}
|
|
88
|
+
}
|