@flipdish/ui-library 0.63.0 → 0.64.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 (78) hide show
  1. package/README.md +12 -11
  2. package/dist/components/__internal__/listOption/listOption.styles.cjs +20 -0
  3. package/dist/components/__internal__/listOption/listOption.styles.cjs.map +1 -0
  4. package/dist/components/__internal__/listOption/listOption.styles.d.ts +16 -0
  5. package/dist/components/__internal__/listOption/listOption.styles.d.ts.map +1 -0
  6. package/dist/components/__internal__/listOption/listOption.styles.js +18 -0
  7. package/dist/components/__internal__/listOption/listOption.styles.js.map +1 -0
  8. package/dist/components/atoms/PhoneInput/components/PhoneInputCountrySelect.cjs +35 -0
  9. package/dist/components/atoms/PhoneInput/components/PhoneInputCountrySelect.cjs.map +1 -0
  10. package/dist/components/atoms/PhoneInput/components/PhoneInputCountrySelect.d.ts +24 -0
  11. package/dist/components/atoms/PhoneInput/components/PhoneInputCountrySelect.d.ts.map +1 -0
  12. package/dist/components/atoms/PhoneInput/components/PhoneInputCountrySelect.js +33 -0
  13. package/dist/components/atoms/PhoneInput/components/PhoneInputCountrySelect.js.map +1 -0
  14. package/dist/components/atoms/PhoneInput/hooks/usePhoneEntry.cjs +100 -0
  15. package/dist/components/atoms/PhoneInput/hooks/usePhoneEntry.cjs.map +1 -0
  16. package/dist/components/atoms/PhoneInput/hooks/usePhoneEntry.d.ts +35 -0
  17. package/dist/components/atoms/PhoneInput/hooks/usePhoneEntry.d.ts.map +1 -0
  18. package/dist/components/atoms/PhoneInput/hooks/usePhoneEntry.js +98 -0
  19. package/dist/components/atoms/PhoneInput/hooks/usePhoneEntry.js.map +1 -0
  20. package/dist/components/atoms/PhoneInput/index.cjs +79 -0
  21. package/dist/components/atoms/PhoneInput/index.cjs.map +1 -0
  22. package/dist/components/atoms/PhoneInput/index.d.ts +48 -0
  23. package/dist/components/atoms/PhoneInput/index.d.ts.map +1 -0
  24. package/dist/components/atoms/PhoneInput/index.js +77 -0
  25. package/dist/components/atoms/PhoneInput/index.js.map +1 -0
  26. package/dist/components/atoms/PhoneInput/phoneInput.types.d.ts +17 -0
  27. package/dist/components/atoms/PhoneInput/phoneInput.types.d.ts.map +1 -0
  28. package/dist/components/atoms/PhoneInput/utilities/phoneInput.utils.cjs +304 -0
  29. package/dist/components/atoms/PhoneInput/utilities/phoneInput.utils.cjs.map +1 -0
  30. package/dist/components/atoms/PhoneInput/utilities/phoneInput.utils.d.ts +147 -0
  31. package/dist/components/atoms/PhoneInput/utilities/phoneInput.utils.d.ts.map +1 -0
  32. package/dist/components/atoms/PhoneInput/utilities/phoneInput.utils.js +288 -0
  33. package/dist/components/atoms/PhoneInput/utilities/phoneInput.utils.js.map +1 -0
  34. package/dist/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.cjs +10 -1
  35. package/dist/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.cjs.map +1 -1
  36. package/dist/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.d.ts.map +1 -1
  37. package/dist/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.js +10 -1
  38. package/dist/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.js.map +1 -1
  39. package/dist/components/forms/fields/FormPhoneInput/index.cjs +36 -0
  40. package/dist/components/forms/fields/FormPhoneInput/index.cjs.map +1 -0
  41. package/dist/components/forms/fields/FormPhoneInput/index.d.ts +19 -0
  42. package/dist/components/forms/fields/FormPhoneInput/index.d.ts.map +1 -0
  43. package/dist/components/forms/fields/FormPhoneInput/index.js +34 -0
  44. package/dist/components/forms/fields/FormPhoneInput/index.js.map +1 -0
  45. package/dist/components/forms/validation/index.cjs +25 -56
  46. package/dist/components/forms/validation/index.cjs.map +1 -1
  47. package/dist/components/forms/validation/index.d.ts +2 -12
  48. package/dist/components/forms/validation/index.d.ts.map +1 -1
  49. package/dist/components/forms/validation/index.js +1 -32
  50. package/dist/components/forms/validation/index.js.map +1 -1
  51. package/dist/components/forms/validation/phoneNumber/index.cjs +20 -0
  52. package/dist/components/forms/validation/phoneNumber/index.cjs.map +1 -0
  53. package/dist/components/forms/validation/phoneNumber/index.d.ts +14 -0
  54. package/dist/components/forms/validation/phoneNumber/index.d.ts.map +1 -0
  55. package/dist/components/forms/validation/phoneNumber/index.js +18 -0
  56. package/dist/components/forms/validation/phoneNumber/index.js.map +1 -0
  57. package/dist/components/forms/validation/utilities/validation.utils.cjs +34 -0
  58. package/dist/components/forms/validation/utilities/validation.utils.cjs.map +1 -1
  59. package/dist/components/forms/validation/utilities/validation.utils.d.ts +29 -1
  60. package/dist/components/forms/validation/utilities/validation.utils.d.ts.map +1 -1
  61. package/dist/components/forms/validation/utilities/validation.utils.js +33 -2
  62. package/dist/components/forms/validation/utilities/validation.utils.js.map +1 -1
  63. package/dist/components/forms/validation/validation.types.d.ts +10 -0
  64. package/dist/components/forms/validation/validation.types.d.ts.map +1 -1
  65. package/dist/components/molecules/Selects/Select/components/Popover.cjs +2 -3
  66. package/dist/components/molecules/Selects/Select/components/Popover.cjs.map +1 -1
  67. package/dist/components/molecules/Selects/Select/components/Popover.d.ts.map +1 -1
  68. package/dist/components/molecules/Selects/Select/components/Popover.js +2 -3
  69. package/dist/components/molecules/Selects/Select/components/Popover.js.map +1 -1
  70. package/dist/components/molecules/Selects/components/SelectItem.cjs +2 -1
  71. package/dist/components/molecules/Selects/components/SelectItem.cjs.map +1 -1
  72. package/dist/components/molecules/Selects/components/SelectItem.d.ts.map +1 -1
  73. package/dist/components/molecules/Selects/components/SelectItem.js +2 -1
  74. package/dist/components/molecules/Selects/components/SelectItem.js.map +1 -1
  75. package/dist/native/components/atoms/PhoneInput/index.d.ts +12 -0
  76. package/dist/native/components/forms/fields/FormPhoneInput/index.d.ts +12 -0
  77. package/dist/native/components/forms/validation/phoneNumber/index.d.ts +12 -0
  78. package/package.json +6 -1
@@ -0,0 +1,48 @@
1
+ import type { CountryCode } from '@flipdish/ui-library/components/atoms/Flag';
2
+ import { type FocusEvent, type ReactNode, type Ref } from 'react';
3
+ import type { TextFieldProps as AriaTextFieldProps } from 'react-aria-components';
4
+ export interface PhoneInputProps extends Omit<AriaTextFieldProps, 'value' | 'defaultValue' | 'onChange' | 'type' | 'inputMode' | 'children' | 'validate' | 'pattern' | 'minLength' | 'maxLength' | 'onFocus' | 'onFocusChange'> {
5
+ /** Label text above the field; it names the number input. When omitted, pass `aria-label`. */
6
+ label?: string;
7
+ /** Helper text beneath the field, read out as its description; shown as the error message while the field is invalid. */
8
+ hint?: ReactNode;
9
+ /** Sets the field's height, padding and text size. */
10
+ size?: 'sm' | 'md' | 'lg';
11
+ /** The number in international form, such as `+353861234567`, when the field is controlled; `''` for none. */
12
+ value?: string;
13
+ /** The international number the field starts with, when it is not controlled. */
14
+ defaultValue?: string;
15
+ /** Called with the international number as it is typed, as far as it goes, and with `''` once it is cleared. */
16
+ onChange?: (value: string) => void;
17
+ /**
18
+ * The country an empty field shows until the user picks one, and follows while the field stays empty. Without it, the
19
+ * region the user's locale names, or Ireland; with `countries`, only a country in that list.
20
+ */
21
+ defaultCountry?: CountryCode;
22
+ /**
23
+ * Limits the list to these countries; every country without it. Without `defaultCountry`, the field starts on the
24
+ * locale's region when it is listed, else on the first code given. A number from another country stays as written.
25
+ */
26
+ countries?: readonly CountryCode[];
27
+ /** Called with the country the user picks from the list, after `onChange` has the number it gives. */
28
+ onCountryChange?: (country: CountryCode) => void;
29
+ /** Called once focus leaves the whole field: the number, the country trigger and its open list. */
30
+ onBlur?: (event: FocusEvent<Element>) => void;
31
+ /** Ref attached to the bordered group that holds the country trigger and the number. */
32
+ groupRef?: Ref<HTMLDivElement>;
33
+ /** Replaces the example number shown while the field is empty. */
34
+ placeholder?: string;
35
+ /** Hides the asterisk a required field shows beside its label. */
36
+ hideRequiredIndicator?: boolean;
37
+ /** Overrides the root `data-testid` (defaults to `fd-phone-input`). The country trigger, its options and the input derive theirs from it. */
38
+ 'data-testid'?: string;
39
+ }
40
+ /**
41
+ * A phone number field with a country picker: the user chooses a country and types the number the way it is written
42
+ * there, and the field reports one international number. Reach for it wherever a phone number is collected; it needs
43
+ * the optional `libphonenumber-js` package.
44
+ *
45
+ * @summary phone number field with a country picker
46
+ */
47
+ export declare const PhoneInput: import("react").ForwardRefExoticComponent<PhoneInputProps & import("react").RefAttributes<HTMLInputElement>>;
48
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/PhoneInput/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAK9E,OAAO,EAAoB,KAAK,UAAU,EAAc,KAAK,SAAS,EAAE,KAAK,GAAG,EAAoC,MAAM,OAAO,CAAC;AAClI,OAAO,KAAK,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAclF,MAAM,WAAW,eACf,SAAQ,IAAI,CACV,kBAAkB,EAChB,OAAO,GACP,cAAc,GACd,UAAU,GACV,MAAM,GACN,WAAW,GACX,UAAU,GACV,UAAU,GACV,SAAS,GACT,WAAW,GACX,WAAW,GACX,SAAS,GACT,eAAe,CAClB;IACD,8FAA8F;IAC9F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yHAAyH;IACzH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,sDAAsD;IACtD,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,8GAA8G;IAC9G,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iFAAiF;IACjF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gHAAgH;IAChH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC;;;OAGG;IACH,cAAc,CAAC,EAAE,WAAW,CAAC;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;IACnC,sGAAsG;IACtG,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IACjD,mGAAmG;IACnG,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IAC9C,wFAAwF;IACxF,QAAQ,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC/B,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,6IAA6I;IAC7I,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,8GAwItB,CAAC"}
@@ -0,0 +1,77 @@
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import { InfoCircle } from '@flipdish/ui-icons';
3
+ import { TextField, Label, HintText } from '@flipdish/ui-library/components/atoms/Inputs';
4
+ import { cx } from '@flipdish/ui-library/utilities/cx';
5
+ import { useResolvedTestId, joinTestId } from '@flipdish/ui-library/utilities/testIdUtils';
6
+ import { mergeRefs, useFormReset } from '@react-aria/utils';
7
+ import { forwardRef, useMemo, useRef, useLayoutEffect } from 'react';
8
+ import { useLocale, Group, Input } from 'react-aria-components';
9
+ import { PhoneInputCountrySelect } from './components/PhoneInputCountrySelect.js';
10
+ import { usePhoneEntry } from './hooks/usePhoneEntry.js';
11
+ import { offeredCountries, countryOptions, startingCountry, exampleNumber, isFocusInside } from './utilities/phoneInput.utils.js';
12
+
13
+ const sizes = {
14
+ sm: { input: 'py-2 pr-3 pl-1.5 text-sm', invalid: 'pr-9', icon: 'right-3' },
15
+ md: { input: 'py-2 pr-3 pl-1.5 text-md', invalid: 'pr-9', icon: 'right-3' },
16
+ lg: { input: 'py-2.5 pr-3.5 pl-1.5 text-md', invalid: 'pr-9.5', icon: 'right-3.5' },
17
+ };
18
+ /**
19
+ * A phone number field with a country picker: the user chooses a country and types the number the way it is written
20
+ * there, and the field reports one international number. Reach for it wherever a phone number is collected; it needs
21
+ * the optional `libphonenumber-js` package.
22
+ *
23
+ * @summary phone number field with a country picker
24
+ */
25
+ const PhoneInput = forwardRef(({ label, hint, size = 'md', value: valueProp, defaultValue, onChange, defaultCountry, countries: allowedCountries, onCountryChange, onBlur, groupRef: groupRefProp, placeholder, hideRequiredIndicator, name, autoComplete = 'tel', className, 'data-testid': dataTestId, ...props }, ref) => {
26
+ const rootTestId = useResolvedTestId({ testId: dataTestId, segment: 'phone-input', rootName: 'phone-input' });
27
+ const { locale } = useLocale();
28
+ // Keyed on the codes, so an array written inline, new each render, does not rebuild the list.
29
+ const countriesKey = allowedCountries?.join(',');
30
+ const allowed = useMemo(() => offeredCountries(countriesKey), [countriesKey]);
31
+ const options = useMemo(() => countryOptions(locale, allowed), [locale, allowed]);
32
+ const { country, text, value, type, chooseCountry, settle, reset } = usePhoneEntry({
33
+ value: valueProp,
34
+ defaultValue,
35
+ onChange,
36
+ defaultCountry: startingCountry(defaultCountry, locale, allowed),
37
+ allowed,
38
+ });
39
+ const chosen = useMemo(() => countryOptions(locale, [country])[0], [locale, country]);
40
+ const groupRef = useRef(null);
41
+ const mergedGroupRef = useMemo(() => mergeRefs(groupRef, groupRefProp), [groupRefProp]);
42
+ const listRef = useRef(null);
43
+ const inputRef = useRef(null);
44
+ const mergedRef = useMemo(() => mergeRefs(inputRef, ref), [ref]);
45
+ // The text field resets only the text it is handed, so the number, the country and the posted value reset here.
46
+ useFormReset(inputRef, undefined, reset);
47
+ // Reformatting moves the text under the cursor, and the browser then drops it at the end: put back beside the digit it was at.
48
+ const caret = useRef(null);
49
+ const handleChange = (event) => {
50
+ const { value: next, selectionStart } = event.target;
51
+ const { inputType } = event.nativeEvent;
52
+ caret.current = type({ previous: text, next, caret: selectionStart ?? next.length, inputType });
53
+ };
54
+ useLayoutEffect(() => {
55
+ if (caret.current === null)
56
+ return;
57
+ inputRef.current?.setSelectionRange(caret.current, caret.current);
58
+ caret.current = null;
59
+ });
60
+ // Moving between the number, the trigger and its list stays inside the field; the list renders in a portal, so it is checked apart.
61
+ const handleBlur = (event) => {
62
+ if (isFocusInside(event.relatedTarget, [groupRef.current, listRef.current]))
63
+ return;
64
+ settle();
65
+ onBlur?.(event);
66
+ };
67
+ const handleCountryChange = (code) => {
68
+ chooseCountry(code);
69
+ onCountryChange?.(code);
70
+ };
71
+ const { isDisabled, isReadOnly } = props;
72
+ return (jsx(TextField, { ...props, value: text, type: "tel", autoComplete: autoComplete, size: size, "data-testid": rootTestId, className: className, children: ({ isInvalid, isRequired }) => (jsxs(Fragment, { children: [label && (jsx(Label, { isRequired: hideRequiredIndicator ? false : isRequired, isInvalid: isInvalid, children: label })), jsxs(Group, { ref: mergedGroupRef, onBlur: handleBlur, isDisabled: isDisabled, isInvalid: isInvalid, className: ({ isFocusWithin }) => cx('group/input relative flex w-full flex-row items-center rounded-lg bg-primary shadow-xs ring-1 ring-primary transition-shadow duration-100 ease-linear ring-inset', isFocusWithin && !isDisabled && 'ring-2 ring-brand', isDisabled && 'cursor-not-allowed opacity-50', isInvalid && 'ring-error_subtle', isInvalid && isFocusWithin && 'ring-2 ring-error'), children: [jsx(PhoneInputCountrySelect, { country: chosen, countries: options, onChange: handleCountryChange, size: size, isDisabled: isDisabled || isReadOnly, hasFieldLabel: Boolean(label), groupRef: groupRef, listRef: listRef, testId: rootTestId }), jsx(Input, { ref: mergedRef, onChange: handleChange, placeholder: placeholder ?? exampleNumber(country), "data-testid": joinTestId(rootTestId, 'input'), className: cx('m-0 w-full min-w-0 bg-transparent text-primary tabular-nums ring-0 outline-hidden placeholder:text-placeholder autofill:rounded-lg autofill:text-primary disabled:cursor-not-allowed', sizes[size].input, isInvalid && sizes[size].invalid) }), isInvalid && (jsx(InfoCircle, { className: cx('pointer-events-none absolute size-4 stroke-[2.25px] text-fg-error-secondary', sizes[size].icon) }))] }), hint && jsx(HintText, { isInvalid: isInvalid, children: hint }), name && jsx("input", { type: "hidden", name: name, value: value, form: props.form, disabled: isDisabled })] })) }));
73
+ });
74
+ PhoneInput.displayName = 'PhoneInput';
75
+
76
+ export { PhoneInput };
77
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/atoms/PhoneInput/index.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","_Fragment","AriaGroup","AriaInput"],"mappings":";;;;;;;;;;;;AAgBA,MAAM,KAAK,GAAG;AACZ,IAAA,EAAE,EAAE,EAAE,KAAK,EAAE,0BAA0B,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE;AAC3E,IAAA,EAAE,EAAE,EAAE,KAAK,EAAE,0BAA0B,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE;AAC3E,IAAA,EAAE,EAAE,EAAE,KAAK,EAAE,8BAA8B,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE;CACpF;AAuDD;;;;;;AAMG;AACI,MAAM,UAAU,GAAG,UAAU,CAClC,CACE,EACE,KAAK,EACL,IAAI,EACJ,IAAI,GAAG,IAAI,EACX,KAAK,EAAE,SAAS,EAChB,YAAY,EACZ,QAAQ,EACR,cAAc,EACd,SAAS,EAAE,gBAAgB,EAC3B,eAAe,EACf,MAAM,EACN,QAAQ,EAAE,YAAY,EACtB,WAAW,EACX,qBAAqB,EACrB,IAAI,EACJ,YAAY,GAAG,KAAK,EACpB,SAAS,EACT,aAAa,EAAE,UAAU,EACzB,GAAG,KAAK,EACT,EACD,GAAG,KACD;AACF,IAAA,MAAM,UAAU,GAAG,iBAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;AAC7G,IAAA,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE;;IAE9B,MAAM,YAAY,GAAG,gBAAgB,EAAE,IAAI,CAAC,GAAG,CAAC;AA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E,CAAC,6EAA6E,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAA,CAAI,CAC/H,CAAA,EAAA,CACS,EAEX,IAAI,IAAIA,GAAA,CAAC,QAAQ,IAAC,SAAS,EAAE,SAAS,EAAA,QAAA,EAAG,IAAI,EAAA,CAAY,EAGzD,IAAI,IAAIA,GAAA,CAAA,OAAA,EAAA,EAAO,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAA,CAAI,CAAA,EAAA,CACjG,CACJ,EAAA,CACS;AAEhB,CAAC;AAGH,UAAU,CAAC,WAAW,GAAG,YAAY;;"}
@@ -0,0 +1,17 @@
1
+ import type { CountryCode } from 'libphonenumber-js/min';
2
+ /** A country the phone library has numbering rules for. */
3
+ export type PhoneCountryCode = CountryCode;
4
+ /** One row of the country list. */
5
+ export interface PhoneCountry {
6
+ code: PhoneCountryCode;
7
+ /** The country's name in the user's language. */
8
+ name: string;
9
+ /** The digits dialled before the national number, without the plus. */
10
+ callingCode: string;
11
+ }
12
+ /** What the field shows: the chosen country and the number as typed, in that country's national format. */
13
+ export interface PhoneEntry {
14
+ country: PhoneCountryCode;
15
+ text: string;
16
+ }
17
+ //# sourceMappingURL=phoneInput.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phoneInput.types.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/PhoneInput/phoneInput.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,2DAA2D;AAC3D,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC;AAE3C,mCAAmC;AACnC,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,gBAAgB,CAAC;IACvB,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,2GAA2G;AAC3G,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;CACd"}
@@ -0,0 +1,304 @@
1
+ 'use strict';
2
+
3
+ var min = require('libphonenumber-js/min');
4
+ var metadata = require('libphonenumber-js/min/metadata');
5
+ var examples = require('libphonenumber-js/mobile/examples');
6
+ var flag_utils = require('../../Flag/flag.utils.cjs');
7
+
8
+ // Where an empty field starts when neither the app nor the user's locale names a country.
9
+ const FALLBACK_COUNTRY = 'IE';
10
+ /**
11
+ * Reads the characters of a phone number that count: its digits, in any script, and a plus only where it leads.
12
+ *
13
+ * @param text The number as typed or pasted, with any spaces, brackets and dashes.
14
+ * @returns The digits as ASCII, after a leading plus when the text has one before any digit.
15
+ */
16
+ const significantChars = (text) => {
17
+ let significant = '';
18
+ for (const char of text) {
19
+ if (char === '+') {
20
+ if (significant === '')
21
+ significant = '+';
22
+ }
23
+ else {
24
+ significant += min.parseDigits(char);
25
+ }
26
+ }
27
+ return significant;
28
+ };
29
+ /**
30
+ * Finds where the cursor belongs in a formatted number, so it stays beside the digit the user was at when the spacing changes.
31
+ *
32
+ * @param text The formatted number.
33
+ * @param position How many significant characters sit before the cursor.
34
+ * @returns The index in `text` just after that many significant characters: before the first one for none, and the end once every one is passed.
35
+ */
36
+ const caretAfter = (text, position) => {
37
+ let seen = 0;
38
+ for (let index = 0; index < text.length; index++) {
39
+ const isSignificant = /\d/.test(text[index]) || (text[index] === '+' && seen === 0);
40
+ if (!isSignificant)
41
+ continue;
42
+ if (position <= 0)
43
+ return index;
44
+ seen++;
45
+ if (seen === position)
46
+ return /\d/.test(text.slice(index + 1)) ? index + 1 : text.length;
47
+ }
48
+ return text.length;
49
+ };
50
+ /**
51
+ * Reads an edit to the formatted number as an edit to its digits. A delete that took only a space or a bracket would
52
+ * format back to the same text, so it takes the digit beside it instead.
53
+ *
54
+ * @param edit The text before and after the edit, the cursor and the kind of edit.
55
+ * @returns The significant characters after the edit, and how many of them sit before the cursor.
56
+ */
57
+ const editedDigits = ({ previous, next, caret, inputType }) => {
58
+ const significant = significantChars(next);
59
+ const position = significantChars(next.slice(0, caret)).length;
60
+ const isDelete = inputType ? inputType.startsWith('delete') : next.length < previous.length;
61
+ if (!isDelete || significant !== significantChars(previous))
62
+ return { significant, position };
63
+ const isForward = inputType === 'deleteContentForward';
64
+ const index = isForward ? position : position - 1;
65
+ if (index < 0 || index >= significant.length)
66
+ return { significant, position };
67
+ return { significant: significant.slice(0, index) + significant.slice(index + 1), position: index };
68
+ };
69
+ /**
70
+ * Formats a number as it is typed, in a country's national style, or internationally when it starts with a plus.
71
+ *
72
+ * @param country The country whose style applies.
73
+ * @param significant The digits typed so far, after a plus for an international number.
74
+ * @returns The number spaced as that country writes it, as far as it has been typed. Digits typed without the country's
75
+ * trunk prefix, as after a calling code, are spaced as the international form spaces them.
76
+ */
77
+ const formatTyped = (country, significant) => {
78
+ const national = new min.AsYouType(country).input(significant);
79
+ if (significant.startsWith('+') || national !== significant)
80
+ return national;
81
+ // The national format of many countries needs the trunk prefix, so a number typed without it would get no spacing at all.
82
+ const callingCode = min.getCountryCallingCode(country);
83
+ return new min.AsYouType().input(`+${callingCode}${significant}`).replace(`+${callingCode}`, '').trim();
84
+ };
85
+ /**
86
+ * Writes what the field shows as one international number, the form an API stores.
87
+ *
88
+ * @param entry The chosen country and the number as typed.
89
+ * @returns The number in E.164 form, such as `+353861234567`, as far as it has been typed, or `''` before any digit that counts.
90
+ */
91
+ const toInternational = ({ country, text }) => {
92
+ const typed = new min.AsYouType(country);
93
+ typed.input(text);
94
+ return typed.getNumber()?.number ?? '';
95
+ };
96
+ /**
97
+ * Finds the calling code a run of digits starts with. No calling code starts with another, so the first match is the code.
98
+ *
99
+ * @param digits The digits after a plus.
100
+ * @returns The calling code, or `undefined` while the digits are not yet one.
101
+ */
102
+ const leadingCallingCode = (digits) => {
103
+ for (let length = 1; length <= Math.min(3, digits.length); length++) {
104
+ const code = digits.slice(0, length);
105
+ if (code in metadata.country_calling_codes)
106
+ return code;
107
+ }
108
+ return undefined;
109
+ };
110
+ /**
111
+ * Picks the country an international number belongs to. The library tells most numbers apart by their digits, such as
112
+ * a Canadian or a Jamaican number on +1; where it cannot, as for a number not yet whole, the country the field is on
113
+ * stays when it uses the calling code, and otherwise the code's main country.
114
+ *
115
+ * @param international The number, after a plus.
116
+ * @param current The country the field is on.
117
+ * @param allowed The countries the field offers, when the app restricts them.
118
+ * @returns The country, or `undefined` for a number with no calling code yet or one only countries the field does not offer use.
119
+ */
120
+ const countryForNumber = (international, current, allowed) => {
121
+ const typed = new min.AsYouType();
122
+ typed.input(international);
123
+ const callingCode = typed.getCallingCode();
124
+ if (!callingCode)
125
+ return undefined;
126
+ const possible = typed.getNumber()?.getPossibleCountries() ?? [];
127
+ // The library lists a code's main country first.
128
+ const sharing = (metadata.country_calling_codes[callingCode] ?? []).filter((code) => min.isSupportedCountry(code));
129
+ const candidates = (possible.length > 0 ? possible : sharing).filter((code) => !allowed || allowed.includes(code));
130
+ return candidates.includes(current) ? current : candidates[0];
131
+ };
132
+ /**
133
+ * Reads an international number as the country and national number the field shows, for a saved value or one pasted whole.
134
+ *
135
+ * @param value The number, with its plus and calling code.
136
+ * @param current The country the field is on, kept where the number could belong to it.
137
+ * @param allowed The countries the field offers, when the app restricts them.
138
+ * @returns The country and the number in its national format, or `undefined` for a value that is not an international
139
+ * number or belongs to a country the field does not offer.
140
+ */
141
+ const fromInternational = (value, current, allowed) => {
142
+ const significant = significantChars(value);
143
+ const country = significant.startsWith('+') ? countryForNumber(significant, current, allowed) : undefined;
144
+ if (!country)
145
+ return undefined;
146
+ const typed = new min.AsYouType();
147
+ typed.input(significant);
148
+ const number = typed.getNumber();
149
+ // A whole number is written the way the country writes it, with its trunk prefix; a partial one has no such form yet.
150
+ const text = number?.isPossible() ? number.formatNational() : formatTyped(country, number?.nationalNumber ?? '');
151
+ return { country, text };
152
+ };
153
+ /**
154
+ * Gives the national digits of an international number, as a country switch keeps them.
155
+ *
156
+ * @param international The number, after a plus.
157
+ * @returns The digits after the calling code, or `''` before the code is whole.
158
+ */
159
+ const nationalDigits = (international) => {
160
+ const typed = new min.AsYouType();
161
+ typed.input(international);
162
+ return typed.getNumber()?.nationalNumber ?? '';
163
+ };
164
+ /**
165
+ * Rewrites a number typed with a country's international dialling prefix, such as `00` in Ireland or `011` in the
166
+ * United States, with a plus in its place.
167
+ *
168
+ * @param country The country whose dialling prefix applies.
169
+ * @param significant The digits typed.
170
+ * @param position How many of them sit before the cursor.
171
+ * @returns The number after a plus with the cursor moved to match, `pending` while only the prefix or part of a calling
172
+ * code is typed, or `undefined` for digits that do not start with the prefix.
173
+ */
174
+ const fromDiallingPrefix = (country, significant, position) => {
175
+ const typed = new min.AsYouType(country);
176
+ typed.input(significant);
177
+ if (!typed.isInternational())
178
+ return undefined;
179
+ const callingCode = typed.getCallingCode();
180
+ if (!callingCode)
181
+ return 'pending';
182
+ const international = `+${callingCode}${typed.getNumber()?.nationalNumber ?? ''}`;
183
+ // The prefix gives way to a single plus, so the cursor moves back by the rest of it.
184
+ const prefixLength = significant.length - (international.length - 1);
185
+ return { significant: international, position: Math.max(1, position - prefixLength + 1) };
186
+ };
187
+ /**
188
+ * Works out what the field shows after an edit. National digits are formatted for the country the field is on. A plus,
189
+ * or the country's own dialling prefix such as `00`, starts an international number: once the digits before the cursor
190
+ * hold a whole calling code, the field moves to that code's country and keeps the rest as the national number.
191
+ *
192
+ * @param country The country the field is on.
193
+ * @param significant The significant characters in the field after the edit.
194
+ * @param position How many of them sit before the cursor.
195
+ * @param allowed The countries the field offers, when the app restricts them.
196
+ * @returns The country, text and cursor position to show, or `undefined` while a calling code is still being typed, when
197
+ * the text should stay as the user wrote it. A number from a country the field does not offer stays international.
198
+ */
199
+ const entryFor = (country, significant, position, allowed) => {
200
+ let digits = significant;
201
+ let cursor = position;
202
+ if (!digits.startsWith('+')) {
203
+ const dialled = fromDiallingPrefix(country, digits, cursor);
204
+ if (dialled === 'pending')
205
+ return undefined;
206
+ if (!dialled)
207
+ return { country, text: formatTyped(country, digits), position: cursor };
208
+ ({ significant: digits, position: cursor } = dialled);
209
+ }
210
+ // Only the digits between the plus and the cursor name the country, so a plus typed before a number does not read its digits as a code.
211
+ const before = digits.slice(1, Math.max(1, cursor));
212
+ const callingCode = leadingCallingCode(before);
213
+ if (!callingCode)
214
+ return undefined;
215
+ const entry = fromInternational(digits, country, allowed);
216
+ if (!entry)
217
+ return { country, text: formatTyped(country, digits), position: cursor };
218
+ // The national digits before the cursor, shifted by any trunk prefix the national format adds in front of them.
219
+ const nationalLength = digits.length - 1 - callingCode.length;
220
+ const trunkLength = significantChars(entry.text).length - nationalLength;
221
+ return { ...entry, position: before.length - callingCode.length + Math.max(0, trunkLength) };
222
+ };
223
+ /**
224
+ * Lists the countries the field offers, named and sorted for the user's language.
225
+ *
226
+ * @param locale The user's locale, which names and orders the countries.
227
+ * @param allowed The countries to offer; every country the library knows without it. A code the library does not know is left out.
228
+ * @returns Each country with its name and calling code, in the locale's alphabetical order.
229
+ */
230
+ const countryOptions = (locale, allowed) => {
231
+ // Called with the code alone: `filter` would hand the library its index as a second argument.
232
+ const codes = allowed ? allowed.filter((code) => min.isSupportedCountry(code)) : min.getCountries();
233
+ const { compare } = new Intl.Collator(locale);
234
+ return codes
235
+ .map((code) => ({ code, name: flag_utils.getCountryName(code, locale), callingCode: min.getCountryCallingCode(code) }))
236
+ .sort((first, second) => compare(first.name, second.name));
237
+ };
238
+ /**
239
+ * Gives a number that shows a country's format, for the field's placeholder.
240
+ *
241
+ * @param country The country to show.
242
+ * @returns A mobile number in that country's national format, or `''` when the library has none.
243
+ */
244
+ const exampleNumber = (country) => min.getExampleNumber(country, examples)?.formatNational() ?? '';
245
+ // Reads the tag's region alone, so neither an extension key (`en-u-ca-gregory`) nor a POSIX codeset (`en_US.UTF-8`) is taken for one.
246
+ const localeRegion = (locale) => {
247
+ try {
248
+ return new Intl.Locale(locale.replace(/[.@].*$/, '').replace(/_/g, '-')).region;
249
+ }
250
+ catch {
251
+ return undefined;
252
+ }
253
+ };
254
+ /**
255
+ * Picks the country an empty field starts on.
256
+ *
257
+ * @param requested The country the app asked for, if any.
258
+ * @param locale The user's locale, such as `en-IE`.
259
+ * @param allowed The countries the field offers, in the order the app passed them, when it restricts them.
260
+ * @returns The requested country when the field offers it, else the region the locale names when the field offers it,
261
+ * else the first country offered, else Ireland.
262
+ */
263
+ const startingCountry = (requested, locale, allowed) => {
264
+ const isOffered = (code) => Boolean(code) && min.isSupportedCountry(code) && (!allowed || allowed.includes(code));
265
+ if (isOffered(requested))
266
+ return requested;
267
+ const region = localeRegion(locale);
268
+ if (isOffered(region))
269
+ return region;
270
+ return allowed?.[0] ?? FALLBACK_COUNTRY;
271
+ };
272
+ /**
273
+ * Tells whether focus moving to an element stays inside the field, so leaving one of its parts for another is not a blur.
274
+ *
275
+ * @param next The element taking focus; `null` when focus leaves the page or lands on nothing focusable.
276
+ * @param parts The field's parts: the group that holds the country trigger and the number, and the country list, which
277
+ * renders in a portal outside it; `null` for one not on the page, such as the list while it is closed.
278
+ * @returns `true` when `next` sits inside one of the parts.
279
+ */
280
+ const isFocusInside = (next, parts) => next !== null && parts.some((part) => part?.contains(next));
281
+ /**
282
+ * Reads the countries an app passes as the ones the field offers.
283
+ *
284
+ * @param countries The two-letter codes, in the order the app passed them, joined with commas so a new array each render reads the same.
285
+ * @returns The codes the library knows, in that order, or `undefined` when the app offers every country.
286
+ */
287
+ const offeredCountries = (countries) => countries === undefined ? undefined : countries.split(',').filter((code) => min.isSupportedCountry(code));
288
+
289
+ exports.caretAfter = caretAfter;
290
+ exports.countryForNumber = countryForNumber;
291
+ exports.countryOptions = countryOptions;
292
+ exports.editedDigits = editedDigits;
293
+ exports.entryFor = entryFor;
294
+ exports.exampleNumber = exampleNumber;
295
+ exports.formatTyped = formatTyped;
296
+ exports.fromInternational = fromInternational;
297
+ exports.isFocusInside = isFocusInside;
298
+ exports.leadingCallingCode = leadingCallingCode;
299
+ exports.nationalDigits = nationalDigits;
300
+ exports.offeredCountries = offeredCountries;
301
+ exports.significantChars = significantChars;
302
+ exports.startingCountry = startingCountry;
303
+ exports.toInternational = toInternational;
304
+ //# sourceMappingURL=phoneInput.utils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phoneInput.utils.cjs","sources":["../../../../../src/components/atoms/PhoneInput/utilities/phoneInput.utils.ts"],"sourcesContent":[null],"names":["parseDigits","AsYouType","getCountryCallingCode","isSupportedCountry","getCountries","getCountryName","getExampleNumber"],"mappings":";;;;;;;AAMA;AACA,MAAM,gBAAgB,GAAqB,IAAI;AAE/C;;;;;AAKG;AACI,MAAM,gBAAgB,GAAG,CAAC,IAAY,KAAY;IACvD,IAAI,WAAW,GAAG,EAAE;AACpB,IAAA,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE;AACvB,QAAA,IAAI,IAAI,KAAK,GAAG,EAAE;YAChB,IAAI,WAAW,KAAK,EAAE;gBAAE,WAAW,GAAG,GAAG;QAC3C;aAAO;AACL,YAAA,WAAW,IAAIA,eAAW,CAAC,IAAI,CAAC;QAClC;IACF;AACA,IAAA,OAAO,WAAW;AACpB;AAEA;;;;;;AAMG;MACU,UAAU,GAAG,CAAC,IAAY,EAAE,QAAgB,KAAY;IACnE,IAAI,IAAI,GAAG,CAAC;AACZ,IAAA,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QAChD,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,IAAI,KAAK,CAAC,CAAC;AACnF,QAAA,IAAI,CAAC,aAAa;YAAE;QACpB,IAAI,QAAQ,IAAI,CAAC;AAAE,YAAA,OAAO,KAAK;AAC/B,QAAA,IA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,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAwB,CAAC,CAAC;IACjH,IAAI,SAAS,CAAC,SAAS,CAAC;AAAE,QAAA,OAAO,SAAS;AAC1C,IAAA,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;IACnC,IAAI,SAAS,CAAC,MAAM,CAAC;AAAE,QAAA,OAAO,MAAM;AACpC,IAAA,OAAO,OAAO,GAAG,CAAC,CAAC,IAAI,gBAAgB;AACzC;AAEA;;;;;;;AAOG;AACI,MAAM,aAAa,GAAG,CAAC,IAAwB,EAAE,KAA+B,KACrF,IAAI,KAAK,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,EAAE,QAAQ,CAAC,IAAY,CAAC;AAEpE;;;;;AAKG;AACI,MAAM,gBAAgB,GAAG,CAAC,SAA6B,KAC5D,SAAS,KAAK,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,KAA+BA,sBAAkB,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,147 @@
1
+ import type { PhoneCountry, PhoneCountryCode, PhoneEntry } from '../phoneInput.types';
2
+ /**
3
+ * Reads the characters of a phone number that count: its digits, in any script, and a plus only where it leads.
4
+ *
5
+ * @param text The number as typed or pasted, with any spaces, brackets and dashes.
6
+ * @returns The digits as ASCII, after a leading plus when the text has one before any digit.
7
+ */
8
+ export declare const significantChars: (text: string) => string;
9
+ /**
10
+ * Finds where the cursor belongs in a formatted number, so it stays beside the digit the user was at when the spacing changes.
11
+ *
12
+ * @param text The formatted number.
13
+ * @param position How many significant characters sit before the cursor.
14
+ * @returns The index in `text` just after that many significant characters: before the first one for none, and the end once every one is passed.
15
+ */
16
+ export declare const caretAfter: (text: string, position: number) => number;
17
+ export interface PhoneEdit {
18
+ /** The text the field showed before the edit. */
19
+ previous: string;
20
+ /** The text the browser left in the field after it. */
21
+ next: string;
22
+ /** Where the browser left the cursor in `next`. */
23
+ caret: number;
24
+ /** The native input event's `inputType`, which tells a Backspace from a Delete. */
25
+ inputType?: string;
26
+ }
27
+ /**
28
+ * Reads an edit to the formatted number as an edit to its digits. A delete that took only a space or a bracket would
29
+ * format back to the same text, so it takes the digit beside it instead.
30
+ *
31
+ * @param edit The text before and after the edit, the cursor and the kind of edit.
32
+ * @returns The significant characters after the edit, and how many of them sit before the cursor.
33
+ */
34
+ export declare const editedDigits: ({ previous, next, caret, inputType }: PhoneEdit) => {
35
+ significant: string;
36
+ position: number;
37
+ };
38
+ /**
39
+ * Formats a number as it is typed, in a country's national style, or internationally when it starts with a plus.
40
+ *
41
+ * @param country The country whose style applies.
42
+ * @param significant The digits typed so far, after a plus for an international number.
43
+ * @returns The number spaced as that country writes it, as far as it has been typed. Digits typed without the country's
44
+ * trunk prefix, as after a calling code, are spaced as the international form spaces them.
45
+ */
46
+ export declare const formatTyped: (country: PhoneCountryCode, significant: string) => string;
47
+ /**
48
+ * Writes what the field shows as one international number, the form an API stores.
49
+ *
50
+ * @param entry The chosen country and the number as typed.
51
+ * @returns The number in E.164 form, such as `+353861234567`, as far as it has been typed, or `''` before any digit that counts.
52
+ */
53
+ export declare const toInternational: ({ country, text }: PhoneEntry) => string;
54
+ /**
55
+ * Finds the calling code a run of digits starts with. No calling code starts with another, so the first match is the code.
56
+ *
57
+ * @param digits The digits after a plus.
58
+ * @returns The calling code, or `undefined` while the digits are not yet one.
59
+ */
60
+ export declare const leadingCallingCode: (digits: string) => string | undefined;
61
+ /**
62
+ * Picks the country an international number belongs to. The library tells most numbers apart by their digits, such as
63
+ * a Canadian or a Jamaican number on +1; where it cannot, as for a number not yet whole, the country the field is on
64
+ * stays when it uses the calling code, and otherwise the code's main country.
65
+ *
66
+ * @param international The number, after a plus.
67
+ * @param current The country the field is on.
68
+ * @param allowed The countries the field offers, when the app restricts them.
69
+ * @returns The country, or `undefined` for a number with no calling code yet or one only countries the field does not offer use.
70
+ */
71
+ export declare const countryForNumber: (international: string, current: PhoneCountryCode, allowed?: readonly PhoneCountryCode[]) => PhoneCountryCode | undefined;
72
+ /**
73
+ * Reads an international number as the country and national number the field shows, for a saved value or one pasted whole.
74
+ *
75
+ * @param value The number, with its plus and calling code.
76
+ * @param current The country the field is on, kept where the number could belong to it.
77
+ * @param allowed The countries the field offers, when the app restricts them.
78
+ * @returns The country and the number in its national format, or `undefined` for a value that is not an international
79
+ * number or belongs to a country the field does not offer.
80
+ */
81
+ export declare const fromInternational: (value: string, current: PhoneCountryCode, allowed?: readonly PhoneCountryCode[]) => PhoneEntry | undefined;
82
+ /**
83
+ * Gives the national digits of an international number, as a country switch keeps them.
84
+ *
85
+ * @param international The number, after a plus.
86
+ * @returns The digits after the calling code, or `''` before the code is whole.
87
+ */
88
+ export declare const nationalDigits: (international: string) => string;
89
+ /** What the field shows after an edit: the country, the text and how many significant characters sit before the cursor. */
90
+ export interface TypedEntry extends PhoneEntry {
91
+ position: number;
92
+ }
93
+ /**
94
+ * Works out what the field shows after an edit. National digits are formatted for the country the field is on. A plus,
95
+ * or the country's own dialling prefix such as `00`, starts an international number: once the digits before the cursor
96
+ * hold a whole calling code, the field moves to that code's country and keeps the rest as the national number.
97
+ *
98
+ * @param country The country the field is on.
99
+ * @param significant The significant characters in the field after the edit.
100
+ * @param position How many of them sit before the cursor.
101
+ * @param allowed The countries the field offers, when the app restricts them.
102
+ * @returns The country, text and cursor position to show, or `undefined` while a calling code is still being typed, when
103
+ * the text should stay as the user wrote it. A number from a country the field does not offer stays international.
104
+ */
105
+ export declare const entryFor: (country: PhoneCountryCode, significant: string, position: number, allowed?: readonly PhoneCountryCode[]) => TypedEntry | undefined;
106
+ /**
107
+ * Lists the countries the field offers, named and sorted for the user's language.
108
+ *
109
+ * @param locale The user's locale, which names and orders the countries.
110
+ * @param allowed The countries to offer; every country the library knows without it. A code the library does not know is left out.
111
+ * @returns Each country with its name and calling code, in the locale's alphabetical order.
112
+ */
113
+ export declare const countryOptions: (locale: string, allowed?: readonly string[]) => PhoneCountry[];
114
+ /**
115
+ * Gives a number that shows a country's format, for the field's placeholder.
116
+ *
117
+ * @param country The country to show.
118
+ * @returns A mobile number in that country's national format, or `''` when the library has none.
119
+ */
120
+ export declare const exampleNumber: (country: PhoneCountryCode) => string;
121
+ /**
122
+ * Picks the country an empty field starts on.
123
+ *
124
+ * @param requested The country the app asked for, if any.
125
+ * @param locale The user's locale, such as `en-IE`.
126
+ * @param allowed The countries the field offers, in the order the app passed them, when it restricts them.
127
+ * @returns The requested country when the field offers it, else the region the locale names when the field offers it,
128
+ * else the first country offered, else Ireland.
129
+ */
130
+ export declare const startingCountry: (requested: string | undefined, locale: string, allowed?: readonly PhoneCountryCode[]) => PhoneCountryCode;
131
+ /**
132
+ * Tells whether focus moving to an element stays inside the field, so leaving one of its parts for another is not a blur.
133
+ *
134
+ * @param next The element taking focus; `null` when focus leaves the page or lands on nothing focusable.
135
+ * @param parts The field's parts: the group that holds the country trigger and the number, and the country list, which
136
+ * renders in a portal outside it; `null` for one not on the page, such as the list while it is closed.
137
+ * @returns `true` when `next` sits inside one of the parts.
138
+ */
139
+ export declare const isFocusInside: (next: EventTarget | null, parts: readonly (Node | null)[]) => boolean;
140
+ /**
141
+ * Reads the countries an app passes as the ones the field offers.
142
+ *
143
+ * @param countries The two-letter codes, in the order the app passed them, joined with commas so a new array each render reads the same.
144
+ * @returns The codes the library knows, in that order, or `undefined` when the app offers every country.
145
+ */
146
+ export declare const offeredCountries: (countries: string | undefined) => PhoneCountryCode[] | undefined;
147
+ //# sourceMappingURL=phoneInput.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phoneInput.utils.d.ts","sourceRoot":"","sources":["../../../../../src/components/atoms/PhoneInput/utilities/phoneInput.utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAKtF;;;;;GAKG;AACH,e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