@micromerce/formbuilder-react 1.0.1008 → 1.0.1010
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/dist/components/controls/PhoneInput/PhoneInput.d.ts +19 -0
- package/dist/components/controls/PhoneInput/phone.d.ts +18 -0
- package/dist/components/controls/SubtypeInput/vatId.d.ts +13 -0
- package/dist/formbuilder.js +70 -70
- package/dist/formbuilder.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/utils/subtypes/index.d.ts +1 -1
- package/package.json +2 -1
|
@@ -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>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The vat-id subtype (COP-4587), the editor's copy of the server check (VatIds in form-xhtmlform):
|
|
3
|
+
* a VAT or business tax number with its country prefix — the EU prefix (DE, EL or GR for Greece, XI
|
|
4
|
+
* for Northern Ireland), CHE for Switzerland, otherwise the ISO 3166 code (AU51824753556). Separators
|
|
5
|
+
* and case do not matter. Check digits for EU-27, XI, GB, CH, NO, AU, NZ, CA, IN, BR, MX (shape and
|
|
6
|
+
* date), JP, CN, SG, TR, ported from python-stdnum 2.1; US and ZA by shape; any other ISO country 2 to
|
|
7
|
+
* 20 letters or digits. vatId.test.ts runs the same vectors as the server (vat-id-vectors.json).
|
|
8
|
+
*/
|
|
9
|
+
export type VatIdProblem = "format" | "country" | "checksum";
|
|
10
|
+
/** The value without separators, upper case — how the editor stores it. */
|
|
11
|
+
export declare const compactVatId: (value: string) => string;
|
|
12
|
+
/** Why a value is no valid VAT number, or undefined when it is one. */
|
|
13
|
+
export declare const vatIdProblem: (value: string) => VatIdProblem | undefined;
|