# phone-input-sdk
Universal local phone input for Ringnoted and Esimandco. No networking, database,
call test, length restriction, or validity claim. Install the immutable source
package, pinned in each consumer manifest and lockfile.
```js
import {normalizePhone} from 'phone-input-sdk';
normalizePhone('06 12 34 56 78', {country:'FR'}).dialingValue; // +33612345678
normalizePhone('0033 6 12 34 56 78').dialingValue; // +33612345678
normalizePhone('331234', {country:'FR'}).dialingValue; // +33331234
```
```svelte
phone = state.dialingValue}/>
```
Native: `PhoneInput` from `phone-input-sdk/native`, with `value` and `onChange`.
Pass styled primitives through `components` and theme properties through
`inputProps`. DOM: `mountPhoneInput(container, {value, onChange})` from
`phone-input-sdk/dom`; call `destroy()` when disposing the owning view.
State includes selected `country` (nullable), `callingCode` (with +), unmodified
`rawLocal`, editable `localInput`, normalized `nationalNumber`, `dialingValue`,
and `error`. Incomplete or unsupported characters produce an empty dialing
value without deleting the editing text. National prefix handling uses pinned
libphonenumber-js metadata, never isValid/isPossible. Provider acceptance remains
the product's responsibility. Existing saved values are not rewritten on mount.
Contract: https://phone-input-sdk.pages.dev/example.
Remote verification: GitHub Actions SDK checks; no local frontend tests/builds.
Adapters show a country/flag/calling-code selector and a phone input, without a
manual calling-code field. International +/00 numbers automatically update the
selector using libphonenumber-js detection. Ambiguous or non-geographic codes
show a globe and the detected code. National numbers use the selected country.
Spacing is applied while typing using country metadata. National trunk zeros
are accepted with or without the prefix; significant zeros (Italy) stay intact.
localInput contains formatted text; rawLocal retains the exact incoming text.
Formatting never truncates digits or imposes a number-length check.
Web country selectors accept keyboard searches by country name or calling code
(33, +33, 0033), with flagged suggestions. Shared codes require choosing a country;
unrecognized search text never changes the saved selection.
The Svelte country combobox supports typing, a dropdown button, arrow keys,
Enter, Escape, and pointer selection. Every phone input event normalizes and
formats locally, including paste and deletion. Web adapters preserve the caret
and allow Backspace/Delete across generated separators. Country changes reformat
the existing number immediately. No network request or length validation is used.