@transferwise/components 0.0.0-experimental-2e23c2a → 0.0.0-experimental-16e2eec
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/build/index.esm.js +185 -343
- package/build/index.esm.js.map +1 -1
- package/build/index.js +184 -342
- package/build/index.js.map +1 -1
- package/build/main.css +1 -3
- package/build/styles/inputs/SelectInput.css +1 -3
- package/build/styles/main.css +1 -3
- package/build/types/common/locale/index.d.ts +26 -43
- package/build/types/common/locale/index.d.ts.map +1 -1
- package/build/types/inputs/SelectInput.d.ts +5 -6
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- package/build/types/phoneNumberInput/PhoneNumberInput.d.ts +22 -27
- package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
- package/build/types/phoneNumberInput/data/countries.d.ts +5 -10
- package/build/types/phoneNumberInput/data/countries.d.ts.map +1 -1
- package/build/types/phoneNumberInput/index.d.ts +1 -1
- package/build/types/phoneNumberInput/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/cleanNumber/cleanNumber.d.ts +1 -1
- package/build/types/phoneNumberInput/utils/cleanNumber/cleanNumber.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/cleanNumber/index.d.ts +1 -1
- package/build/types/phoneNumberInput/utils/cleanNumber/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/excludeCountries/excludeCountries.d.ts +8 -1
- package/build/types/phoneNumberInput/utils/excludeCountries/excludeCountries.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/excludeCountries/index.d.ts +1 -1
- package/build/types/phoneNumberInput/utils/excludeCountries/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/explodeNumberModel/index.d.ts +8 -4
- package/build/types/phoneNumberInput/utils/explodeNumberModel/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/findCountryByCode/index.d.ts +1 -1
- package/build/types/phoneNumberInput/utils/findCountryByCode/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/findCountryByPrefix/index.d.ts +1 -1
- package/build/types/phoneNumberInput/utils/findCountryByPrefix/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.d.ts +2 -1
- package/build/types/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/groupCountriesByPrefix/index.d.ts +1 -1
- package/build/types/phoneNumberInput/utils/groupCountriesByPrefix/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/index.d.ts +11 -13
- package/build/types/phoneNumberInput/utils/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/isStringNumeric/index.d.ts +1 -1
- package/build/types/phoneNumberInput/utils/isStringNumeric/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/isStringNumeric/isStringNumeric.d.ts +1 -1
- package/build/types/phoneNumberInput/utils/isStringNumeric/isStringNumeric.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/isValidPhoneNumber/index.d.ts +1 -1
- package/build/types/phoneNumberInput/utils/isValidPhoneNumber/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.d.ts +6 -1
- package/build/types/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/longestMatchingPrefix/index.d.ts +2 -1
- package/build/types/phoneNumberInput/utils/longestMatchingPrefix/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/setDefaultPrefix/index.d.ts +7 -1
- package/build/types/phoneNumberInput/utils/setDefaultPrefix/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/sortArrayByProperty/index.d.ts +1 -1
- package/build/types/phoneNumberInput/utils/sortArrayByProperty/index.d.ts.map +1 -1
- package/build/types/phoneNumberInput/utils/sortArrayByProperty/sortArrayByProperty.d.ts +1 -1
- package/build/types/phoneNumberInput/utils/sortArrayByProperty/sortArrayByProperty.d.ts.map +1 -1
- package/build/types/utilities/wrapInFragment.d.ts +3 -0
- package/build/types/utilities/wrapInFragment.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/common/locale/{index.spec.js → index.spec.ts} +4 -4
- package/src/common/locale/index.ts +96 -0
- package/src/inputs/SelectInput.css +1 -3
- package/src/inputs/SelectInput.less +1 -4
- package/src/inputs/SelectInput.spec.tsx +0 -26
- package/src/inputs/SelectInput.story.tsx +1 -73
- package/src/inputs/SelectInput.tsx +85 -104
- package/src/main.css +1 -3
- package/src/phoneNumberInput/PhoneNumberInput.spec.js +18 -22
- package/src/phoneNumberInput/PhoneNumberInput.tsx +193 -0
- package/src/phoneNumberInput/data/{countries.js → countries.ts} +9 -1
- package/src/phoneNumberInput/utils/cleanNumber/cleanNumber.ts +3 -0
- package/src/phoneNumberInput/utils/excludeCountries/{excludeCountries.spec.js → excludeCountries.spec.ts} +1 -1
- package/src/phoneNumberInput/utils/excludeCountries/{excludeCountries.js → excludeCountries.ts} +6 -5
- package/src/phoneNumberInput/utils/explodeNumberModel/{explodeNumberModel.spec.js → explodeNumberModel.spec.ts} +1 -1
- package/src/phoneNumberInput/utils/explodeNumberModel/index.ts +24 -0
- package/src/phoneNumberInput/utils/findCountryByCode/{findCountryByCode.spec.js → findCountryByCode.spec.ts} +0 -1
- package/src/phoneNumberInput/utils/findCountryByCode/index.ts +12 -0
- package/src/phoneNumberInput/utils/findCountryByPrefix/index.ts +12 -0
- package/src/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.spec.ts +102 -0
- package/src/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.ts +12 -0
- package/src/phoneNumberInput/utils/{index.js → index.ts} +0 -2
- package/src/phoneNumberInput/utils/isStringNumeric/{isStringNumeric.spec.js → isStringNumeric.spec.ts} +0 -1
- package/src/phoneNumberInput/utils/isStringNumeric/isStringNumeric.ts +1 -0
- package/src/phoneNumberInput/utils/isValidPhoneNumber/{isValidPhoneNumber.spec.js → isValidPhoneNumber.spec.ts} +1 -1
- package/src/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.ts +7 -0
- package/src/phoneNumberInput/utils/longestMatchingPrefix/index.ts +4 -0
- package/src/phoneNumberInput/utils/setDefaultPrefix/index.ts +20 -0
- package/src/phoneNumberInput/utils/sortArrayByProperty/sortArrayByProperty.ts +6 -0
- package/src/utilities/wrapInFragment.tsx +3 -0
- package/build/types/phoneNumberInput/utils/filterOptionsForQuery/index.d.ts +0 -2
- package/build/types/phoneNumberInput/utils/filterOptionsForQuery/index.d.ts.map +0 -1
- package/build/types/phoneNumberInput/utils/isOptionAndFitsQuery/index.d.ts +0 -2
- package/build/types/phoneNumberInput/utils/isOptionAndFitsQuery/index.d.ts.map +0 -1
- package/build/types/phoneNumberInput/utils/isOptionAndFitsQuery/isOptionAndFitsQuery.d.ts +0 -3
- package/build/types/phoneNumberInput/utils/isOptionAndFitsQuery/isOptionAndFitsQuery.d.ts.map +0 -1
- package/src/common/locale/index.js +0 -139
- package/src/phoneNumberInput/PhoneNumberInput.js +0 -210
- package/src/phoneNumberInput/data/countries.spec.js +0 -12
- package/src/phoneNumberInput/utils/cleanNumber/cleanNumber.js +0 -4
- package/src/phoneNumberInput/utils/explodeNumberModel/index.js +0 -27
- package/src/phoneNumberInput/utils/filterOptionsForQuery/filterOptionsForQuery.spec.js +0 -36
- package/src/phoneNumberInput/utils/filterOptionsForQuery/index.js +0 -11
- package/src/phoneNumberInput/utils/findCountryByCode/index.js +0 -10
- package/src/phoneNumberInput/utils/findCountryByPrefix/index.js +0 -11
- package/src/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.js +0 -26
- package/src/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.spec.js +0 -67
- package/src/phoneNumberInput/utils/isOptionAndFitsQuery/index.js +0 -1
- package/src/phoneNumberInput/utils/isOptionAndFitsQuery/isOptionAndFitsQuery.js +0 -25
- package/src/phoneNumberInput/utils/isOptionAndFitsQuery/isOptionAndFitsQuery.spec.js +0 -66
- package/src/phoneNumberInput/utils/isStringNumeric/isStringNumeric.js +0 -1
- package/src/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.js +0 -10
- package/src/phoneNumberInput/utils/longestMatchingPrefix/index.js +0 -2
- package/src/phoneNumberInput/utils/setDefaultPrefix/index.js +0 -25
- package/src/phoneNumberInput/utils/sortArrayByProperty/sortArrayByProperty.js +0 -3
- /package/src/phoneNumberInput/{PhoneNumberInput.story.js → PhoneNumberInput.story.tsx} +0 -0
- /package/src/phoneNumberInput/{index.js → index.ts} +0 -0
- /package/src/phoneNumberInput/utils/cleanNumber/{cleanNumber.spec.js → cleanNumber.spec.ts} +0 -0
- /package/src/phoneNumberInput/utils/cleanNumber/{index.js → index.ts} +0 -0
- /package/src/phoneNumberInput/utils/excludeCountries/{index.js → index.ts} +0 -0
- /package/src/phoneNumberInput/utils/findCountryByPrefix/{findCountryByPrefix.spec.js → findCountryByPrefix.spec.ts} +0 -0
- /package/src/phoneNumberInput/utils/groupCountriesByPrefix/{index.js → index.ts} +0 -0
- /package/src/phoneNumberInput/utils/isStringNumeric/{index.js → index.ts} +0 -0
- /package/src/phoneNumberInput/utils/isValidPhoneNumber/{index.js → index.ts} +0 -0
- /package/src/phoneNumberInput/utils/longestMatchingPrefix/{longestMatchingPrefix.spec.js → longestMatchingPrefix.spec.ts} +0 -0
- /package/src/phoneNumberInput/utils/setDefaultPrefix/{setDefaultPrefix.spec.js → setDefaultPrefix.spec.ts} +0 -0
- /package/src/phoneNumberInput/utils/sortArrayByProperty/{index.js → index.ts} +0 -0
- /package/src/phoneNumberInput/utils/sortArrayByProperty/{sortArrayByProperty.spec.js → sortArrayByProperty.spec.ts} +0 -0
package/build/index.js
CHANGED
|
@@ -376,131 +376,76 @@ const Key = {
|
|
|
376
376
|
COMMA: ','
|
|
377
377
|
};
|
|
378
378
|
|
|
379
|
-
/**
|
|
380
|
-
* Default language
|
|
381
|
-
*
|
|
382
|
-
* @type {string}
|
|
383
|
-
*/
|
|
384
379
|
const DEFAULT_LANG = 'en';
|
|
385
|
-
|
|
386
|
-
/**
|
|
387
|
-
* Default locale
|
|
388
|
-
*
|
|
389
|
-
* @type {string}
|
|
390
|
-
*/
|
|
391
380
|
const DEFAULT_LOCALE = 'en-GB';
|
|
392
|
-
|
|
393
381
|
/**
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
* @type {string[]}
|
|
382
|
+
* Languages written right-to-left.
|
|
397
383
|
*/
|
|
398
384
|
const RTL_LANGUAGES = ['ar', 'he'];
|
|
399
|
-
|
|
400
385
|
/**
|
|
401
386
|
* @deprecated The source of truth for supported languages lives in Crab.
|
|
402
|
-
* @type {string[]}
|
|
403
387
|
*/
|
|
404
388
|
const SUPPORTED_LANGUAGES = [DEFAULT_LANG, 'de', 'es', 'fr', 'hu', 'id', 'it', 'ja', 'pl', 'pt', 'ro', 'ru', 'th', 'tr', 'uk', 'zh'];
|
|
405
|
-
|
|
406
389
|
/**
|
|
407
|
-
* Verifies and adjusts locale
|
|
408
|
-
* Returns null if locale is unrecognized by {Intl.Locale}
|
|
390
|
+
* Verifies and adjusts locale, replacing `_` with `-`.
|
|
409
391
|
*
|
|
410
|
-
* @param
|
|
411
|
-
* @returns
|
|
392
|
+
* @param locale `es`, `es_ES`, `en-GB`, `en`, `ja`, `ja-JP`, etc.
|
|
393
|
+
* @returns `null` if locale is unrecognized by `Intl.Locale`.
|
|
412
394
|
*/
|
|
413
395
|
function adjustLocale(locale) {
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
} catch (error) {
|
|
423
|
-
// eslint-disable-next-line no-console
|
|
424
|
-
console.error(error);
|
|
425
|
-
return null;
|
|
396
|
+
const localeTrimmed = locale?.trim();
|
|
397
|
+
if (localeTrimmed) {
|
|
398
|
+
try {
|
|
399
|
+
return new Intl.Locale(localeTrimmed.replace('_', '-')).baseName;
|
|
400
|
+
} catch (error) {
|
|
401
|
+
// eslint-disable-next-line no-console
|
|
402
|
+
console.error(error);
|
|
403
|
+
}
|
|
426
404
|
}
|
|
405
|
+
return null;
|
|
427
406
|
}
|
|
428
|
-
|
|
429
407
|
/**
|
|
430
|
-
* Provides corresponding lang (iso2) for provided locale
|
|
431
|
-
* if locale is invalid or language is unsupported returns null
|
|
408
|
+
* Provides corresponding lang (iso2) for provided locale.
|
|
432
409
|
*
|
|
433
410
|
* @deprecated The use of this function almost always breaks language variants
|
|
434
411
|
* e.g. Simplified and Traditional Chinese.
|
|
435
412
|
* There should be no use case for this function.
|
|
436
413
|
* To select the correct translations from a translations object, pass the
|
|
437
414
|
* locale directly into Crab's getLocalisedMessages.
|
|
438
|
-
* @param
|
|
439
|
-
* @returns
|
|
415
|
+
* @param locale `es`, `es-ES`, `en-GB`, `en`, `ja`, `ja-JP`, etc.
|
|
416
|
+
* @returns Two-letter ISO 639-1 language code, falling back to `null` if locale is invalid or language is unsupported.
|
|
440
417
|
*/
|
|
441
418
|
function getLangFromLocale(locale) {
|
|
442
419
|
const adjustedLocale = adjustLocale(locale);
|
|
443
|
-
if (adjustedLocale
|
|
444
|
-
return null;
|
|
445
|
-
}
|
|
446
|
-
try {
|
|
420
|
+
if (adjustedLocale != null) {
|
|
447
421
|
const {
|
|
448
422
|
language
|
|
449
423
|
} = new Intl.Locale(adjustedLocale);
|
|
450
424
|
if (SUPPORTED_LANGUAGES.includes(language)) {
|
|
451
425
|
return language;
|
|
452
426
|
}
|
|
453
|
-
return null;
|
|
454
|
-
} catch (error) {
|
|
455
|
-
// eslint-disable-next-line no-console
|
|
456
|
-
console.error(error);
|
|
457
|
-
return null;
|
|
458
427
|
}
|
|
428
|
+
return null;
|
|
459
429
|
}
|
|
460
|
-
|
|
461
430
|
/**
|
|
462
|
-
* Provides corresponding country code (iso2) for locales code with explicit region value
|
|
463
|
-
* if the value is invalid or missing region it returns null
|
|
431
|
+
* Provides corresponding country code (iso2) for locales code with explicit region value.
|
|
464
432
|
*
|
|
465
|
-
* @param
|
|
466
|
-
* @returns
|
|
433
|
+
* @param locale `es-ES`, `en-GB`, `ja-JP`, etc.
|
|
434
|
+
* @returns `null` if the locale is invalid or the region can‘t be identified.
|
|
467
435
|
*/
|
|
468
436
|
function getCountryFromLocale(locale) {
|
|
469
437
|
const adjustedLocale = adjustLocale(locale);
|
|
470
|
-
|
|
471
|
-
return null;
|
|
472
|
-
}
|
|
473
|
-
try {
|
|
474
|
-
const {
|
|
475
|
-
region
|
|
476
|
-
} = new Intl.Locale(adjustedLocale);
|
|
477
|
-
return region ?? null;
|
|
478
|
-
} catch (error) {
|
|
479
|
-
// eslint-disable-next-line no-console
|
|
480
|
-
console.error(error);
|
|
481
|
-
return null;
|
|
482
|
-
}
|
|
438
|
+
return adjustedLocale != null ? new Intl.Locale(adjustedLocale).region ?? null : null;
|
|
483
439
|
}
|
|
484
|
-
|
|
485
440
|
/**
|
|
486
441
|
* Provides the layout direction for a given locale.
|
|
487
|
-
* If locale is invalid or language is unsupported returns Direction.LTR
|
|
488
442
|
*
|
|
489
|
-
* @param
|
|
490
|
-
* @returns
|
|
443
|
+
* @param locale `es`, `es-ES`, `en-GB`, `en`, `ja`, `ja-JP`, etc.
|
|
444
|
+
* @returns The layout direction based on the locale, falling back to `Direction.LTR` if the locale is invalid or unsupported.
|
|
491
445
|
*/
|
|
492
446
|
function getDirectionFromLocale(locale) {
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
const {
|
|
496
|
-
language
|
|
497
|
-
} = new Intl.Locale(adjustedLocale);
|
|
498
|
-
return RTL_LANGUAGES.includes(language) ? exports.Direction.RTL : exports.Direction.LTR;
|
|
499
|
-
} catch (error) {
|
|
500
|
-
// eslint-disable-next-line no-console
|
|
501
|
-
console.error(error);
|
|
502
|
-
return exports.Direction.LTR;
|
|
503
|
-
}
|
|
447
|
+
const adjustedLocale = adjustLocale(locale);
|
|
448
|
+
return adjustedLocale != null && RTL_LANGUAGES.includes(new Intl.Locale(adjustedLocale).language) ? exports.Direction.RTL : exports.Direction.LTR;
|
|
504
449
|
}
|
|
505
450
|
|
|
506
451
|
/**
|
|
@@ -6488,6 +6433,12 @@ const PolymorphicWithOverrides = /*#__PURE__*/React.forwardRef(function Polymorp
|
|
|
6488
6433
|
});
|
|
6489
6434
|
});
|
|
6490
6435
|
|
|
6436
|
+
function wrapInFragment(value) {
|
|
6437
|
+
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
6438
|
+
children: value
|
|
6439
|
+
});
|
|
6440
|
+
}
|
|
6441
|
+
|
|
6491
6442
|
var messages$4 = reactIntl.defineMessages({
|
|
6492
6443
|
noResultsFound: {
|
|
6493
6444
|
id: "neptune.SelectInput.noResultsFound"
|
|
@@ -6828,10 +6779,10 @@ const defaultRenderTrigger = ({
|
|
|
6828
6779
|
children: /*#__PURE__*/jsxRuntime.jsx(SelectInputTriggerButton, {
|
|
6829
6780
|
as: ButtonInput,
|
|
6830
6781
|
size: size,
|
|
6831
|
-
children: /*#__PURE__*/jsxRuntime.
|
|
6832
|
-
className:
|
|
6833
|
-
children: content
|
|
6834
|
-
})
|
|
6782
|
+
children: placeholderShown ? /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
6783
|
+
className: "np-select-input-placeholder",
|
|
6784
|
+
children: [" ", content]
|
|
6785
|
+
}) : content
|
|
6835
6786
|
})
|
|
6836
6787
|
});
|
|
6837
6788
|
function SelectInputClearButton({
|
|
@@ -6852,13 +6803,12 @@ function SelectInputClearButton({
|
|
|
6852
6803
|
const noop = () => {};
|
|
6853
6804
|
function SelectInput({
|
|
6854
6805
|
name,
|
|
6855
|
-
multiple = false,
|
|
6856
6806
|
placeholder,
|
|
6857
6807
|
items,
|
|
6858
6808
|
defaultValue,
|
|
6859
6809
|
value: controlledValue,
|
|
6860
6810
|
compareValues,
|
|
6861
|
-
renderValue =
|
|
6811
|
+
renderValue = wrapInFragment,
|
|
6862
6812
|
renderFooter,
|
|
6863
6813
|
renderTrigger = defaultRenderTrigger,
|
|
6864
6814
|
filterable,
|
|
@@ -6887,7 +6837,6 @@ function SelectInput({
|
|
|
6887
6837
|
const controllerRef = filterable ? searchInputRef : listboxRef;
|
|
6888
6838
|
return /*#__PURE__*/jsxRuntime.jsx(react$1.Listbox, {
|
|
6889
6839
|
name: name,
|
|
6890
|
-
multiple: multiple,
|
|
6891
6840
|
defaultValue: defaultValue,
|
|
6892
6841
|
value: controlledValue
|
|
6893
6842
|
// TODO: Remove assertion when upgrading TypeScript to v5
|
|
@@ -6896,78 +6845,73 @@ function SelectInput({
|
|
|
6896
6845
|
by: compareValues,
|
|
6897
6846
|
disabled: disabled,
|
|
6898
6847
|
onChange: value => {
|
|
6899
|
-
|
|
6900
|
-
setOpen(false);
|
|
6901
|
-
}
|
|
6848
|
+
setOpen(false);
|
|
6902
6849
|
onChange?.(value);
|
|
6903
6850
|
},
|
|
6904
6851
|
children: ({
|
|
6905
6852
|
disabled: uiDisabled,
|
|
6906
6853
|
value
|
|
6907
|
-
}) => {
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
|
|
6915
|
-
|
|
6916
|
-
|
|
6917
|
-
|
|
6918
|
-
|
|
6919
|
-
|
|
6920
|
-
|
|
6854
|
+
}) => /*#__PURE__*/jsxRuntime.jsx(OptionsOverlay, {
|
|
6855
|
+
placement: "bottom-start",
|
|
6856
|
+
open: open,
|
|
6857
|
+
renderTrigger: ({
|
|
6858
|
+
ref,
|
|
6859
|
+
getInteractionProps
|
|
6860
|
+
}) => /*#__PURE__*/jsxRuntime.jsx(SelectInputTriggerButtonPropsContext.Provider, {
|
|
6861
|
+
// eslint-disable-next-line react/jsx-no-constructed-context-values
|
|
6862
|
+
value: {
|
|
6863
|
+
ref: mergeRefs__default.default([ref, triggerRef]),
|
|
6864
|
+
...mergeProps__default.default({
|
|
6865
|
+
onClick: () => {
|
|
6866
|
+
setOpen(prev => !prev);
|
|
6867
|
+
},
|
|
6868
|
+
onKeyDown: event => {
|
|
6869
|
+
if (event.key === ' ' || event.key === 'Enter' || event.key === 'ArrowDown' || event.key === 'ArrowUp') {
|
|
6921
6870
|
setOpen(prev => !prev);
|
|
6922
|
-
},
|
|
6923
|
-
onKeyDown: event => {
|
|
6924
|
-
if (event.key === ' ' || event.key === 'Enter' || event.key === 'ArrowDown' || event.key === 'ArrowUp') {
|
|
6925
|
-
setOpen(prev => !prev);
|
|
6926
|
-
}
|
|
6927
6871
|
}
|
|
6928
|
-
}
|
|
6929
|
-
},
|
|
6930
|
-
children: renderTrigger({
|
|
6931
|
-
content: !placeholderShown ? /*#__PURE__*/jsxRuntime.jsx(SelectInputOptionContentWithinTriggerContext.Provider, {
|
|
6932
|
-
value: true,
|
|
6933
|
-
children: multiple && Array.isArray(value) ? value.map(option => renderValue(option, true)).join(', ') : renderValue(value, true)
|
|
6934
|
-
}) : placeholder,
|
|
6935
|
-
placeholderShown,
|
|
6936
|
-
clear: onClear != null ? () => {
|
|
6937
|
-
onClear();
|
|
6938
|
-
triggerRef.current?.focus({
|
|
6939
|
-
preventScroll: true
|
|
6940
|
-
});
|
|
6941
|
-
} : undefined,
|
|
6942
|
-
disabled: uiDisabled,
|
|
6943
|
-
size,
|
|
6944
|
-
className
|
|
6945
|
-
})
|
|
6946
|
-
}),
|
|
6947
|
-
initialFocusRef: controllerRef,
|
|
6948
|
-
size: filterable ? 'lg' : 'md',
|
|
6949
|
-
padding: "none",
|
|
6950
|
-
onClose: () => {
|
|
6951
|
-
setOpen(false);
|
|
6952
|
-
},
|
|
6953
|
-
onCloseEnd: () => {
|
|
6954
|
-
if (filterQuery !== '') {
|
|
6955
|
-
setFilterQuery('');
|
|
6956
|
-
}
|
|
6872
|
+
}
|
|
6873
|
+
}, getInteractionProps())
|
|
6957
6874
|
},
|
|
6958
|
-
children:
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
6875
|
+
children: renderTrigger({
|
|
6876
|
+
content: value != null ? /*#__PURE__*/jsxRuntime.jsx(SelectInputOptionContentWithinTriggerContext.Provider, {
|
|
6877
|
+
value: true,
|
|
6878
|
+
children: renderValue(value, true)
|
|
6879
|
+
}) : placeholder,
|
|
6880
|
+
placeholderShown: value == null,
|
|
6881
|
+
clear: onClear != null ? () => {
|
|
6882
|
+
onClear();
|
|
6883
|
+
triggerRef.current?.focus({
|
|
6884
|
+
preventScroll: true
|
|
6885
|
+
});
|
|
6886
|
+
} : undefined,
|
|
6887
|
+
disabled: uiDisabled,
|
|
6888
|
+
size,
|
|
6889
|
+
className
|
|
6968
6890
|
})
|
|
6969
|
-
})
|
|
6970
|
-
|
|
6891
|
+
}),
|
|
6892
|
+
initialFocusRef: controllerRef,
|
|
6893
|
+
size: filterable ? 'lg' : 'md',
|
|
6894
|
+
padding: "none",
|
|
6895
|
+
onClose: () => {
|
|
6896
|
+
setOpen(false);
|
|
6897
|
+
},
|
|
6898
|
+
onCloseEnd: () => {
|
|
6899
|
+
if (filterQuery !== '') {
|
|
6900
|
+
setFilterQuery('');
|
|
6901
|
+
}
|
|
6902
|
+
},
|
|
6903
|
+
children: /*#__PURE__*/jsxRuntime.jsx(SelectInputOptions, {
|
|
6904
|
+
items: items,
|
|
6905
|
+
renderValue: renderValue,
|
|
6906
|
+
renderFooter: renderFooter,
|
|
6907
|
+
filterable: filterable,
|
|
6908
|
+
filterPlaceholder: filterPlaceholder,
|
|
6909
|
+
searchInputRef: searchInputRef,
|
|
6910
|
+
listboxRef: listboxRef,
|
|
6911
|
+
filterQuery: filterQuery,
|
|
6912
|
+
onFilterChange: setFilterQuery
|
|
6913
|
+
})
|
|
6914
|
+
})
|
|
6971
6915
|
});
|
|
6972
6916
|
}
|
|
6973
6917
|
function SelectInputTriggerButton({
|
|
@@ -7030,7 +6974,7 @@ const SelectInputOptionsContainer = /*#__PURE__*/React.forwardRef(function Selec
|
|
|
7030
6974
|
});
|
|
7031
6975
|
function SelectInputOptions({
|
|
7032
6976
|
items,
|
|
7033
|
-
renderValue =
|
|
6977
|
+
renderValue = wrapInFragment,
|
|
7034
6978
|
renderFooter,
|
|
7035
6979
|
filterable = false,
|
|
7036
6980
|
filterPlaceholder,
|
|
@@ -9602,111 +9546,79 @@ const countries = [{
|
|
|
9602
9546
|
iso3: 'ZWE',
|
|
9603
9547
|
phone: '+263'
|
|
9604
9548
|
}];
|
|
9605
|
-
var countries$1 = countries;
|
|
9606
9549
|
|
|
9607
9550
|
const longestMatchingPrefix = matchingCodes => matchingCodes.reduce((a, b) => a.phone.length > b.phone.length ? a : b);
|
|
9608
9551
|
|
|
9609
9552
|
const findCountryByCode = code => {
|
|
9610
|
-
|
|
9611
|
-
|
|
9612
|
-
matchingCodes
|
|
9553
|
+
if (code.length === 2) {
|
|
9554
|
+
const matchingCodes = countries.filter(country => code.toUpperCase() === country.iso2);
|
|
9555
|
+
if (matchingCodes.length > 0) {
|
|
9556
|
+
return longestMatchingPrefix(matchingCodes);
|
|
9557
|
+
}
|
|
9613
9558
|
}
|
|
9614
|
-
return
|
|
9559
|
+
return null;
|
|
9615
9560
|
};
|
|
9616
9561
|
|
|
9617
9562
|
/**
|
|
9618
9563
|
* Default phone code, the UK one `+44`
|
|
9619
9564
|
*/
|
|
9620
9565
|
const DEFAULT_PHONE_CODE = '+44';
|
|
9621
|
-
|
|
9622
9566
|
/**
|
|
9623
9567
|
* Given a valid locale it returns the correspondent prefix if found or +44 otherwise.
|
|
9624
9568
|
*
|
|
9625
|
-
* @param
|
|
9626
|
-
* @param countryCode
|
|
9627
|
-
* @returns {string}
|
|
9569
|
+
* @param locale BCP 47 language tag of locale, e.g. `"es-ES"`.
|
|
9570
|
+
* @param countryCode Two-letter country code (ISO 3166-1 alpha-2).
|
|
9628
9571
|
*/
|
|
9629
9572
|
const setDefaultPrefix = (locale, countryCode) => {
|
|
9630
|
-
const country = findCountryByCode(countryCode)
|
|
9631
|
-
|
|
9632
|
-
findCountryByCode(getCountryFromLocale(locale)) ||
|
|
9633
|
-
// when `locale` code is only two chars value: `fr`, `es`
|
|
9634
|
-
findCountryByCode(locale);
|
|
9635
|
-
return country?.phone || DEFAULT_PHONE_CODE;
|
|
9573
|
+
const country = (countryCode != null ? findCountryByCode(countryCode) : null) ?? findCountryByCode(getCountryFromLocale(locale) ?? locale);
|
|
9574
|
+
return country?.phone ?? DEFAULT_PHONE_CODE;
|
|
9636
9575
|
};
|
|
9637
9576
|
|
|
9638
9577
|
/**
|
|
9639
9578
|
*
|
|
9640
9579
|
* @param phoneNumber
|
|
9641
|
-
* @returns
|
|
9642
|
-
* at least 4 digits.
|
|
9580
|
+
* @returns True if number that starts with "+" and contains a mix of digits and spaces with at least 4 digits.
|
|
9643
9581
|
*/
|
|
9644
|
-
const isValidPhoneNumber = phoneNumber => /^\+[\d-\s]+$/.test(phoneNumber) &&
|
|
9582
|
+
const isValidPhoneNumber = phoneNumber => /^\+[\d-\s]+$/.test(phoneNumber) && (phoneNumber.match(/\d+/g)?.join('').length ?? 0) >= 4;
|
|
9645
9583
|
|
|
9646
9584
|
const findCountryByPrefix = number => {
|
|
9647
|
-
|
|
9648
|
-
|
|
9649
|
-
|
|
9585
|
+
if (number.length > 1) {
|
|
9586
|
+
const matchingCodes = countries.filter(country => number.startsWith(country.phone));
|
|
9587
|
+
if (matchingCodes.length > 0) {
|
|
9588
|
+
return longestMatchingPrefix(matchingCodes);
|
|
9589
|
+
}
|
|
9650
9590
|
}
|
|
9651
|
-
return
|
|
9591
|
+
return null;
|
|
9652
9592
|
};
|
|
9653
9593
|
|
|
9654
9594
|
/**
|
|
9655
|
-
*
|
|
9656
|
-
* {prefix=+44 ,suffix=7573135343}
|
|
9657
|
-
*
|
|
9658
|
-
* @param {string} number - a string that defines a phone number.
|
|
9659
|
-
* @returns {{prefix: (string|*), suffix: string, format: string}}
|
|
9595
|
+
* @param number Phone number in a format like "+447573135343"
|
|
9660
9596
|
*/
|
|
9661
9597
|
const explodeNumberModel = number => {
|
|
9662
|
-
let prefix = '';
|
|
9663
|
-
let suffix = '';
|
|
9664
|
-
let format = '';
|
|
9665
9598
|
const country = findCountryByPrefix(number);
|
|
9666
|
-
|
|
9667
|
-
prefix
|
|
9668
|
-
suffix
|
|
9669
|
-
format
|
|
9670
|
-
}
|
|
9671
|
-
prefix
|
|
9672
|
-
suffix
|
|
9673
|
-
format = '';
|
|
9674
|
-
}
|
|
9675
|
-
return {
|
|
9676
|
-
prefix,
|
|
9677
|
-
suffix,
|
|
9678
|
-
format
|
|
9599
|
+
return country ? {
|
|
9600
|
+
prefix: country.phone,
|
|
9601
|
+
suffix: number.slice(country.phone.length),
|
|
9602
|
+
format: country.phoneFormat
|
|
9603
|
+
} : {
|
|
9604
|
+
prefix: null,
|
|
9605
|
+
suffix: number.slice(1)
|
|
9679
9606
|
};
|
|
9680
9607
|
};
|
|
9681
9608
|
|
|
9682
9609
|
const DIGITS_MATCH = /^$|^(\+)|([\d]+)/g;
|
|
9683
|
-
const cleanNumber = number => number.match(DIGITS_MATCH)
|
|
9610
|
+
const cleanNumber = number => number.match(DIGITS_MATCH)?.join('') ?? '';
|
|
9684
9611
|
|
|
9685
|
-
|
|
9686
|
-
|
|
9612
|
+
function sortArrayByProperty(arrayToSort, property) {
|
|
9613
|
+
return [...arrayToSort].sort((a, b) => a[property].localeCompare(b[property]));
|
|
9614
|
+
}
|
|
9687
9615
|
|
|
9688
9616
|
const groupCountriesByPrefix = countries => {
|
|
9689
|
-
const
|
|
9690
|
-
|
|
9691
|
-
|
|
9692
|
-
|
|
9693
|
-
|
|
9694
|
-
phone
|
|
9695
|
-
} = country;
|
|
9696
|
-
if (accumulator[phone]) {
|
|
9697
|
-
const previousValue = accumulator[phone];
|
|
9698
|
-
accumulator[phone] = {
|
|
9699
|
-
...previousValue,
|
|
9700
|
-
name: neptuneValidation.isArray(previousValue.name) ? [...previousValue.name, name] : [previousValue.name, name],
|
|
9701
|
-
iso2: neptuneValidation.isArray(previousValue.iso2) ? [...previousValue.iso2, iso2] : [previousValue.iso2, iso2],
|
|
9702
|
-
iso3: neptuneValidation.isArray(previousValue.iso3) ? [...previousValue.iso3, iso3] : [previousValue.iso3, iso3]
|
|
9703
|
-
};
|
|
9704
|
-
} else {
|
|
9705
|
-
accumulator[phone] = country;
|
|
9706
|
-
}
|
|
9707
|
-
return accumulator;
|
|
9708
|
-
}, {});
|
|
9709
|
-
return Object.values(groupedArray);
|
|
9617
|
+
const countriesByPrefix = new Map();
|
|
9618
|
+
countries.forEach(country => {
|
|
9619
|
+
countriesByPrefix.set(country.phone, [...(countriesByPrefix.get(country.phone) ?? []), country]);
|
|
9620
|
+
});
|
|
9621
|
+
return countriesByPrefix;
|
|
9710
9622
|
};
|
|
9711
9623
|
|
|
9712
9624
|
// Reference fro localeCompare : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare
|
|
@@ -9714,41 +9626,38 @@ const filterCountriesByIso3 = (countries, iso3Codes) => {
|
|
|
9714
9626
|
const iso3CodesSet = new Set(iso3Codes);
|
|
9715
9627
|
return countries.filter(country => !iso3CodesSet.has(country.iso3));
|
|
9716
9628
|
};
|
|
9717
|
-
|
|
9718
9629
|
/**
|
|
9719
9630
|
* Removes the countries sepecified in the second param
|
|
9720
9631
|
*
|
|
9721
|
-
* @param
|
|
9722
|
-
* @param
|
|
9723
|
-
* @returns
|
|
9632
|
+
* @param countries list of country metadata objects
|
|
9633
|
+
* @param disabledCountries list of iso3 country codes to remove from the list
|
|
9724
9634
|
*/
|
|
9725
9635
|
const excludeCountries = (countries, disabledCountries) => {
|
|
9726
9636
|
return disabledCountries.length > 0 ? filterCountriesByIso3(countries, disabledCountries) : countries;
|
|
9727
9637
|
};
|
|
9728
9638
|
|
|
9729
9639
|
const ALLOWED_PHONE_CHARS = /^$|^[\d-\s]+$/;
|
|
9730
|
-
const
|
|
9731
|
-
|
|
9732
|
-
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
|
|
9740
|
-
|
|
9741
|
-
|
|
9742
|
-
|
|
9743
|
-
|
|
9744
|
-
|
|
9640
|
+
const defaultSelectProps = {};
|
|
9641
|
+
const defaultDisabledCountries = [];
|
|
9642
|
+
const PhoneNumberInput = ({
|
|
9643
|
+
id,
|
|
9644
|
+
required,
|
|
9645
|
+
disabled,
|
|
9646
|
+
initialValue,
|
|
9647
|
+
onChange,
|
|
9648
|
+
onFocus,
|
|
9649
|
+
onBlur,
|
|
9650
|
+
countryCode,
|
|
9651
|
+
searchPlaceholder = 'Prefix',
|
|
9652
|
+
size = exports.Size.MEDIUM,
|
|
9653
|
+
placeholder,
|
|
9654
|
+
selectProps = defaultSelectProps,
|
|
9655
|
+
disabledCountries = defaultDisabledCountries
|
|
9656
|
+
}) => {
|
|
9745
9657
|
const {
|
|
9746
9658
|
locale
|
|
9747
9659
|
} = reactIntl.useIntl();
|
|
9748
|
-
const
|
|
9749
|
-
const {
|
|
9750
|
-
initialValue
|
|
9751
|
-
} = props;
|
|
9660
|
+
const [internalValue, setInternalValue] = React.useState(() => {
|
|
9752
9661
|
const cleanValue = initialValue ? cleanNumber(initialValue) : null;
|
|
9753
9662
|
if (!cleanValue || !isValidPhoneNumber(cleanValue)) {
|
|
9754
9663
|
return {
|
|
@@ -9757,54 +9666,16 @@ const PhoneNumberInput = props => {
|
|
|
9757
9666
|
};
|
|
9758
9667
|
}
|
|
9759
9668
|
return explodeNumberModel(cleanValue);
|
|
9760
|
-
};
|
|
9761
|
-
const [internalValue, setInternalValue] = React.useState(getInitialValue());
|
|
9669
|
+
});
|
|
9762
9670
|
const [broadcastedValue, setBroadcastedValue] = React.useState(null);
|
|
9763
|
-
const
|
|
9764
|
-
const countriesList = excludeCountries(countries$1, disabledCountries);
|
|
9765
|
-
const listSortedByISO3 = groupCountriesByPrefix(sortArrayByProperty(countriesList, 'iso3'));
|
|
9766
|
-
return listSortedByISO3.map(option => {
|
|
9767
|
-
const {
|
|
9768
|
-
phone,
|
|
9769
|
-
iso3,
|
|
9770
|
-
iso2,
|
|
9771
|
-
name
|
|
9772
|
-
} = option;
|
|
9773
|
-
let note = '';
|
|
9774
|
-
if (iso3) {
|
|
9775
|
-
note = neptuneValidation.isArray(iso3) ? iso3.join(', ') : iso3;
|
|
9776
|
-
} else if (iso2) {
|
|
9777
|
-
note = neptuneValidation.isArray(iso2) ? iso2.join(', ') : iso2;
|
|
9778
|
-
}
|
|
9779
|
-
return {
|
|
9780
|
-
type: 'option',
|
|
9781
|
-
value: {
|
|
9782
|
-
value: phone,
|
|
9783
|
-
label: phone,
|
|
9784
|
-
note: note
|
|
9785
|
-
},
|
|
9786
|
-
filterMatchers: [phone, note, name]
|
|
9787
|
-
};
|
|
9788
|
-
});
|
|
9789
|
-
};
|
|
9790
|
-
const options = getSelectOptions();
|
|
9791
|
-
const onPrefixChange = ({
|
|
9792
|
-
value
|
|
9793
|
-
}) => {
|
|
9794
|
-
setInternalValue({
|
|
9795
|
-
prefix: value,
|
|
9796
|
-
suffix: internalValue.suffix
|
|
9797
|
-
});
|
|
9798
|
-
};
|
|
9671
|
+
const countriesByPrefix = React.useMemo(() => groupCountriesByPrefix(sortArrayByProperty(excludeCountries(countries, disabledCountries), 'iso3')), [disabledCountries]);
|
|
9799
9672
|
const onSuffixChange = event => {
|
|
9800
|
-
const
|
|
9801
|
-
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
-
|
|
9805
|
-
|
|
9806
|
-
suffix: value
|
|
9807
|
-
});
|
|
9673
|
+
const suffix = event.target.value;
|
|
9674
|
+
if (ALLOWED_PHONE_CHARS.test(suffix)) {
|
|
9675
|
+
setInternalValue(prev => ({
|
|
9676
|
+
...prev,
|
|
9677
|
+
suffix
|
|
9678
|
+
}));
|
|
9808
9679
|
}
|
|
9809
9680
|
};
|
|
9810
9681
|
const onPaste = event => {
|
|
@@ -9812,31 +9683,22 @@ const PhoneNumberInput = props => {
|
|
|
9812
9683
|
return;
|
|
9813
9684
|
}
|
|
9814
9685
|
const pastedValue = (event.nativeEvent.clipboardData.getData('text/plain') || '').replace(/(\s|-)+/g, '');
|
|
9815
|
-
const
|
|
9816
|
-
|
|
9817
|
-
|
|
9818
|
-
} = explodeNumberModel(pastedValue);
|
|
9819
|
-
const selectedPrefix = options.find(({
|
|
9820
|
-
value
|
|
9821
|
-
}) => value.value === pastedPrefix);
|
|
9822
|
-
if (selectedPrefix && ALLOWED_PHONE_CHARS.test(pastedSuffix)) {
|
|
9823
|
-
setInternalValue({
|
|
9824
|
-
prefix: pastedPrefix,
|
|
9825
|
-
suffix: pastedSuffix
|
|
9826
|
-
});
|
|
9686
|
+
const pastedNumber = explodeNumberModel(pastedValue);
|
|
9687
|
+
if (pastedNumber.prefix != null && countriesByPrefix.has(pastedNumber.prefix) && ALLOWED_PHONE_CHARS.test(pastedNumber.suffix)) {
|
|
9688
|
+
setInternalValue(pastedNumber);
|
|
9827
9689
|
}
|
|
9828
9690
|
};
|
|
9829
9691
|
React.useEffect(() => {
|
|
9830
9692
|
if (broadcastedValue === null) {
|
|
9831
9693
|
return setBroadcastedValue(internalValue);
|
|
9832
9694
|
}
|
|
9833
|
-
const internalPhoneNumber = internalValue.prefix
|
|
9834
|
-
const broadcastedPhoneNumber = broadcastedValue.prefix
|
|
9695
|
+
const internalPhoneNumber = `${internalValue.prefix ?? ''}${internalValue.suffix}`;
|
|
9696
|
+
const broadcastedPhoneNumber = `${broadcastedValue.prefix ?? ''}${broadcastedValue.suffix}`;
|
|
9835
9697
|
if (internalPhoneNumber === broadcastedPhoneNumber) {
|
|
9836
9698
|
return;
|
|
9837
9699
|
}
|
|
9838
9700
|
const newValue = isValidPhoneNumber(internalPhoneNumber) ? cleanNumber(internalPhoneNumber) : null;
|
|
9839
|
-
onChange(newValue, internalValue.prefix);
|
|
9701
|
+
onChange(newValue, internalValue.prefix ?? '');
|
|
9840
9702
|
setBroadcastedValue(internalValue);
|
|
9841
9703
|
}, [onChange, broadcastedValue, internalValue]);
|
|
9842
9704
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
@@ -9844,18 +9706,29 @@ const PhoneNumberInput = props => {
|
|
|
9844
9706
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
9845
9707
|
className: "tw-telephone__country-select",
|
|
9846
9708
|
children: /*#__PURE__*/jsxRuntime.jsx(SelectInput, {
|
|
9847
|
-
placeholder: "Select an option
|
|
9848
|
-
items:
|
|
9849
|
-
|
|
9850
|
-
|
|
9851
|
-
|
|
9852
|
-
|
|
9709
|
+
placeholder: "Select an option\u2026",
|
|
9710
|
+
items: [...countriesByPrefix].map(([prefix, countries]) => ({
|
|
9711
|
+
type: 'option',
|
|
9712
|
+
value: prefix,
|
|
9713
|
+
filterMatchers: [prefix, ...countries.map(country => country.name), ...countries.map(country => country.iso3)]
|
|
9714
|
+
})),
|
|
9715
|
+
value: internalValue.prefix,
|
|
9716
|
+
renderValue: (prefix, withinTrigger) => /*#__PURE__*/jsxRuntime.jsx(SelectInputOptionContent, {
|
|
9717
|
+
title: prefix,
|
|
9718
|
+
note: withinTrigger ? undefined : countriesByPrefix.get(prefix)?.map(country => country.iso3).join(', ')
|
|
9853
9719
|
}),
|
|
9854
9720
|
filterable: true,
|
|
9855
9721
|
filterPlaceholder: searchPlaceholder,
|
|
9856
9722
|
disabled: disabled,
|
|
9857
9723
|
size: size,
|
|
9858
|
-
onChange:
|
|
9724
|
+
onChange: prefix => {
|
|
9725
|
+
const country = prefix != null ? findCountryByPrefix(prefix) : null;
|
|
9726
|
+
setInternalValue(prev => ({
|
|
9727
|
+
...prev,
|
|
9728
|
+
prefix,
|
|
9729
|
+
format: country?.phoneFormat
|
|
9730
|
+
}));
|
|
9731
|
+
},
|
|
9859
9732
|
...selectProps
|
|
9860
9733
|
})
|
|
9861
9734
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
@@ -9881,37 +9754,6 @@ const PhoneNumberInput = props => {
|
|
|
9881
9754
|
})]
|
|
9882
9755
|
});
|
|
9883
9756
|
};
|
|
9884
|
-
PhoneNumberInput.propTypes = {
|
|
9885
|
-
id: PropTypes__default.default.string,
|
|
9886
|
-
required: PropTypes__default.default.bool,
|
|
9887
|
-
disabled: PropTypes__default.default.bool,
|
|
9888
|
-
initialValue: PropTypes__default.default.string,
|
|
9889
|
-
onChange: PropTypes__default.default.func.isRequired,
|
|
9890
|
-
onFocus: PropTypes__default.default.func,
|
|
9891
|
-
onBlur: PropTypes__default.default.func,
|
|
9892
|
-
countryCode: PropTypes__default.default.string,
|
|
9893
|
-
searchPlaceholder: PropTypes__default.default.string,
|
|
9894
|
-
size: PropTypes__default.default.oneOf(['sm', 'md', 'lg']),
|
|
9895
|
-
placeholder: PropTypes__default.default.string,
|
|
9896
|
-
selectProps: PropTypes__default.default.object,
|
|
9897
|
-
/** List of iso3 codes of countries to remove from the list */
|
|
9898
|
-
disabledCountries: PropTypes__default.default.arrayOf(PropTypes__default.default.string)
|
|
9899
|
-
};
|
|
9900
|
-
PhoneNumberInput.defaultProps = {
|
|
9901
|
-
id: null,
|
|
9902
|
-
required: false,
|
|
9903
|
-
disabled: false,
|
|
9904
|
-
initialValue: null,
|
|
9905
|
-
onFocus() {},
|
|
9906
|
-
onBlur() {},
|
|
9907
|
-
countryCode: null,
|
|
9908
|
-
searchPlaceholder: 'Prefix',
|
|
9909
|
-
size: exports.Size.MEDIUM,
|
|
9910
|
-
placeholder: '',
|
|
9911
|
-
selectProps: {},
|
|
9912
|
-
disabledCountries: []
|
|
9913
|
-
};
|
|
9914
|
-
var PhoneNumberInput$1 = PhoneNumberInput;
|
|
9915
9757
|
|
|
9916
9758
|
const Progress = ({
|
|
9917
9759
|
className,
|
|
@@ -15688,7 +15530,7 @@ exports.NavigationOptionsList = NavigationOptionList$1;
|
|
|
15688
15530
|
exports.Nudge = Nudge;
|
|
15689
15531
|
exports.Option = Option$2;
|
|
15690
15532
|
exports.OverlayHeader = OverlayHeader$1;
|
|
15691
|
-
exports.PhoneNumberInput = PhoneNumberInput
|
|
15533
|
+
exports.PhoneNumberInput = PhoneNumberInput;
|
|
15692
15534
|
exports.Popover = Popover$2;
|
|
15693
15535
|
exports.ProcessIndicator = ProcessIndicator$1;
|
|
15694
15536
|
exports.Progress = Progress;
|