@kaisarsofi/react-native-phone-input 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.
Files changed (91) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +467 -0
  3. package/lib/commonjs/CountryPicker.js +669 -0
  4. package/lib/commonjs/CountryPicker.js.map +1 -0
  5. package/lib/commonjs/Flag.js +23 -0
  6. package/lib/commonjs/Flag.js.map +1 -0
  7. package/lib/commonjs/PhoneInput.js +252 -0
  8. package/lib/commonjs/PhoneInput.js.map +1 -0
  9. package/lib/commonjs/countries.js +75 -0
  10. package/lib/commonjs/countries.js.map +1 -0
  11. package/lib/commonjs/data/countries.json +1472 -0
  12. package/lib/commonjs/index.js +71 -0
  13. package/lib/commonjs/index.js.map +1 -0
  14. package/lib/commonjs/package.json +1 -0
  15. package/lib/commonjs/safeArea.js +44 -0
  16. package/lib/commonjs/safeArea.js.map +1 -0
  17. package/lib/commonjs/theme.js +85 -0
  18. package/lib/commonjs/theme.js.map +1 -0
  19. package/lib/commonjs/types.js +6 -0
  20. package/lib/commonjs/types.js.map +1 -0
  21. package/lib/commonjs/value.js +68 -0
  22. package/lib/commonjs/value.js.map +1 -0
  23. package/lib/module/CountryPicker.js +665 -0
  24. package/lib/module/CountryPicker.js.map +1 -0
  25. package/lib/module/Flag.js +19 -0
  26. package/lib/module/Flag.js.map +1 -0
  27. package/lib/module/PhoneInput.js +248 -0
  28. package/lib/module/PhoneInput.js.map +1 -0
  29. package/lib/module/countries.js +65 -0
  30. package/lib/module/countries.js.map +1 -0
  31. package/lib/module/data/countries.json +1472 -0
  32. package/lib/module/index.js +8 -0
  33. package/lib/module/index.js.map +1 -0
  34. package/lib/module/package.json +1 -0
  35. package/lib/module/safeArea.js +39 -0
  36. package/lib/module/safeArea.js.map +1 -0
  37. package/lib/module/theme.js +81 -0
  38. package/lib/module/theme.js.map +1 -0
  39. package/lib/module/types.js +4 -0
  40. package/lib/module/types.js.map +1 -0
  41. package/lib/module/value.js +62 -0
  42. package/lib/module/value.js.map +1 -0
  43. package/lib/typescript/commonjs/package.json +1 -0
  44. package/lib/typescript/commonjs/src/CountryPicker.d.ts +37 -0
  45. package/lib/typescript/commonjs/src/CountryPicker.d.ts.map +1 -0
  46. package/lib/typescript/commonjs/src/Flag.d.ts +10 -0
  47. package/lib/typescript/commonjs/src/Flag.d.ts.map +1 -0
  48. package/lib/typescript/commonjs/src/PhoneInput.d.ts +3 -0
  49. package/lib/typescript/commonjs/src/PhoneInput.d.ts.map +1 -0
  50. package/lib/typescript/commonjs/src/countries.d.ts +28 -0
  51. package/lib/typescript/commonjs/src/countries.d.ts.map +1 -0
  52. package/lib/typescript/commonjs/src/index.d.ts +9 -0
  53. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  54. package/lib/typescript/commonjs/src/safeArea.d.ts +11 -0
  55. package/lib/typescript/commonjs/src/safeArea.d.ts.map +1 -0
  56. package/lib/typescript/commonjs/src/theme.d.ts +53 -0
  57. package/lib/typescript/commonjs/src/theme.d.ts.map +1 -0
  58. package/lib/typescript/commonjs/src/types.d.ts +211 -0
  59. package/lib/typescript/commonjs/src/types.d.ts.map +1 -0
  60. package/lib/typescript/commonjs/src/value.d.ts +22 -0
  61. package/lib/typescript/commonjs/src/value.d.ts.map +1 -0
  62. package/lib/typescript/module/package.json +1 -0
  63. package/lib/typescript/module/src/CountryPicker.d.ts +37 -0
  64. package/lib/typescript/module/src/CountryPicker.d.ts.map +1 -0
  65. package/lib/typescript/module/src/Flag.d.ts +10 -0
  66. package/lib/typescript/module/src/Flag.d.ts.map +1 -0
  67. package/lib/typescript/module/src/PhoneInput.d.ts +3 -0
  68. package/lib/typescript/module/src/PhoneInput.d.ts.map +1 -0
  69. package/lib/typescript/module/src/countries.d.ts +28 -0
  70. package/lib/typescript/module/src/countries.d.ts.map +1 -0
  71. package/lib/typescript/module/src/index.d.ts +9 -0
  72. package/lib/typescript/module/src/index.d.ts.map +1 -0
  73. package/lib/typescript/module/src/safeArea.d.ts +11 -0
  74. package/lib/typescript/module/src/safeArea.d.ts.map +1 -0
  75. package/lib/typescript/module/src/theme.d.ts +53 -0
  76. package/lib/typescript/module/src/theme.d.ts.map +1 -0
  77. package/lib/typescript/module/src/types.d.ts +211 -0
  78. package/lib/typescript/module/src/types.d.ts.map +1 -0
  79. package/lib/typescript/module/src/value.d.ts +22 -0
  80. package/lib/typescript/module/src/value.d.ts.map +1 -0
  81. package/package.json +215 -0
  82. package/src/CountryPicker.tsx +805 -0
  83. package/src/Flag.tsx +17 -0
  84. package/src/PhoneInput.tsx +363 -0
  85. package/src/countries.ts +95 -0
  86. package/src/data/countries.json +1472 -0
  87. package/src/index.tsx +21 -0
  88. package/src/safeArea.ts +50 -0
  89. package/src/theme.ts +112 -0
  90. package/src/types.ts +229 -0
  91. package/src/value.ts +70 -0
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ export { COUNTRIES, getCountryByCode, groupCountriesByLetter, sectionLetterFor } from "./countries.js";
4
+ export { Flag } from "./Flag.js";
5
+ export { PhoneInput } from "./PhoneInput.js";
6
+ export { CountryPicker } from "./CountryPicker.js";
7
+ export { LIGHT_PALETTE, DARK_PALETTE, usePhoneInputPalette } from "./theme.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["COUNTRIES","getCountryByCode","groupCountriesByLetter","sectionLetterFor","Flag","PhoneInput","CountryPicker","LIGHT_PALETTE","DARK_PALETTE","usePhoneInputPalette"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SACEA,SAAS,EACTC,gBAAgB,EAChBC,sBAAsB,EACtBC,gBAAgB,QACX,gBAAa;AAEpB,SAASC,IAAI,QAAQ,WAAQ;AAC7B,SAASC,UAAU,QAAQ,iBAAc;AACzC,SAASC,aAAa,QAAQ,oBAAiB;AAC/C,SAASC,aAAa,EAAEC,YAAY,EAAEC,oBAAoB,QAAQ,YAAS","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ import { createContext, useContext } from 'react';
4
+ /**
5
+ * `react-native-safe-area-context` is an *optional* peer: this library ships no
6
+ * native modules, so it is never installed on our account. The guarded require
7
+ * is what makes that safe — Metro registers a `require` inside a try/catch as
8
+ * an optional dependency and emits a runtime throw instead of failing the
9
+ * build (`allowOptionalDependencies`, enabled by default in both
10
+ * `@expo/metro-config` and `@react-native/metro-config`). The catch also covers
11
+ * bundlers that hand the ESM build a scope with no `require` at all.
12
+ */
13
+ let optionalModule = null;
14
+ try {
15
+ optionalModule = require('react-native-safe-area-context');
16
+ } catch {
17
+ optionalModule = null;
18
+ }
19
+ const FallbackContext = /*#__PURE__*/createContext(null);
20
+
21
+ /**
22
+ * Deliberately the *context* rather than `useSafeAreaInsets()`: that hook
23
+ * throws when no `SafeAreaProvider` is mounted above it, and plenty of apps
24
+ * carry the package transitively (React Navigation depends on it) without a
25
+ * provider in scope. Reading the context degrades to `null` instead.
26
+ *
27
+ * Resolved once at module scope so the identity is stable, which keeps the
28
+ * `useContext` call below an unconditional, rules-of-hooks-safe one.
29
+ */
30
+ const InsetsContext = optionalModule?.SafeAreaInsetsContext ?? FallbackContext;
31
+
32
+ /** The ambient safe-area insets, or null when unavailable. */
33
+ export function useOptionalSafeAreaInsets() {
34
+ return useContext(InsetsContext);
35
+ }
36
+
37
+ /** Whether the optional peer resolved. Exported for diagnostics and tests. */
38
+ export const hasSafeAreaContext = optionalModule?.SafeAreaInsetsContext != null;
39
+ //# sourceMappingURL=safeArea.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createContext","useContext","optionalModule","require","FallbackContext","InsetsContext","SafeAreaInsetsContext","useOptionalSafeAreaInsets","hasSafeAreaContext"],"sourceRoot":"../../src","sources":["safeArea.ts"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,UAAU,QAAsB,OAAO;AAa/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,cAAqC,GAAG,IAAI;AAChD,IAAI;EACFA,cAAc,GAAGC,OAAO,CAAC,gCAAgC,CAAmB;AAC9E,CAAC,CAAC,MAAM;EACND,cAAc,GAAG,IAAI;AACvB;AAEA,MAAME,eAAe,gBAAGJ,aAAa,CAAoB,IAAI,CAAC;;AAE9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMK,aAAyC,GAC7CH,cAAc,EAAEI,qBAAqB,IAAIF,eAAe;;AAE1D;AACA,OAAO,SAASG,yBAAyBA,CAAA,EAAsB;EAC7D,OAAON,UAAU,CAACI,aAAa,CAAC;AAClC;;AAEA;AACA,OAAO,MAAMG,kBAAkB,GAAGN,cAAc,EAAEI,qBAAqB,IAAI,IAAI","ignoreList":[]}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+
3
+ import { useColorScheme } from 'react-native';
4
+ import { useMemo } from 'react';
5
+
6
+ /** Which palette to render with. "system" follows the OS appearance. */
7
+
8
+ /**
9
+ * Every color the input and the country picker draw with. Both palettes are
10
+ * complete, so dark mode needs no configuration — pass nothing and the
11
+ * component follows the OS. Override individual tokens via the `palette`
12
+ * prop when you want the component to match your own design system.
13
+ */
14
+ /**
15
+ * Note the split with `theme`: `theme` styles the text field alone (its fill,
16
+ * its borders, its text), while this palette covers the field's neutral
17
+ * defaults *and* the whole picker sheet. Keeping them separate is what lets a
18
+ * field sitting on a colored background go fully custom without erasing the
19
+ * picker's separators or A-Z index along with it.
20
+ */
21
+
22
+ export const LIGHT_PALETTE = {
23
+ background: '#FFFFFF',
24
+ inputBackground: '#FFFFFF',
25
+ surface: '#F2F2F7',
26
+ surfacePressed: '#E5E5EA',
27
+ border: '#D1D1D6',
28
+ text: '#1C1C1E',
29
+ textMuted: '#8E8E93',
30
+ placeholder: '#8E8E93',
31
+ accent: '#007AFF',
32
+ accentContrast: '#FFFFFF',
33
+ danger: '#FF3B30',
34
+ disabled: '#C7C7CC',
35
+ handle: '#D1D1D6',
36
+ bubble: 'rgba(60,60,67,0.85)',
37
+ bubbleText: '#FFFFFF'
38
+ };
39
+ export const DARK_PALETTE = {
40
+ background: '#1C1C1E',
41
+ inputBackground: '#1C1C1E',
42
+ surface: '#2C2C2E',
43
+ surfacePressed: '#3A3A3C',
44
+ border: '#38383A',
45
+ text: '#FFFFFF',
46
+ textMuted: '#98989F',
47
+ placeholder: '#8E8E93',
48
+ accent: '#0A84FF',
49
+ accentContrast: '#FFFFFF',
50
+ danger: '#FF453A',
51
+ disabled: '#48484A',
52
+ handle: '#48484A',
53
+ bubble: 'rgba(120,120,128,0.9)',
54
+ bubbleText: '#FFFFFF'
55
+ };
56
+
57
+ /**
58
+ * Resolves the palette for the current appearance. `colorScheme` forces one;
59
+ * "system" (the default) follows the OS and re-renders when it changes.
60
+ */
61
+ export function usePhoneInputPalette(colorScheme = 'system', overrides) {
62
+ const systemScheme = useColorScheme();
63
+ const resolved = colorScheme === 'system' ? systemScheme ?? 'light' : colorScheme;
64
+
65
+ // Keyed on the overrides' contents rather than their identity, because
66
+ // callers naturally write `palette={{ ... }}` inline. A new object every
67
+ // render would give the palette a new identity every render, and the picker
68
+ // memoizes ~20 style objects and its whole row list on that identity —
69
+ // serializing a handful of color strings is far cheaper than losing those.
70
+ const overridesKey = overrides ? JSON.stringify(overrides) : '';
71
+ return useMemo(() => {
72
+ const base = resolved === 'dark' ? DARK_PALETTE : LIGHT_PALETTE;
73
+ return {
74
+ ...base,
75
+ ...overrides
76
+ };
77
+ // `overrides` is intentionally tracked through `overridesKey`.
78
+ // eslint-disable-next-line react-hooks/exhaustive-deps
79
+ }, [resolved, overridesKey]);
80
+ }
81
+ //# sourceMappingURL=theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useColorScheme","useMemo","LIGHT_PALETTE","background","inputBackground","surface","surfacePressed","border","text","textMuted","placeholder","accent","accentContrast","danger","disabled","handle","bubble","bubbleText","DARK_PALETTE","usePhoneInputPalette","colorScheme","overrides","systemScheme","resolved","overridesKey","JSON","stringify","base"],"sourceRoot":"../../src","sources":["theme.ts"],"mappings":";;AAAA,SAASA,cAAc,QAAQ,cAAc;AAC7C,SAASC,OAAO,QAAQ,OAAO;;AAE/B;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgCA,OAAO,MAAMC,aAAgC,GAAG;EAC9CC,UAAU,EAAE,SAAS;EACrBC,eAAe,EAAE,SAAS;EAC1BC,OAAO,EAAE,SAAS;EAClBC,cAAc,EAAE,SAAS;EACzBC,MAAM,EAAE,SAAS;EACjBC,IAAI,EAAE,SAAS;EACfC,SAAS,EAAE,SAAS;EACpBC,WAAW,EAAE,SAAS;EACtBC,MAAM,EAAE,SAAS;EACjBC,cAAc,EAAE,SAAS;EACzBC,MAAM,EAAE,SAAS;EACjBC,QAAQ,EAAE,SAAS;EACnBC,MAAM,EAAE,SAAS;EACjBC,MAAM,EAAE,qBAAqB;EAC7BC,UAAU,EAAE;AACd,CAAC;AAED,OAAO,MAAMC,YAA+B,GAAG;EAC7Cf,UAAU,EAAE,SAAS;EACrBC,eAAe,EAAE,SAAS;EAC1BC,OAAO,EAAE,SAAS;EAClBC,cAAc,EAAE,SAAS;EACzBC,MAAM,EAAE,SAAS;EACjBC,IAAI,EAAE,SAAS;EACfC,SAAS,EAAE,SAAS;EACpBC,WAAW,EAAE,SAAS;EACtBC,MAAM,EAAE,SAAS;EACjBC,cAAc,EAAE,SAAS;EACzBC,MAAM,EAAE,SAAS;EACjBC,QAAQ,EAAE,SAAS;EACnBC,MAAM,EAAE,SAAS;EACjBC,MAAM,EAAE,uBAAuB;EAC/BC,UAAU,EAAE;AACd,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,SAASE,oBAAoBA,CAClCC,WAAkC,GAAG,QAAQ,EAC7CC,SAAsC,EACnB;EACnB,MAAMC,YAAY,GAAGtB,cAAc,CAAC,CAAC;EACrC,MAAMuB,QAAQ,GACZH,WAAW,KAAK,QAAQ,GAAIE,YAAY,IAAI,OAAO,GAAIF,WAAW;;EAEpE;EACA;EACA;EACA;EACA;EACA,MAAMI,YAAY,GAAGH,SAAS,GAAGI,IAAI,CAACC,SAAS,CAACL,SAAS,CAAC,GAAG,EAAE;EAE/D,OAAOpB,OAAO,CAAC,MAAM;IACnB,MAAM0B,IAAI,GAAGJ,QAAQ,KAAK,MAAM,GAAGL,YAAY,GAAGhB,aAAa;IAC/D,OAAO;MAAE,GAAGyB,IAAI;MAAE,GAAGN;IAAU,CAAC;IAChC;IACA;EACF,CAAC,EAAE,CAACE,QAAQ,EAAEC,YAAY,CAAC,CAAC;AAC9B","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export {};
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ import { AsYouType, getCountryCallingCode, isValidPhoneNumber, parsePhoneNumberFromString } from 'libphonenumber-js';
4
+ import { getCountryByCallingCode, getCountryByCode } from "./countries.js";
5
+ /**
6
+ * The country's true calling code ("1" for Jamaica), as opposed to the
7
+ * extended `dialCode` ("1876") the picker shows to tell the NANP territories
8
+ * apart. Concatenating the latter with a national number double-counts the
9
+ * area code, so every international string is built from this instead.
10
+ */
11
+ export function callingCodeFor(country) {
12
+ try {
13
+ return getCountryCallingCode(country.code);
14
+ } catch {
15
+ return country.dialCode;
16
+ }
17
+ }
18
+ export function buildValue(nationalNumber, country) {
19
+ const digits = nationalNumber.replace(/\D/g, '');
20
+ const valid = digits.length > 0 && isValidPhoneNumber(digits, country.code);
21
+ const e164 = valid ? parsePhoneNumberFromString(digits, country.code)?.number ?? null : null;
22
+ return {
23
+ nationalNumber: digits,
24
+ country: country.code,
25
+ dialCode: country.dialCode,
26
+ e164,
27
+ international: digits ? `+${callingCodeFor(country)}${digits}` : '',
28
+ isValid: valid
29
+ };
30
+ }
31
+
32
+ /**
33
+ * Splits a controlled `value` into the national digits and, when the value is
34
+ * an international string, the country it implies. `current` is kept whenever
35
+ * its calling code still matches, so an explicit pick among the countries
36
+ * sharing a calling code (Jamaica vs the US on "+1") is not undone by the
37
+ * next keystroke.
38
+ */
39
+ export function readControlledValue(raw, current) {
40
+ if (!raw.startsWith('+')) {
41
+ return {
42
+ national: raw.replace(/\D/g, ''),
43
+ country: current
44
+ };
45
+ }
46
+ const formatter = new AsYouType();
47
+ formatter.input(raw);
48
+ const callingCode = formatter.getCallingCode();
49
+ const national = formatter.getNationalNumber() ?? '';
50
+ if (!callingCode || callingCode === callingCodeFor(current)) {
51
+ return {
52
+ national,
53
+ country: current
54
+ };
55
+ }
56
+ const next = getCountryByCode(formatter.getCountry()) ?? getCountryByCallingCode(callingCode);
57
+ return {
58
+ national,
59
+ country: next ?? current
60
+ };
61
+ }
62
+ //# sourceMappingURL=value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AsYouType","getCountryCallingCode","isValidPhoneNumber","parsePhoneNumberFromString","getCountryByCallingCode","getCountryByCode","callingCodeFor","country","code","dialCode","buildValue","nationalNumber","digits","replace","valid","length","e164","number","international","isValid","readControlledValue","raw","current","startsWith","national","formatter","input","callingCode","getCallingCode","getNationalNumber","next","getCountry"],"sourceRoot":"../../src","sources":["value.ts"],"mappings":";;AAAA,SACEA,SAAS,EACTC,qBAAqB,EACrBC,kBAAkB,EAClBC,0BAA0B,QACrB,mBAAmB;AAC1B,SAASC,uBAAuB,EAAEC,gBAAgB,QAAQ,gBAAa;AAIvE;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAACC,OAAgB,EAAU;EACvD,IAAI;IACF,OAAON,qBAAqB,CAACM,OAAO,CAACC,IAAI,CAAC;EAC5C,CAAC,CAAC,MAAM;IACN,OAAOD,OAAO,CAACE,QAAQ;EACzB;AACF;AAEA,OAAO,SAASC,UAAUA,CACxBC,cAAsB,EACtBJ,OAAgB,EACC;EACjB,MAAMK,MAAM,GAAGD,cAAc,CAACE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;EAChD,MAAMC,KAAK,GAAGF,MAAM,CAACG,MAAM,GAAG,CAAC,IAAIb,kBAAkB,CAACU,MAAM,EAAEL,OAAO,CAACC,IAAI,CAAC;EAC3E,MAAMQ,IAAI,GAAGF,KAAK,GACbX,0BAA0B,CAACS,MAAM,EAAEL,OAAO,CAACC,IAAI,CAAC,EAAES,MAAM,IAAI,IAAI,GACjE,IAAI;EACR,OAAO;IACLN,cAAc,EAAEC,MAAM;IACtBL,OAAO,EAAEA,OAAO,CAACC,IAAI;IACrBC,QAAQ,EAAEF,OAAO,CAACE,QAAQ;IAC1BO,IAAI;IACJE,aAAa,EAAEN,MAAM,GAAG,IAAIN,cAAc,CAACC,OAAO,CAAC,GAAGK,MAAM,EAAE,GAAG,EAAE;IACnEO,OAAO,EAAEL;EACX,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASM,mBAAmBA,CACjCC,GAAW,EACXC,OAAgB,EACwB;EACxC,IAAI,CAACD,GAAG,CAACE,UAAU,CAAC,GAAG,CAAC,EAAE;IACxB,OAAO;MAAEC,QAAQ,EAAEH,GAAG,CAACR,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;MAAEN,OAAO,EAAEe;IAAQ,CAAC;EAC/D;EACA,MAAMG,SAAS,GAAG,IAAIzB,SAAS,CAAC,CAAC;EACjCyB,SAAS,CAACC,KAAK,CAACL,GAAG,CAAC;EACpB,MAAMM,WAAW,GAAGF,SAAS,CAACG,cAAc,CAAC,CAAC;EAC9C,MAAMJ,QAAQ,GAAGC,SAAS,CAACI,iBAAiB,CAAC,CAAC,IAAI,EAAE;EAEpD,IAAI,CAACF,WAAW,IAAIA,WAAW,KAAKrB,cAAc,CAACgB,OAAO,CAAC,EAAE;IAC3D,OAAO;MAAEE,QAAQ;MAAEjB,OAAO,EAAEe;IAAQ,CAAC;EACvC;EACA,MAAMQ,IAAI,GACRzB,gBAAgB,CAACoB,SAAS,CAACM,UAAU,CAAC,CAAC,CAAC,IACxC3B,uBAAuB,CAACuB,WAAW,CAAC;EACtC,OAAO;IAAEH,QAAQ;IAAEjB,OAAO,EAAEuB,IAAI,IAAIR;EAAQ,CAAC;AAC/C","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,37 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type Country } from './countries';
3
+ import { type PhoneInputPalette } from './theme';
4
+ import type { CountryPickerRenderItemInfo, CountryPickerStyles, PhoneInputColorScheme } from './types';
5
+ export interface CountryPickerProps {
6
+ visible: boolean;
7
+ countries: Country[];
8
+ selected?: Country;
9
+ onSelect: (country: Country) => void;
10
+ onClose: () => void;
11
+ searchPlaceholder?: string;
12
+ disableSearch?: boolean;
13
+ renderCountryItem?: (info: CountryPickerRenderItemInfo) => ReactNode;
14
+ /**
15
+ * Safe-area padding for the sheet. Usually unnecessary: when
16
+ * `react-native-safe-area-context` is installed (an optional peer) the
17
+ * insets are detected automatically, and the defaults work without it
18
+ * either way. Any edge set here overrides the detected value for that edge
19
+ * only — `{ top: 0 }` opts out of the top inset and keeps the rest.
20
+ */
21
+ safeAreaInsets?: {
22
+ top?: number;
23
+ bottom?: number;
24
+ left?: number;
25
+ right?: number;
26
+ };
27
+ /** Resolved palette. Passed down by PhoneInput; when the picker is used on
28
+ * its own it resolves one from `colorScheme` instead. */
29
+ palette?: PhoneInputPalette;
30
+ colorScheme?: PhoneInputColorScheme;
31
+ presentationStyle?: 'pageSheet' | 'fullScreen' | 'formSheet';
32
+ groupAlphabetically?: boolean;
33
+ showAlphabetIndex?: boolean;
34
+ styles?: CountryPickerStyles;
35
+ }
36
+ export declare function CountryPicker({ visible, countries, selected, onSelect, onClose, searchPlaceholder, disableSearch, renderCountryItem, palette: providedPalette, colorScheme, safeAreaInsets, presentationStyle, groupAlphabetically, showAlphabetIndex, styles: styleOverrides, }: CountryPickerProps): import("react").JSX.Element;
37
+ //# sourceMappingURL=CountryPicker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CountryPicker.d.ts","sourceRoot":"","sources":["../../../../src/CountryPicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAYf,OAAO,EAA0B,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAGnE,OAAO,EAAwB,KAAK,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACvE,OAAO,KAAK,EACV,2BAA2B,EAC3B,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AASjB,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,EAAE,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,2BAA2B,KAAK,SAAS,CAAC;IACrE;;;;;;OAMG;IACH,cAAc,CAAC,EAAE;QACf,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF;6DACyD;IACzD,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,WAAW,CAAC,EAAE,qBAAqB,CAAC;IACpC,iBAAiB,CAAC,EAAE,WAAW,GAAG,YAAY,GAAG,WAAW,CAAC;IAC7D,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,MAAM,CAAC,EAAE,mBAAmB,CAAC;CAC9B;AAED,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,iBAA4C,EAC5C,aAAa,EACb,iBAAiB,EACjB,OAAO,EAAE,eAAe,EACxB,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,mBAA0B,EAC1B,iBAAwB,EACxB,MAAM,EAAE,cAAc,GACvB,EAAE,kBAAkB,+BA+fpB"}
@@ -0,0 +1,10 @@
1
+ import { type StyleProp, type TextStyle } from 'react-native';
2
+ import type { Country } from './countries';
3
+ export interface FlagProps {
4
+ country: Country;
5
+ size?: number;
6
+ style?: StyleProp<TextStyle>;
7
+ }
8
+ /** Renders a country's Unicode flag emoji, e.g. 🇺🇸. */
9
+ export declare function Flag({ country, size, style }: FlagProps): import("react").JSX.Element;
10
+ //# sourceMappingURL=Flag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Flag.d.ts","sourceRoot":"","sources":["../../../../src/Flag.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,yDAAyD;AACzD,wBAAgB,IAAI,CAAC,EAAE,OAAO,EAAE,IAAS,EAAE,KAAK,EAAE,EAAE,SAAS,+BAM5D"}
@@ -0,0 +1,3 @@
1
+ import type { PhoneInputProps, PhoneInputRef } from './types';
2
+ export declare const PhoneInput: import("react").ForwardRefExoticComponent<PhoneInputProps & import("react").RefAttributes<PhoneInputRef>>;
3
+ //# sourceMappingURL=PhoneInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PhoneInput.d.ts","sourceRoot":"","sources":["../../../../src/PhoneInput.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAW,eAAe,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEvE,eAAO,MAAM,UAAU,2GAkStB,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type { CountryCode } from 'libphonenumber-js';
2
+ export interface Country {
3
+ /** ISO 3166-1 alpha-2 country code, e.g. "US" */
4
+ code: CountryCode;
5
+ /** Country calling code without the leading "+", e.g. "1" */
6
+ dialCode: string;
7
+ /** English display name */
8
+ name: string;
9
+ /** Unicode regional-indicator flag emoji, e.g. "🇺🇸" */
10
+ flag: string;
11
+ }
12
+ export interface CountrySection {
13
+ letter: string;
14
+ data: Country[];
15
+ }
16
+ export declare const COUNTRIES: Country[];
17
+ export declare const COUNTRIES_BY_CODE: Record<string, Country>;
18
+ export declare function getCountryByCode(code?: string | null): Country | undefined;
19
+ export declare function getCountryByCallingCode(callingCode?: string | null): Country | undefined;
20
+ /** Reads the device's region from the JS engine's default locale (e.g. "en-IN"
21
+ * -> "IN"), with no native module required. Used as the initial country when
22
+ * the consumer doesn't pass `defaultCountry`. Returns undefined if the
23
+ * runtime can't resolve a locale/region (some Hermes builds, very old engines). */
24
+ export declare function getDeviceCountry(): Country | undefined;
25
+ export declare function sectionLetterFor(name: string): string;
26
+ /** Groups an (already name-sorted) country list into contiguous A–Z sections. */
27
+ export declare function groupCountriesByLetter(list: Country[]): CountrySection[];
28
+ //# sourceMappingURL=countries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"countries.d.ts","sourceRoot":"","sources":["../../../../src/countries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD,MAAM,WAAW,OAAO;IACtB,iDAAiD;IACjD,IAAI,EAAE,WAAW,CAAC;IAClB,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,CAAC;IACjB,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,EAAE,CAAC;CACjB;AAED,eAAO,MAAM,SAAS,EAAE,OAAO,EAA+B,CAAC;AAE/D,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAMrD,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,GAAG,SAAS,CAG1E;AAcD,wBAAgB,uBAAuB,CACrC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAC1B,OAAO,GAAG,SAAS,CAGrB;AAED;;;mFAGmF;AACnF,wBAAgB,gBAAgB,IAAI,OAAO,GAAG,SAAS,CAQtD;AAMD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOrD;AAED,iFAAiF;AACjF,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,cAAc,EAAE,CAYxE"}
@@ -0,0 +1,9 @@
1
+ export { COUNTRIES, getCountryByCode, groupCountriesByLetter, sectionLetterFor, } from './countries';
2
+ export type { Country, CountrySection } from './countries';
3
+ export { Flag } from './Flag';
4
+ export { PhoneInput } from './PhoneInput';
5
+ export { CountryPicker } from './CountryPicker';
6
+ export { LIGHT_PALETTE, DARK_PALETTE, usePhoneInputPalette } from './theme';
7
+ export type { PhoneInputPalette, PhoneInputColorScheme } from './theme';
8
+ export type { PhoneInputProps, PhoneInputRef, PhoneInputValue, PhoneInputTheme, CountryPickerRenderItemInfo, CountryDisplayMode, CountryPickerStyles, } from './types';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC5E,YAAY,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACxE,YAAY,EACV,eAAe,EACf,aAAa,EACb,eAAe,EACf,eAAe,EACf,2BAA2B,EAC3B,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,SAAS,CAAC"}
@@ -0,0 +1,11 @@
1
+ export interface EdgeInsets {
2
+ top: number;
3
+ bottom: number;
4
+ left: number;
5
+ right: number;
6
+ }
7
+ /** The ambient safe-area insets, or null when unavailable. */
8
+ export declare function useOptionalSafeAreaInsets(): EdgeInsets | null;
9
+ /** Whether the optional peer resolved. Exported for diagnostics and tests. */
10
+ export declare const hasSafeAreaContext: boolean;
11
+ //# sourceMappingURL=safeArea.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"safeArea.d.ts","sourceRoot":"","sources":["../../../../src/safeArea.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAoCD,8DAA8D;AAC9D,wBAAgB,yBAAyB,IAAI,UAAU,GAAG,IAAI,CAE7D;AAED,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,SAAgD,CAAC"}
@@ -0,0 +1,53 @@
1
+ /** Which palette to render with. "system" follows the OS appearance. */
2
+ export type PhoneInputColorScheme = 'light' | 'dark' | 'system';
3
+ /**
4
+ * Every color the input and the country picker draw with. Both palettes are
5
+ * complete, so dark mode needs no configuration — pass nothing and the
6
+ * component follows the OS. Override individual tokens via the `palette`
7
+ * prop when you want the component to match your own design system.
8
+ */
9
+ /**
10
+ * Note the split with `theme`: `theme` styles the text field alone (its fill,
11
+ * its borders, its text), while this palette covers the field's neutral
12
+ * defaults *and* the whole picker sheet. Keeping them separate is what lets a
13
+ * field sitting on a colored background go fully custom without erasing the
14
+ * picker's separators or A-Z index along with it.
15
+ */
16
+ export interface PhoneInputPalette {
17
+ /** Picker page background */
18
+ background: string;
19
+ /** The text field's own fill */
20
+ inputBackground: string;
21
+ /** Raised surfaces: search box, section headers, close button, selected row */
22
+ surface: string;
23
+ /** Pressed state for those surfaces */
24
+ surfacePressed: string;
25
+ /** Hairline separators, the input border, the country/number divider */
26
+ border: string;
27
+ /** Primary text: the number, country names, the picker title */
28
+ text: string;
29
+ /** Secondary text: dial codes, section letters, the empty state */
30
+ textMuted: string;
31
+ placeholder: string;
32
+ /** Focus ring and the A–Z index */
33
+ accent: string;
34
+ /** Text drawn on top of `accent` */
35
+ accentContrast: string;
36
+ /** Border shown when the typed number is invalid */
37
+ danger: string;
38
+ /** A–Z index letter with no countries under it */
39
+ disabled: string;
40
+ /** The sheet's drag handle */
41
+ handle: string;
42
+ /** The letter bubble shown while scrubbing the A–Z index */
43
+ bubble: string;
44
+ bubbleText: string;
45
+ }
46
+ export declare const LIGHT_PALETTE: PhoneInputPalette;
47
+ export declare const DARK_PALETTE: PhoneInputPalette;
48
+ /**
49
+ * Resolves the palette for the current appearance. `colorScheme` forces one;
50
+ * "system" (the default) follows the OS and re-renders when it changes.
51
+ */
52
+ export declare function usePhoneInputPalette(colorScheme?: PhoneInputColorScheme, overrides?: Partial<PhoneInputPalette>): PhoneInputPalette;
53
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../src/theme.ts"],"names":[],"mappings":"AAGA,wEAAwE;AACxE,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEhE;;;;;GAKG;AACH;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,6BAA6B;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,gCAAgC;IAChC,eAAe,EAAE,MAAM,CAAC;IACxB,+EAA+E;IAC/E,OAAO,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,cAAc,EAAE,MAAM,CAAC;IACvB,wEAAwE;IACxE,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,oCAAoC;IACpC,cAAc,EAAE,MAAM,CAAC;IACvB,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,aAAa,EAAE,iBAgB3B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,iBAgB1B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,GAAE,qBAAgC,EAC7C,SAAS,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,GACrC,iBAAiB,CAkBnB"}
@@ -0,0 +1,211 @@
1
+ import type { CountryCode } from 'libphonenumber-js';
2
+ import type { StyleProp, TextInputProps, TextStyle, ViewStyle } from 'react-native';
3
+ import type { Country } from './countries';
4
+ import type { PhoneInputColorScheme, PhoneInputPalette } from './theme';
5
+ export type { Country };
6
+ export type { PhoneInputColorScheme, PhoneInputPalette };
7
+ export interface PhoneInputValue {
8
+ /** Raw digits the user typed, national significant number, no dial code (e.g. "4155552671") */
9
+ nationalNumber: string;
10
+ /** ISO 3166-1 alpha-2 country selected (e.g. "US") */
11
+ country: CountryCode;
12
+ /**
13
+ * Calling code without "+" (e.g. "1"). For the 23 NANP territories that
14
+ * share "+1" (Jamaica, Bermuda, etc.) this includes the distinguishing area
15
+ * code (e.g. "1876") so the picker can tell them apart — use `e164`, not
16
+ * `dialCode` + `nationalNumber`, to reconstruct the full number.
17
+ */
18
+ dialCode: string;
19
+ /** Full E.164 formatted number if valid, e.g. "+14155552671" */
20
+ e164: string | null;
21
+ /**
22
+ * The number as an international string at every keystroke, valid or not
23
+ * (e.g. "+1415555" while typing). Equals `e164` once the number is valid,
24
+ * and "" while the field is empty. Built through libphonenumber-js, so
25
+ * unlike `dialCode` + `nationalNumber` it is always correct for the NANP
26
+ * territories that share "+1" — use this, not string concatenation, when
27
+ * you need a value to store on every change.
28
+ */
29
+ international: string;
30
+ /** Whether libphonenumber-js considers the number valid for the selected country */
31
+ isValid: boolean;
32
+ }
33
+ export interface PhoneInputRef {
34
+ focus: () => void;
35
+ blur: () => void;
36
+ isValid: () => boolean;
37
+ getValue: () => PhoneInputValue;
38
+ }
39
+ export interface CountryPickerRenderItemInfo {
40
+ item: Country;
41
+ isSelected: boolean;
42
+ onPress: () => void;
43
+ }
44
+ export interface PhoneInputTheme {
45
+ backgroundColor?: string;
46
+ borderColor?: string;
47
+ focusedBorderColor?: string;
48
+ errorBorderColor?: string;
49
+ textColor?: string;
50
+ placeholderColor?: string;
51
+ dialCodeColor?: string;
52
+ /** The rule between the country control and the number. Defaults to the
53
+ * palette's border color — set it explicitly when the field itself is
54
+ * borderless, so the divider does not disappear with the border. */
55
+ dividerColor?: string;
56
+ borderRadius?: number;
57
+ fontSize?: number;
58
+ }
59
+ /** What the country control (left of the input) shows. */
60
+ export type CountryDisplayMode = 'flag' | 'code' | 'both';
61
+ /**
62
+ * Per-element style overrides for the country picker modal, so every part of it
63
+ * can be fully re-skinned — not just colors via `theme`. Each slot is merged on
64
+ * top of the built-in style, so you only need to specify what you're changing.
65
+ */
66
+ export interface CountryPickerStyles {
67
+ /** The modal's root view */
68
+ container?: StyleProp<ViewStyle>;
69
+ /** The block holding the title row and search box, ruled off from the list */
70
+ headerSection?: StyleProp<ViewStyle>;
71
+ /** Row containing the title and close button */
72
+ header?: StyleProp<ViewStyle>;
73
+ title?: StyleProp<TextStyle>;
74
+ closeButton?: StyleProp<ViewStyle>;
75
+ closeButtonText?: StyleProp<TextStyle>;
76
+ /** The search field's box — fill, border, height */
77
+ searchContainer?: StyleProp<ViewStyle>;
78
+ /** The search field's text input */
79
+ search?: StyleProp<TextStyle>;
80
+ /** A single country row */
81
+ row?: StyleProp<ViewStyle>;
82
+ /** Merged on top of `row` when that row is the selected country */
83
+ rowSelected?: StyleProp<ViewStyle>;
84
+ flag?: StyleProp<TextStyle>;
85
+ name?: StyleProp<TextStyle>;
86
+ dialCode?: StyleProp<TextStyle>;
87
+ /** The "A", "B", "C"... letter header above each section */
88
+ sectionHeader?: StyleProp<ViewStyle>;
89
+ sectionHeaderText?: StyleProp<TextStyle>;
90
+ /** A single letter in the right-edge alphabet index */
91
+ sidebarLetter?: StyleProp<TextStyle>;
92
+ /** Merged on top of `sidebarLetter` for the currently-active letter */
93
+ sidebarLetterActive?: StyleProp<TextStyle>;
94
+ }
95
+ export interface PhoneInputProps extends Omit<TextInputProps, 'value' | 'onChangeText' | 'onChange' | 'style'> {
96
+ /**
97
+ * ISO 3166-1 alpha-2 initial country, e.g. "US" (uncontrolled). Set this
98
+ * only when you want a *fixed* initial country regardless of the device —
99
+ * it always wins over locale detection. Leave it unset to prefer the
100
+ * device's locale region instead (see {@link fallbackCountry}).
101
+ */
102
+ defaultCountry?: CountryCode;
103
+ /**
104
+ * Initial country used only when `defaultCountry` is unset AND the
105
+ * device's locale region can't be resolved (or isn't in the current
106
+ * `countries`/`excludedCountries` list). Default: "US". Precedence for the
107
+ * initial country is: `defaultCountry` > device locale > `fallbackCountry`.
108
+ */
109
+ fallbackCountry?: CountryCode;
110
+ /** Controlled selected country. Falls back to internal state when omitted. */
111
+ country?: CountryCode;
112
+ /**
113
+ * Controlled value. Accepts either the national number on its own (digits,
114
+ * no dial code — e.g. "4155552671") or a full international number starting
115
+ * with "+" (e.g. "+14155552671"), in which case the selected country is
116
+ * derived from it. The international form lets a form store one string and
117
+ * hand it straight back, with no country state of its own; it is also what
118
+ * {@link onChangeInternational} emits. The selected country only changes
119
+ * when the calling code does, so picking a specific "+1" territory is not
120
+ * undone by the next keystroke.
121
+ */
122
+ value?: string;
123
+ /** Called with the composed value on every change */
124
+ onChangeText?: (value: PhoneInputValue) => void;
125
+ /**
126
+ * Called on every change with {@link PhoneInputValue.international} alone.
127
+ * Pairs with the international form of `value` so a form field can be wired
128
+ * up with just `value` and this callback.
129
+ */
130
+ onChangeInternational?: (value: string) => void;
131
+ /** Called only when the selected country changes */
132
+ onChangeCountry?: (country: Country) => void;
133
+ /** Restrict the picker to a subset of ISO codes */
134
+ countries?: CountryCode[];
135
+ /** Exclude specific ISO codes from the picker */
136
+ excludedCountries?: CountryCode[];
137
+ /** Disable the built-in libphonenumber-js validation styling/behavior */
138
+ disableValidation?: boolean;
139
+ /** Format the national number as the user types (default: true) */
140
+ autoFormat?: boolean;
141
+ /** Show a country control (flag/code) to the left of the input (default: true) */
142
+ showCountryPicker?: boolean;
143
+ /** What the country control shows: 'flag' | 'code' | 'both' (default: 'both') */
144
+ displayMode?: CountryDisplayMode;
145
+ /** Render a completely custom flag element instead of the built-in one */
146
+ renderFlag?: (country: Country) => React.ReactNode;
147
+ /** Render a fully custom row inside the country picker list */
148
+ renderCountryItem?: (info: CountryPickerRenderItemInfo) => React.ReactNode;
149
+ /** Placeholder for the picker search box */
150
+ searchPlaceholder?: string;
151
+ /** Hide the search box inside the country picker */
152
+ disableSearch?: boolean;
153
+ /**
154
+ * Group the picker list into A–Z sections with letter headers (default: true).
155
+ * Independent of {@link showAlphabetIndex} — either can be on without the other.
156
+ */
157
+ groupAlphabetically?: boolean;
158
+ /**
159
+ * Show an A–Z index sidebar on the right edge of the picker for tap/drag jumping
160
+ * (default: true). Works whether or not {@link groupAlphabetically} is on: with
161
+ * it off, the list stays flat but the index still jumps to the right country.
162
+ */
163
+ showAlphabetIndex?: boolean;
164
+ /**
165
+ * When the user types or pastes a number that starts with "+" and its calling
166
+ * code resolves to a country in the current list, auto-switch the selected
167
+ * country to match (e.g. pasting "+911234567890" selects India). Default: true.
168
+ */
169
+ autoDetectCountry?: boolean;
170
+ /** Style for the outer wrapper (equivalent to `containerStyle`, kept as the plain
171
+ * `style` prop so style-interop tooling like NativeWind's `cssInterop` — the same
172
+ * mechanism shadcn-style RN kits (e.g. react-native-reusables) rely on — can target
173
+ * it by the standard prop name). */
174
+ style?: StyleProp<ViewStyle>;
175
+ containerStyle?: StyleProp<ViewStyle>;
176
+ inputStyle?: StyleProp<TextStyle>;
177
+ dialCodeStyle?: StyleProp<TextStyle>;
178
+ flagStyle?: StyleProp<TextStyle>;
179
+ countryPickerButtonStyle?: StyleProp<ViewStyle>;
180
+ /** Per-element style overrides for the country picker modal (see {@link CountryPickerStyles}) */
181
+ pickerStyles?: CountryPickerStyles;
182
+ /** Visual theme tokens, merged under the style props above */
183
+ theme?: PhoneInputTheme;
184
+ /**
185
+ * Which palette to draw with. Defaults to "system", which follows the OS
186
+ * appearance — dark mode needs no setup.
187
+ */
188
+ colorScheme?: PhoneInputColorScheme;
189
+ /**
190
+ * Override individual palette tokens (separators, surfaces, muted text, the
191
+ * A-Z index, ...) on top of the resolved light/dark palette. This is the
192
+ * one knob for recoloring the whole component, picker included.
193
+ */
194
+ palette?: Partial<PhoneInputPalette>;
195
+ /**
196
+ * Safe-area padding for the picker sheet. Usually unnecessary — when
197
+ * `react-native-safe-area-context` is installed (an optional peer) the
198
+ * insets are detected automatically, and the defaults work without it
199
+ * either way. Any edge set here overrides the detected value for that edge
200
+ * only, so `{ top: 0 }` opts out of the top inset and keeps the rest.
201
+ */
202
+ pickerSafeAreaInsets?: {
203
+ top?: number;
204
+ bottom?: number;
205
+ left?: number;
206
+ right?: number;
207
+ };
208
+ /** Modal presentation style for the built-in picker (default: "pageSheet" on iOS, "fullScreen" elsewhere) */
209
+ pickerPresentationStyle?: 'pageSheet' | 'fullScreen' | 'formSheet';
210
+ }
211
+ //# sourceMappingURL=types.d.ts.map