@micromerce/formbuilder-react 1.0.1008 → 1.0.1009

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.
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ import "react-phone-number-input/style.css";
3
+ import { IProps as InputProps } from "../Input/Input";
4
+ /**
5
+ * An input with `custom-attributes.subtype: "phone"` (COP-4586): a country select with its flag next
6
+ * to the number. Any number can be entered — one typed with `+` or `00` switches the country. The
7
+ * country starts as the stored number's, else the browser language's. The form stores E.164
8
+ * (`+493012345678`) and shows it formatted for its country; a stored value in another notation is
9
+ * rewritten to E.164 when the field is left. A check mark shows a valid number; a failing value is
10
+ * the server's business (like every subtype, COP-4585), the editor never blocks a submit. A stored
11
+ * value that is no phone number at all stays a plain input, so nothing is lost.
12
+ *
13
+ * `custom-attributes.phoneCountry` (ISO 3166 alpha-2, optional): the field's country. An empty field
14
+ * starts there instead of at the browser language's, and a value without country code (stored before
15
+ * the field had the subtype) is read there and taken into the form as E.164 right away, so saving the
16
+ * entry stores it that way. The server accepts such a national number too (Subtypes, COP-4586).
17
+ */
18
+ declare const PhoneInput: (props: InputProps) => React.JSX.Element;
19
+ export default PhoneInput;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The phone subtype (COP-4586): a phone number is stored in E.164 (`+493012345678`). The numbering
3
+ * plans are libphonenumber-js's full ("max") metadata, the same data as Google's libphonenumber that
4
+ * the server checks with (Subtypes in form-xhtmlform), so the check mark and the server agree.
5
+ */
6
+ import { Country } from "react-phone-number-input/max";
7
+ /** The country of the browser's language ("de-DE" → DE), when the numbering plans know it. */
8
+ export declare const browserCountry: (languages?: readonly string[]) => Country | undefined;
9
+ /** `custom-attributes.phoneCountry` when the numbering plans know it ("de" counts as DE), else undefined. */
10
+ export declare const knownCountry: (code: unknown) => Country | undefined;
11
+ /** A stored value as E.164, read with `country` when it has no country code; undefined when it is no phone number. */
12
+ export declare const toE164: (value: string, country?: Country) => string | undefined;
13
+ /** The country a stored number belongs to. */
14
+ export declare const countryOf: (value: string) => Country | undefined;
15
+ /** Whether a value is a valid number, written in E.164 — what the server accepts. */
16
+ export declare const isValidE164: (value: string) => boolean;
17
+ /** Country names in the browser's language, for the country select. */
18
+ export declare const countryLabels: (language?: string) => Record<string, string>;