react-country-kit 1.0.0 → 1.1.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.
Files changed (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +20 -235
  3. package/dist/components/CountryMultiSelect/CountryMultiSelect.d.ts +2 -2
  4. package/dist/components/CountryPicker/CountryPicker.d.ts +2 -2
  5. package/dist/components/CurrencyMultiSelect/CurrencyMultiSelect.d.ts +2 -2
  6. package/dist/components/CurrencyPicker/CurrencyPicker.d.ts +2 -2
  7. package/dist/components/DivisionPicker/DivisionPicker.d.ts +2 -2
  8. package/dist/components/LanguagePicker/LanguagePicker.d.ts +2 -2
  9. package/dist/components/PhoneInput/PhoneInput.d.ts +2 -2
  10. package/dist/components/TimezonePicker/TimezonePicker.d.ts +2 -2
  11. package/dist/components/shared/Flag.d.ts +15 -0
  12. package/dist/components/shared/PickerBase.d.ts +2 -1
  13. package/dist/index.d.ts +1 -13
  14. package/dist/react-country-kit.cjs.js +1 -1
  15. package/dist/react-country-kit.cjs.js.map +1 -1
  16. package/dist/react-country-kit.d.ts +1 -354
  17. package/dist/react-country-kit.es.js +354 -362
  18. package/dist/react-country-kit.es.js.map +1 -1
  19. package/dist/style.css +1 -1
  20. package/dist/ui/components/CountryMultiSelect.d.ts +2 -1
  21. package/dist/ui/components/CountryPicker.d.ts +2 -1
  22. package/dist/ui/components/CurrencyMultiSelect.d.ts +2 -1
  23. package/dist/ui/components/CurrencyPicker.d.ts +2 -1
  24. package/dist/ui/components/DivisionPicker.d.ts +2 -1
  25. package/dist/ui/components/LanguagePicker.d.ts +2 -1
  26. package/dist/ui/components/PhoneInput.d.ts +3 -3
  27. package/dist/ui/components/TimezonePicker.d.ts +2 -1
  28. package/dist/ui/components/primitives.d.ts +11 -1
  29. package/dist/ui/index.d.ts +12 -12
  30. package/dist/ui/lib/utils.d.ts +2 -1
  31. package/dist/ui.cjs.js +1 -1
  32. package/dist/ui.cjs.js.map +1 -1
  33. package/dist/ui.d.ts +1 -413
  34. package/dist/ui.es.js +370 -350
  35. package/dist/ui.es.js.map +1 -1
  36. package/package.json +11 -2
  37. package/dist/data/countries.d.ts +0 -10
  38. package/dist/data/languages.d.ts +0 -3
  39. package/dist/hooks/useBasePicker.d.ts +0 -6
  40. package/dist/hooks/useCountryPicker.d.ts +0 -2
  41. package/dist/hooks/useCurrencyPicker.d.ts +0 -2
  42. package/dist/hooks/useDivisionPicker.d.ts +0 -2
  43. package/dist/hooks/useLanguagePicker.d.ts +0 -2
  44. package/dist/hooks/useMultiSelect.d.ts +0 -6
  45. package/dist/hooks/usePhoneInput.d.ts +0 -17
  46. package/dist/hooks/useTimezonePicker.d.ts +0 -2
  47. package/dist/types/index.d.ts +0 -185
  48. package/dist/useTimezonePicker-BMFPsn3E.mjs +0 -36086
  49. package/dist/useTimezonePicker-BMFPsn3E.mjs.map +0 -1
  50. package/dist/useTimezonePicker-zHCM2pUC.js +0 -2
  51. package/dist/useTimezonePicker-zHCM2pUC.js.map +0 -1
  52. package/dist/utils/countries.d.ts +0 -46
  53. package/dist/utils/currencies.d.ts +0 -13
  54. package/dist/utils/languages.d.ts +0 -13
  55. package/dist/utils/timezones.d.ts +0 -13
@@ -1,185 +0,0 @@
1
- export interface PhoneFormat {
2
- countryCode?: string;
3
- iso2: string;
4
- dialCode: string;
5
- patterns: string;
6
- possibleLengths: string;
7
- example: string | number;
8
- }
9
- export interface Currency {
10
- code: string;
11
- name: string;
12
- symbol: string;
13
- }
14
- export interface Timezone {
15
- name: string;
16
- offset: number;
17
- offset_name: string;
18
- abbreviation: string;
19
- tzName: string;
20
- }
21
- export interface Division {
22
- name: string;
23
- iso2: string;
24
- timezone: string;
25
- }
26
- export interface Country {
27
- name: string;
28
- iso2: string;
29
- iso3: string;
30
- phone_code: string;
31
- phone_format: PhoneFormat;
32
- currency: Currency;
33
- division_type: string;
34
- divisions: Division[];
35
- timezones: Timezone[];
36
- /** Emoji flag computed from iso2 */
37
- flag: string;
38
- }
39
- export interface Language {
40
- code: string;
41
- english_name: string;
42
- native_name: string;
43
- }
44
- export interface CountryPickerProps {
45
- /** Currently selected country */
46
- value?: Country | null;
47
- /** Callback when user selects a country */
48
- onChange: (country: Country) => void;
49
- placeholder?: string;
50
- /** Enable search input */
51
- searchable?: boolean;
52
- /** Show emoji flag next to country name */
53
- showFlag?: boolean;
54
- /** Show phone dial code */
55
- showPhoneCode?: boolean;
56
- /** Disable the picker */
57
- disabled?: boolean;
58
- /** Additional wrapper class */
59
- className?: string;
60
- /** aria-label */
61
- label?: string;
62
- }
63
- export interface CurrencyPickerProps {
64
- value?: Currency | null;
65
- onChange: (currency: Currency) => void;
66
- placeholder?: string;
67
- searchable?: boolean;
68
- /** Filter currencies to a specific country (iso2) and enable auto-selection */
69
- countryIso2?: string;
70
- /** Auto-select the first currency if countryIso2 is provided. Defaults to true if countryIso2 is present and value is empty. */
71
- autoSelect?: boolean;
72
- /** Show currency symbol alongside code */
73
- showSymbol?: boolean;
74
- disabled?: boolean;
75
- className?: string;
76
- label?: string;
77
- }
78
- export interface TimezonePickerProps {
79
- value?: Timezone | null;
80
- onChange: (timezone: Timezone) => void;
81
- placeholder?: string;
82
- searchable?: boolean;
83
- /** Filter timezones to a specific country (iso2) and enable auto-selection */
84
- countryIso2?: string;
85
- /** Auto-select the first timezone if countryIso2 is provided. Defaults to true if countryIso2 is present and value is empty. */
86
- autoSelect?: boolean;
87
- disabled?: boolean;
88
- className?: string;
89
- label?: string;
90
- }
91
- export interface LanguagePickerProps {
92
- value?: Language | null;
93
- onChange: (language: Language) => void;
94
- placeholder?: string;
95
- searchable?: boolean;
96
- /** Show native language name alongside english name */
97
- showNativeName?: boolean;
98
- disabled?: boolean;
99
- className?: string;
100
- label?: string;
101
- }
102
- export interface DivisionPickerProps {
103
- /** ISO2 code of the parent country (required) */
104
- countryIso2: string;
105
- value?: Division | null;
106
- onChange: (division: Division) => void;
107
- placeholder?: string;
108
- searchable?: boolean;
109
- disabled?: boolean;
110
- className?: string;
111
- label?: string;
112
- }
113
- export interface UsePickerReturn<T> {
114
- isOpen: boolean;
115
- searchQuery: string;
116
- filteredItems: T[];
117
- selectedItem: T | null;
118
- open: () => void;
119
- close: () => void;
120
- toggle: () => void;
121
- setSearchQuery: (query: string) => void;
122
- selectItem: (item: T) => void;
123
- clearSelection: () => void;
124
- }
125
- /**
126
- * Value object returned by PhoneInput.
127
- */
128
- export interface PhoneValue {
129
- /** Full Country object of the selected country */
130
- country: Country;
131
- /** Dial code with + prefix, e.g. "+1" */
132
- dialCode: string;
133
- /** Raw phone number without dial code, e.g. "4155551234" */
134
- number: string;
135
- /** Full number with dial code, e.g. "+14155551234" */
136
- full: string;
137
- }
138
- export interface PhoneInputProps {
139
- value?: PhoneValue | null;
140
- onChange: (value: PhoneValue) => void;
141
- /** Pre-select a country by ISO2 on first render */
142
- defaultCountryIso2?: string;
143
- placeholder?: string;
144
- showFlag?: boolean;
145
- disabled?: boolean;
146
- className?: string;
147
- label?: string;
148
- }
149
- export interface CountryMultiSelectProps {
150
- value: Country[];
151
- onChange: (countries: Country[]) => void;
152
- placeholder?: string;
153
- /** Maximum number of selections (undefined = unlimited) */
154
- maxItems?: number;
155
- showFlags?: boolean;
156
- searchable?: boolean;
157
- disabled?: boolean;
158
- className?: string;
159
- label?: string;
160
- }
161
- export interface CurrencyMultiSelectProps {
162
- value: Currency[];
163
- onChange: (currencies: Currency[]) => void;
164
- placeholder?: string;
165
- maxItems?: number;
166
- showSymbol?: boolean;
167
- searchable?: boolean;
168
- disabled?: boolean;
169
- className?: string;
170
- label?: string;
171
- }
172
- export interface UseMultiSelectReturn<T> {
173
- isOpen: boolean;
174
- searchQuery: string;
175
- filteredItems: T[];
176
- selectedItems: T[];
177
- open: () => void;
178
- close: () => void;
179
- toggle: () => void;
180
- setSearchQuery: (query: string) => void;
181
- toggleItem: (item: T) => void;
182
- isSelected: (item: T) => boolean;
183
- removeItem: (item: T) => void;
184
- clearAll: () => void;
185
- }