@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.
- package/LICENSE +20 -0
- package/README.md +467 -0
- package/lib/commonjs/CountryPicker.js +669 -0
- package/lib/commonjs/CountryPicker.js.map +1 -0
- package/lib/commonjs/Flag.js +23 -0
- package/lib/commonjs/Flag.js.map +1 -0
- package/lib/commonjs/PhoneInput.js +252 -0
- package/lib/commonjs/PhoneInput.js.map +1 -0
- package/lib/commonjs/countries.js +75 -0
- package/lib/commonjs/countries.js.map +1 -0
- package/lib/commonjs/data/countries.json +1472 -0
- package/lib/commonjs/index.js +71 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/safeArea.js +44 -0
- package/lib/commonjs/safeArea.js.map +1 -0
- package/lib/commonjs/theme.js +85 -0
- package/lib/commonjs/theme.js.map +1 -0
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/value.js +68 -0
- package/lib/commonjs/value.js.map +1 -0
- package/lib/module/CountryPicker.js +665 -0
- package/lib/module/CountryPicker.js.map +1 -0
- package/lib/module/Flag.js +19 -0
- package/lib/module/Flag.js.map +1 -0
- package/lib/module/PhoneInput.js +248 -0
- package/lib/module/PhoneInput.js.map +1 -0
- package/lib/module/countries.js +65 -0
- package/lib/module/countries.js.map +1 -0
- package/lib/module/data/countries.json +1472 -0
- package/lib/module/index.js +8 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/safeArea.js +39 -0
- package/lib/module/safeArea.js.map +1 -0
- package/lib/module/theme.js +81 -0
- package/lib/module/theme.js.map +1 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/value.js +62 -0
- package/lib/module/value.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/CountryPicker.d.ts +37 -0
- package/lib/typescript/commonjs/src/CountryPicker.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/Flag.d.ts +10 -0
- package/lib/typescript/commonjs/src/Flag.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/PhoneInput.d.ts +3 -0
- package/lib/typescript/commonjs/src/PhoneInput.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/countries.d.ts +28 -0
- package/lib/typescript/commonjs/src/countries.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +9 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/safeArea.d.ts +11 -0
- package/lib/typescript/commonjs/src/safeArea.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/theme.d.ts +53 -0
- package/lib/typescript/commonjs/src/theme.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types.d.ts +211 -0
- package/lib/typescript/commonjs/src/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/value.d.ts +22 -0
- package/lib/typescript/commonjs/src/value.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/CountryPicker.d.ts +37 -0
- package/lib/typescript/module/src/CountryPicker.d.ts.map +1 -0
- package/lib/typescript/module/src/Flag.d.ts +10 -0
- package/lib/typescript/module/src/Flag.d.ts.map +1 -0
- package/lib/typescript/module/src/PhoneInput.d.ts +3 -0
- package/lib/typescript/module/src/PhoneInput.d.ts.map +1 -0
- package/lib/typescript/module/src/countries.d.ts +28 -0
- package/lib/typescript/module/src/countries.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +9 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/safeArea.d.ts +11 -0
- package/lib/typescript/module/src/safeArea.d.ts.map +1 -0
- package/lib/typescript/module/src/theme.d.ts +53 -0
- package/lib/typescript/module/src/theme.d.ts.map +1 -0
- package/lib/typescript/module/src/types.d.ts +211 -0
- package/lib/typescript/module/src/types.d.ts.map +1 -0
- package/lib/typescript/module/src/value.d.ts +22 -0
- package/lib/typescript/module/src/value.d.ts.map +1 -0
- package/package.json +215 -0
- package/src/CountryPicker.tsx +805 -0
- package/src/Flag.tsx +17 -0
- package/src/PhoneInput.tsx +363 -0
- package/src/countries.ts +95 -0
- package/src/data/countries.json +1472 -0
- package/src/index.tsx +21 -0
- package/src/safeArea.ts +50 -0
- package/src/theme.ts +112 -0
- package/src/types.ts +229 -0
- package/src/value.ts +70 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAExE,YAAY,EAAE,OAAO,EAAE,CAAC;AACxB,YAAY,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,CAAC;AAEzD,MAAM,WAAW,eAAe;IAC9B,+FAA+F;IAC/F,cAAc,EAAE,MAAM,CAAC;IACvB,sDAAsD;IACtD,OAAO,EAAE,WAAW,CAAC;IACrB;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB;;;;;;;OAOG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB,oFAAoF;IACpF,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,OAAO,EAAE,MAAM,OAAO,CAAC;IACvB,QAAQ,EAAE,MAAM,eAA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C;IAErC;;;;;;OAMG;IACH,oBAAoB,CAAC,EAAE;QACrB,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,6GAA6G;IAC7G,uBAAuB,CAAC,EAAE,WAAW,GAAG,YAAY,GAAG,WAAW,CAAC;CACpE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Country } from './countries';
|
|
2
|
+
import type { PhoneInputValue } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* The country's true calling code ("1" for Jamaica), as opposed to the
|
|
5
|
+
* extended `dialCode` ("1876") the picker shows to tell the NANP territories
|
|
6
|
+
* apart. Concatenating the latter with a national number double-counts the
|
|
7
|
+
* area code, so every international string is built from this instead.
|
|
8
|
+
*/
|
|
9
|
+
export declare function callingCodeFor(country: Country): string;
|
|
10
|
+
export declare function buildValue(nationalNumber: string, country: Country): PhoneInputValue;
|
|
11
|
+
/**
|
|
12
|
+
* Splits a controlled `value` into the national digits and, when the value is
|
|
13
|
+
* an international string, the country it implies. `current` is kept whenever
|
|
14
|
+
* its calling code still matches, so an explicit pick among the countries
|
|
15
|
+
* sharing a calling code (Jamaica vs the US on "+1") is not undone by the
|
|
16
|
+
* next keystroke.
|
|
17
|
+
*/
|
|
18
|
+
export declare function readControlledValue(raw: string, current: Country): {
|
|
19
|
+
national: string;
|
|
20
|
+
country: Country;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value.d.ts","sourceRoot":"","sources":["../../../../src/value.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAMvD;AAED,wBAAgB,UAAU,CACxB,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,OAAO,GACf,eAAe,CAcjB;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,GACf;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAgBxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type Country } from './countries.js';
|
|
3
|
+
import { type PhoneInputPalette } from './theme.js';
|
|
4
|
+
import type { CountryPickerRenderItemInfo, CountryPickerStyles, PhoneInputColorScheme } from './types.js';
|
|
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,gBAAa,CAAC;AAGnE,OAAO,EAAwB,KAAK,iBAAiB,EAAE,MAAM,YAAS,CAAC;AACvE,OAAO,KAAK,EACV,2BAA2B,EAC3B,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,YAAS,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.js';
|
|
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,gBAAa,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 @@
|
|
|
1
|
+
{"version":3,"file":"PhoneInput.d.ts","sourceRoot":"","sources":["../../../../src/PhoneInput.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAW,eAAe,EAAE,aAAa,EAAE,MAAM,YAAS,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.js';
|
|
2
|
+
export type { Country, CountrySection } from './countries.js';
|
|
3
|
+
export { Flag } from './Flag.js';
|
|
4
|
+
export { PhoneInput } from './PhoneInput.js';
|
|
5
|
+
export { CountryPicker } from './CountryPicker.js';
|
|
6
|
+
export { LIGHT_PALETTE, DARK_PALETTE, usePhoneInputPalette } from './theme.js';
|
|
7
|
+
export type { PhoneInputPalette, PhoneInputColorScheme } from './theme.js';
|
|
8
|
+
export type { PhoneInputProps, PhoneInputRef, PhoneInputValue, PhoneInputTheme, CountryPickerRenderItemInfo, CountryDisplayMode, CountryPickerStyles, } from './types.js';
|
|
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,gBAAa,CAAC;AACrB,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAa,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAQ,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,YAAS,CAAC;AAC5E,YAAY,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,YAAS,CAAC;AACxE,YAAY,EACV,eAAe,EACf,aAAa,EACb,eAAe,EACf,eAAe,EACf,2BAA2B,EAC3B,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,YAAS,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.js';
|
|
4
|
+
import type { PhoneInputColorScheme, PhoneInputPalette } from './theme.js';
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,YAAS,CAAC;AAExE,YAAY,EAAE,OAAO,EAAE,CAAC;AACxB,YAAY,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,CAAC;AAEzD,MAAM,WAAW,eAAe;IAC9B,+FAA+F;IAC/F,cAAc,EAAE,MAAM,CAAC;IACvB,sDAAsD;IACtD,OAAO,EAAE,WAAW,CAAC;IACrB;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,gEAAg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AC,SAAS,CAAC,CAAC;IACjC,wBAAwB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAChD,iGAAiG;IACjG,YAAY,CAAC,EAAE,mBAAmB,CAAC;IAEnC,8DAA8D;IAC9D,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB;;;OAGG;IACH,WAAW,CAAC,EAAE,qBAAqB,CAAC;IACpC;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAErC;;;;;;OAMG;IACH,oBAAoB,CAAC,EAAE;QACrB,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,6GAA6G;IAC7G,uBAAuB,CAAC,EAAE,WAAW,GAAG,YAAY,GAAG,WAAW,CAAC;CACpE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Country } from './countries.js';
|
|
2
|
+
import type { PhoneInputValue } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The country's true calling code ("1" for Jamaica), as opposed to the
|
|
5
|
+
* extended `dialCode` ("1876") the picker shows to tell the NANP territories
|
|
6
|
+
* apart. Concatenating the latter with a national number double-counts the
|
|
7
|
+
* area code, so every international string is built from this instead.
|
|
8
|
+
*/
|
|
9
|
+
export declare function callingCodeFor(country: Country): string;
|
|
10
|
+
export declare function buildValue(nationalNumber: string, country: Country): PhoneInputValue;
|
|
11
|
+
/**
|
|
12
|
+
* Splits a controlled `value` into the national digits and, when the value is
|
|
13
|
+
* an international string, the country it implies. `current` is kept whenever
|
|
14
|
+
* its calling code still matches, so an explicit pick among the countries
|
|
15
|
+
* sharing a calling code (Jamaica vs the US on "+1") is not undone by the
|
|
16
|
+
* next keystroke.
|
|
17
|
+
*/
|
|
18
|
+
export declare function readControlledValue(raw: string, current: Country): {
|
|
19
|
+
national: string;
|
|
20
|
+
country: Country;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value.d.ts","sourceRoot":"","sources":["../../../../src/value.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAS,CAAC;AAE/C;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAMvD;AAED,wBAAgB,UAAU,CACxB,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,OAAO,GACf,eAAe,CAcjB;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,GACf;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAgBxC"}
|