@transferwise/components 46.6.0 → 46.8.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 (148) hide show
  1. package/build/index.esm.js +290 -346
  2. package/build/index.esm.js.map +1 -1
  3. package/build/index.js +290 -345
  4. package/build/index.js.map +1 -1
  5. package/build/main.css +107 -17
  6. package/build/styles/inputs/Input.css +0 -4
  7. package/build/styles/inputs/SelectInput.css +6 -1
  8. package/build/styles/inputs/TextArea.css +0 -4
  9. package/build/styles/main.css +107 -17
  10. package/build/styles/segmentedControl/SegmentedControl.css +101 -0
  11. package/build/styles/select/Select.css +0 -4
  12. package/build/types/common/locale/index.d.ts +26 -43
  13. package/build/types/common/locale/index.d.ts.map +1 -1
  14. package/build/types/index.d.ts +3 -0
  15. package/build/types/index.d.ts.map +1 -1
  16. package/build/types/inputs/SelectInput.d.ts +6 -5
  17. package/build/types/inputs/SelectInput.d.ts.map +1 -1
  18. package/build/types/phoneNumberInput/PhoneNumberInput.d.ts +22 -27
  19. package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
  20. package/build/types/phoneNumberInput/data/countries.d.ts +5 -10
  21. package/build/types/phoneNumberInput/data/countries.d.ts.map +1 -1
  22. package/build/types/phoneNumberInput/index.d.ts +1 -1
  23. package/build/types/phoneNumberInput/index.d.ts.map +1 -1
  24. package/build/types/phoneNumberInput/utils/cleanNumber/cleanNumber.d.ts +1 -1
  25. package/build/types/phoneNumberInput/utils/cleanNumber/cleanNumber.d.ts.map +1 -1
  26. package/build/types/phoneNumberInput/utils/cleanNumber/index.d.ts +1 -1
  27. package/build/types/phoneNumberInput/utils/cleanNumber/index.d.ts.map +1 -1
  28. package/build/types/phoneNumberInput/utils/excludeCountries/excludeCountries.d.ts +8 -1
  29. package/build/types/phoneNumberInput/utils/excludeCountries/excludeCountries.d.ts.map +1 -1
  30. package/build/types/phoneNumberInput/utils/excludeCountries/index.d.ts +1 -1
  31. package/build/types/phoneNumberInput/utils/excludeCountries/index.d.ts.map +1 -1
  32. package/build/types/phoneNumberInput/utils/explodeNumberModel/index.d.ts +8 -4
  33. package/build/types/phoneNumberInput/utils/explodeNumberModel/index.d.ts.map +1 -1
  34. package/build/types/phoneNumberInput/utils/findCountryByCode/index.d.ts +1 -1
  35. package/build/types/phoneNumberInput/utils/findCountryByCode/index.d.ts.map +1 -1
  36. package/build/types/phoneNumberInput/utils/findCountryByPrefix/index.d.ts +1 -1
  37. package/build/types/phoneNumberInput/utils/findCountryByPrefix/index.d.ts.map +1 -1
  38. package/build/types/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.d.ts +2 -1
  39. package/build/types/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.d.ts.map +1 -1
  40. package/build/types/phoneNumberInput/utils/groupCountriesByPrefix/index.d.ts +1 -1
  41. package/build/types/phoneNumberInput/utils/groupCountriesByPrefix/index.d.ts.map +1 -1
  42. package/build/types/phoneNumberInput/utils/index.d.ts +11 -13
  43. package/build/types/phoneNumberInput/utils/index.d.ts.map +1 -1
  44. package/build/types/phoneNumberInput/utils/isStringNumeric/index.d.ts +1 -1
  45. package/build/types/phoneNumberInput/utils/isStringNumeric/index.d.ts.map +1 -1
  46. package/build/types/phoneNumberInput/utils/isStringNumeric/isStringNumeric.d.ts +1 -1
  47. package/build/types/phoneNumberInput/utils/isStringNumeric/isStringNumeric.d.ts.map +1 -1
  48. package/build/types/phoneNumberInput/utils/isValidPhoneNumber/index.d.ts +1 -1
  49. package/build/types/phoneNumberInput/utils/isValidPhoneNumber/index.d.ts.map +1 -1
  50. package/build/types/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.d.ts +6 -1
  51. package/build/types/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.d.ts.map +1 -1
  52. package/build/types/phoneNumberInput/utils/longestMatchingPrefix/index.d.ts +2 -1
  53. package/build/types/phoneNumberInput/utils/longestMatchingPrefix/index.d.ts.map +1 -1
  54. package/build/types/phoneNumberInput/utils/setDefaultPrefix/index.d.ts +7 -1
  55. package/build/types/phoneNumberInput/utils/setDefaultPrefix/index.d.ts.map +1 -1
  56. package/build/types/phoneNumberInput/utils/sortArrayByProperty/index.d.ts +1 -1
  57. package/build/types/phoneNumberInput/utils/sortArrayByProperty/index.d.ts.map +1 -1
  58. package/build/types/phoneNumberInput/utils/sortArrayByProperty/sortArrayByProperty.d.ts +1 -1
  59. package/build/types/phoneNumberInput/utils/sortArrayByProperty/sortArrayByProperty.d.ts.map +1 -1
  60. package/build/types/segmentedControl/SegmentedControl.d.ts +31 -0
  61. package/build/types/segmentedControl/SegmentedControl.d.ts.map +1 -0
  62. package/build/types/segmentedControl/index.d.ts +3 -0
  63. package/build/types/segmentedControl/index.d.ts.map +1 -0
  64. package/package.json +7 -17
  65. package/src/common/locale/{index.spec.js → index.spec.ts} +4 -4
  66. package/src/common/locale/index.ts +96 -0
  67. package/src/index.ts +3 -0
  68. package/src/inputs/Input.css +0 -4
  69. package/src/inputs/SelectInput.css +6 -1
  70. package/src/inputs/SelectInput.less +8 -1
  71. package/src/inputs/SelectInput.spec.tsx +26 -0
  72. package/src/inputs/SelectInput.story.tsx +73 -1
  73. package/src/inputs/SelectInput.tsx +104 -85
  74. package/src/inputs/TextArea.css +0 -4
  75. package/src/main.css +107 -17
  76. package/src/main.less +1 -0
  77. package/src/phoneNumberInput/PhoneNumberInput.spec.js +18 -22
  78. package/src/phoneNumberInput/PhoneNumberInput.tsx +193 -0
  79. package/src/phoneNumberInput/data/{countries.js → countries.ts} +9 -1
  80. package/src/phoneNumberInput/utils/cleanNumber/cleanNumber.ts +3 -0
  81. package/src/phoneNumberInput/utils/excludeCountries/{excludeCountries.spec.js → excludeCountries.spec.ts} +1 -1
  82. package/src/phoneNumberInput/utils/excludeCountries/{excludeCountries.js → excludeCountries.ts} +6 -5
  83. package/src/phoneNumberInput/utils/explodeNumberModel/{explodeNumberModel.spec.js → explodeNumberModel.spec.ts} +1 -1
  84. package/src/phoneNumberInput/utils/explodeNumberModel/index.ts +24 -0
  85. package/src/phoneNumberInput/utils/findCountryByCode/{findCountryByCode.spec.js → findCountryByCode.spec.ts} +0 -1
  86. package/src/phoneNumberInput/utils/findCountryByCode/index.ts +12 -0
  87. package/src/phoneNumberInput/utils/findCountryByPrefix/index.ts +12 -0
  88. package/src/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.spec.ts +102 -0
  89. package/src/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.ts +12 -0
  90. package/src/phoneNumberInput/utils/{index.js → index.ts} +0 -2
  91. package/src/phoneNumberInput/utils/isStringNumeric/{isStringNumeric.spec.js → isStringNumeric.spec.ts} +0 -1
  92. package/src/phoneNumberInput/utils/isStringNumeric/isStringNumeric.ts +1 -0
  93. package/src/phoneNumberInput/utils/isValidPhoneNumber/{isValidPhoneNumber.spec.js → isValidPhoneNumber.spec.ts} +1 -1
  94. package/src/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.ts +7 -0
  95. package/src/phoneNumberInput/utils/longestMatchingPrefix/index.ts +4 -0
  96. package/src/phoneNumberInput/utils/setDefaultPrefix/index.ts +20 -0
  97. package/src/phoneNumberInput/utils/sortArrayByProperty/sortArrayByProperty.ts +6 -0
  98. package/src/segmentedControl/SegmentedControl.css +101 -0
  99. package/src/segmentedControl/SegmentedControl.less +101 -0
  100. package/src/segmentedControl/SegmentedControl.spec.tsx +106 -0
  101. package/src/segmentedControl/SegmentedControl.story.tsx +55 -0
  102. package/src/segmentedControl/SegmentedControl.tsx +175 -0
  103. package/src/segmentedControl/index.ts +2 -0
  104. package/src/select/Select.css +0 -4
  105. package/src/ssr.spec.js +17 -0
  106. package/src/withDisplayFormat/WithDisplayFormat.spec.js +1 -1
  107. package/src/withDisplayFormat/WithDisplayFormat.tsx +1 -1
  108. package/build/types/phoneNumberInput/utils/filterOptionsForQuery/index.d.ts +0 -2
  109. package/build/types/phoneNumberInput/utils/filterOptionsForQuery/index.d.ts.map +0 -1
  110. package/build/types/phoneNumberInput/utils/isOptionAndFitsQuery/index.d.ts +0 -2
  111. package/build/types/phoneNumberInput/utils/isOptionAndFitsQuery/index.d.ts.map +0 -1
  112. package/build/types/phoneNumberInput/utils/isOptionAndFitsQuery/isOptionAndFitsQuery.d.ts +0 -3
  113. package/build/types/phoneNumberInput/utils/isOptionAndFitsQuery/isOptionAndFitsQuery.d.ts.map +0 -1
  114. package/build/types/utilities/wrapInFragment.d.ts +0 -3
  115. package/build/types/utilities/wrapInFragment.d.ts.map +0 -1
  116. package/src/common/locale/index.js +0 -139
  117. package/src/phoneNumberInput/PhoneNumberInput.js +0 -210
  118. package/src/phoneNumberInput/data/countries.spec.js +0 -12
  119. package/src/phoneNumberInput/utils/cleanNumber/cleanNumber.js +0 -4
  120. package/src/phoneNumberInput/utils/explodeNumberModel/index.js +0 -27
  121. package/src/phoneNumberInput/utils/filterOptionsForQuery/filterOptionsForQuery.spec.js +0 -36
  122. package/src/phoneNumberInput/utils/filterOptionsForQuery/index.js +0 -11
  123. package/src/phoneNumberInput/utils/findCountryByCode/index.js +0 -10
  124. package/src/phoneNumberInput/utils/findCountryByPrefix/index.js +0 -11
  125. package/src/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.js +0 -26
  126. package/src/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.spec.js +0 -67
  127. package/src/phoneNumberInput/utils/isOptionAndFitsQuery/index.js +0 -1
  128. package/src/phoneNumberInput/utils/isOptionAndFitsQuery/isOptionAndFitsQuery.js +0 -25
  129. package/src/phoneNumberInput/utils/isOptionAndFitsQuery/isOptionAndFitsQuery.spec.js +0 -66
  130. package/src/phoneNumberInput/utils/isStringNumeric/isStringNumeric.js +0 -1
  131. package/src/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.js +0 -10
  132. package/src/phoneNumberInput/utils/longestMatchingPrefix/index.js +0 -2
  133. package/src/phoneNumberInput/utils/setDefaultPrefix/index.js +0 -25
  134. package/src/phoneNumberInput/utils/sortArrayByProperty/sortArrayByProperty.js +0 -3
  135. package/src/utilities/wrapInFragment.tsx +0 -3
  136. /package/src/phoneNumberInput/{PhoneNumberInput.story.js → PhoneNumberInput.story.tsx} +0 -0
  137. /package/src/phoneNumberInput/{index.js → index.ts} +0 -0
  138. /package/src/phoneNumberInput/utils/cleanNumber/{cleanNumber.spec.js → cleanNumber.spec.ts} +0 -0
  139. /package/src/phoneNumberInput/utils/cleanNumber/{index.js → index.ts} +0 -0
  140. /package/src/phoneNumberInput/utils/excludeCountries/{index.js → index.ts} +0 -0
  141. /package/src/phoneNumberInput/utils/findCountryByPrefix/{findCountryByPrefix.spec.js → findCountryByPrefix.spec.ts} +0 -0
  142. /package/src/phoneNumberInput/utils/groupCountriesByPrefix/{index.js → index.ts} +0 -0
  143. /package/src/phoneNumberInput/utils/isStringNumeric/{index.js → index.ts} +0 -0
  144. /package/src/phoneNumberInput/utils/isValidPhoneNumber/{index.js → index.ts} +0 -0
  145. /package/src/phoneNumberInput/utils/longestMatchingPrefix/{longestMatchingPrefix.spec.js → longestMatchingPrefix.spec.ts} +0 -0
  146. /package/src/phoneNumberInput/utils/setDefaultPrefix/{setDefaultPrefix.spec.js → setDefaultPrefix.spec.ts} +0 -0
  147. /package/src/phoneNumberInput/utils/sortArrayByProperty/{index.js → index.ts} +0 -0
  148. /package/src/phoneNumberInput/utils/sortArrayByProperty/{sortArrayByProperty.spec.js → sortArrayByProperty.spec.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"SelectInput.d.ts","sourceRoot":"","sources":["../../../src/inputs/SelectInput.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAmCjC,MAAM,WAAW,qBAAqB,CAAC,CAAC,GAAG,MAAM;IAC/C,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,CAAC,CAAC;IACT,cAAc,CAAC,EAAE,SAA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AClB,GAAG,SAAS,EACb,EAAE,6BAA6B,CAAC,CAAC,CAAC,+BAalC;AAwTD,MAAM,WAAW,6BAA6B;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB;AAED,wBAAgB,wBAAwB,CAAC,EACvC,KAAK,EACL,IAAI,EACJ,WAAW,EACX,IAAI,GACL,EAAE,6BAA6B,+BAiD/B"}
@@ -1,27 +1,22 @@
1
- import * as React from 'react';
2
-
3
- export type PhoneNumberInputSize = "sm" | "md" | "lg";
4
-
5
- export interface PhoneNumberInputProps {
6
- id?: string;
7
- required?: boolean;
8
- disabled?: boolean;
9
- initialValue?: string;
10
- onChange: (...args: any[])=>any;
11
- onFocus?: (...args: any[])=>any;
12
- onBlur?: (...args: any[])=>any;
13
- countryCode?: string;
14
- searchPlaceholder?: string;
15
- size?: PhoneNumberInputSize;
16
- placeholder?: string;
17
- selectProps?: Object;
18
- /**
19
- * List of iso3 codes of countries to remove from the list
20
- */
21
- disabledCountries?: string[];
22
- }
23
-
24
- declare const PhoneNumberInput: React.FC<PhoneNumberInputProps>;
25
-
26
- export default PhoneNumberInput;
27
-
1
+ /// <reference types="react" />
2
+ import { SizeLarge, SizeMedium, SizeSmall } from '../common';
3
+ import { SelectInputProps } from '../inputs/SelectInput';
4
+ export interface PhoneNumberInputProps {
5
+ id?: string;
6
+ required?: boolean;
7
+ disabled?: boolean;
8
+ initialValue?: string;
9
+ onChange: (value: string | null, prefix: string) => void;
10
+ onFocus?: React.FocusEventHandler<HTMLInputElement>;
11
+ onBlur?: React.FocusEventHandler<HTMLInputElement>;
12
+ countryCode?: string;
13
+ searchPlaceholder?: string;
14
+ size?: SizeSmall | SizeMedium | SizeLarge;
15
+ placeholder?: string;
16
+ selectProps?: Partial<SelectInputProps<string | null>>;
17
+ /** List of iso3 codes of countries to remove from the list */
18
+ disabledCountries?: string[];
19
+ }
20
+ declare const PhoneNumberInput: ({ id, required, disabled, initialValue, onChange, onFocus, onBlur, countryCode, searchPlaceholder, size, placeholder, selectProps, disabledCountries, }: PhoneNumberInputProps) => import("react").JSX.Element;
21
+ export default PhoneNumberInput;
22
+ //# sourceMappingURL=PhoneNumberInput.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PhoneNumberInput.d.ts","sourceRoot":"","sources":["../../../src/phoneNumberInput/PhoneNumberInput.js"],"names":[],"mappings":";AAqBA,2EA0JC;;;;;;;;;;;;;;;;;;;;;;;;;;QAwBC,gCAAY;QACZ,+BAAW"}
1
+ {"version":3,"file":"PhoneNumberInput.d.ts","sourceRoot":"","sources":["../../../src/phoneNumberInput/PhoneNumberInput.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAQ,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAyC,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAiBhG,MAAM,WAAW,qBAAqB;IACpC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IACpD,MAAM,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,IAAI,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;IACvD,8DAA8D;IAC9D,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC9B;AAKD,QAAA,MAAM,gBAAgB,4JAcnB,qBAAqB,gCAuIvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -1,15 +1,10 @@
1
- export default countries;
2
- declare const countries: ({
3
- name: string;
4
- iso2: string;
5
- iso3: string;
6
- phone: string;
7
- phoneFormat?: undefined;
8
- } | {
1
+ export type Country = {
9
2
  name: string;
10
3
  iso2: string;
11
4
  iso3: string;
12
5
  phone: string;
13
- phoneFormat: string;
14
- })[];
6
+ phoneFormat?: string;
7
+ };
8
+ declare const countries: Country[];
9
+ export default countries;
15
10
  //# sourceMappingURL=countries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"countries.d.ts","sourceRoot":"","sources":["../../../../src/phoneNumberInput/data/countries.js"],"names":[],"mappings":";AAAA;;;;;;;;;;;;KAu/CE"}
1
+ {"version":3,"file":"countries.d.ts","sourceRoot":"","sources":["../../../../src/phoneNumberInput/data/countries.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,QAAA,MAAM,SAAS,EAAE,OAAO,EAu/CvB,CAAC;AACF,eAAe,SAAS,CAAC"}
@@ -1,2 +1,2 @@
1
- export { default } from "./PhoneNumberInput";
1
+ export { default } from './PhoneNumberInput';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/phoneNumberInput/index.js"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/phoneNumberInput/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1,2 +1,2 @@
1
- export function cleanNumber(number: any): any;
1
+ export declare const cleanNumber: (number: string) => string;
2
2
  //# sourceMappingURL=cleanNumber.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cleanNumber.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/cleanNumber/cleanNumber.js"],"names":[],"mappings":"AAEO,8CACoE"}
1
+ {"version":3,"file":"cleanNumber.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/cleanNumber/cleanNumber.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,WAAY,MAAM,WAA+C,CAAC"}
@@ -1,2 +1,2 @@
1
- export { cleanNumber } from "./cleanNumber";
1
+ export { cleanNumber } from './cleanNumber';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/cleanNumber/index.js"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/cleanNumber/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
@@ -1,2 +1,9 @@
1
- export function excludeCountries(countries: any[], disabledCountries: any[]): any;
1
+ import type { Country } from '../../data/countries';
2
+ /**
3
+ * Removes the countries sepecified in the second param
4
+ *
5
+ * @param countries list of country metadata objects
6
+ * @param disabledCountries list of iso3 country codes to remove from the list
7
+ */
8
+ export declare const excludeCountries: (countries: Country[], disabledCountries: string[]) => Country[];
2
9
  //# sourceMappingURL=excludeCountries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"excludeCountries.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/excludeCountries/excludeCountries.js"],"names":[],"mappings":"AAaO,kFAIN"}
1
+ {"version":3,"file":"excludeCountries.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/excludeCountries/excludeCountries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAQpD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,cAAe,OAAO,EAAE,qBAAqB,MAAM,EAAE,cAIjF,CAAC"}
@@ -1,2 +1,2 @@
1
- export { excludeCountries } from "./excludeCountries";
1
+ export { excludeCountries } from './excludeCountries';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/excludeCountries/index.js"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/excludeCountries/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1,6 +1,10 @@
1
- export function explodeNumberModel(number: string): {
2
- prefix: (string | any);
1
+ export interface PhoneNumber {
2
+ prefix: string | null;
3
3
  suffix: string;
4
- format: string;
5
- };
4
+ format?: string;
5
+ }
6
+ /**
7
+ * @param number Phone number in a format like "+447573135343"
8
+ */
9
+ export declare const explodeNumberModel: (number: string) => PhoneNumber;
6
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/explodeNumberModel/index.js"],"names":[],"mappings":"AASO,2CAHI,MAAM;YACK,CAAC,MAAM,MAAE,CAAC;YAAU,MAAM;YAAU,MAAM;EAmB/D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/explodeNumberModel/index.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,WAAY,MAAM,KAAG,WAYnD,CAAC"}
@@ -1,2 +1,2 @@
1
- export function findCountryByCode(code: any): any;
1
+ export declare const findCountryByCode: (code: string) => import("../../data/countries").Country | null;
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/findCountryByCode/index.js"],"names":[],"mappings":"AAGO,kDAMN"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/findCountryByCode/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,SAAU,MAAM,kDAQ7C,CAAC"}
@@ -1,2 +1,2 @@
1
- export function findCountryByPrefix(number: any): any;
1
+ export declare const findCountryByPrefix: (number: string) => import("../../data/countries").Country | null;
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/findCountryByPrefix/index.js"],"names":[],"mappings":"AAGO,sDAON"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/findCountryByPrefix/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB,WAAY,MAAM,kDAQjD,CAAC"}
@@ -1,2 +1,3 @@
1
- export function groupCountriesByPrefix(countries: any): any[];
1
+ import { Country } from '../../data/countries';
2
+ export declare const groupCountriesByPrefix: (countries: Country[]) => Map<string, Country[]>;
2
3
  //# sourceMappingURL=groupCountriesByPrefix.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"groupCountriesByPrefix.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.js"],"names":[],"mappings":"AAEO,8DAuBN"}
1
+ {"version":3,"file":"groupCountriesByPrefix.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,eAAO,MAAM,sBAAsB,cAAe,OAAO,EAAE,2BAS1D,CAAC"}
@@ -1,2 +1,2 @@
1
- export { groupCountriesByPrefix } from "./groupCountriesByPrefix";
1
+ export { groupCountriesByPrefix } from './groupCountriesByPrefix';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/groupCountriesByPrefix/index.js"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/groupCountriesByPrefix/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -1,14 +1,12 @@
1
- export { setDefaultPrefix } from "./setDefaultPrefix";
2
- export { isValidPhoneNumber } from "./isValidPhoneNumber";
3
- export { explodeNumberModel } from "./explodeNumberModel";
4
- export { longestMatchingPrefix } from "./longestMatchingPrefix";
5
- export { findCountryByPrefix } from "./findCountryByPrefix";
6
- export { findCountryByCode } from "./findCountryByCode";
7
- export { filterOptionsForQuery } from "./filterOptionsForQuery";
8
- export { isOptionAndFitsQuery } from "./isOptionAndFitsQuery";
9
- export { cleanNumber } from "./cleanNumber";
10
- export { isStringNumeric } from "./isStringNumeric";
11
- export { sortArrayByProperty } from "./sortArrayByProperty";
12
- export { groupCountriesByPrefix } from "./groupCountriesByPrefix";
13
- export { excludeCountries } from "./excludeCountries";
1
+ export { setDefaultPrefix } from './setDefaultPrefix';
2
+ export { isValidPhoneNumber } from './isValidPhoneNumber';
3
+ export { explodeNumberModel } from './explodeNumberModel';
4
+ export { longestMatchingPrefix } from './longestMatchingPrefix';
5
+ export { findCountryByPrefix } from './findCountryByPrefix';
6
+ export { findCountryByCode } from './findCountryByCode';
7
+ export { cleanNumber } from './cleanNumber';
8
+ export { isStringNumeric } from './isStringNumeric';
9
+ export { sortArrayByProperty } from './sortArrayByProperty';
10
+ export { groupCountriesByPrefix } from './groupCountriesByPrefix';
11
+ export { excludeCountries } from './excludeCountries';
14
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/phoneNumberInput/utils/index.js"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/phoneNumberInput/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1,2 +1,2 @@
1
- export { isStringNumeric } from "./isStringNumeric";
1
+ export { isStringNumeric } from './isStringNumeric';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/isStringNumeric/index.js"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/isStringNumeric/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,2 +1,2 @@
1
- export function isStringNumeric(value: any): boolean;
1
+ export declare const isStringNumeric: (value: string) => boolean;
2
2
  //# sourceMappingURL=isStringNumeric.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"isStringNumeric.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/isStringNumeric/isStringNumeric.js"],"names":[],"mappings":"AAAO,qDAA8D"}
1
+ {"version":3,"file":"isStringNumeric.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/isStringNumeric/isStringNumeric.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,UAAW,MAAM,YAAgC,CAAC"}
@@ -1,2 +1,2 @@
1
- export { isValidPhoneNumber } from "./isValidPhoneNumber";
1
+ export { isValidPhoneNumber } from './isValidPhoneNumber';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/isValidPhoneNumber/index.js"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/isValidPhoneNumber/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -1,2 +1,7 @@
1
- export function isValidPhoneNumber(phoneNumber: any): boolean;
1
+ /**
2
+ *
3
+ * @param phoneNumber
4
+ * @returns True if number that starts with "+" and contains a mix of digits and spaces with at least 4 digits.
5
+ */
6
+ export declare const isValidPhoneNumber: (phoneNumber: string) => boolean;
2
7
  //# sourceMappingURL=isValidPhoneNumber.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"isValidPhoneNumber.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.js"],"names":[],"mappings":"AAMO,sDAHM,OAAO,CAM4B"}
1
+ {"version":3,"file":"isValidPhoneNumber.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,gBAAiB,MAAM,YACsC,CAAC"}
@@ -1,2 +1,3 @@
1
- export function longestMatchingPrefix(matchingCodes: any): any;
1
+ import { Country } from '../../data/countries';
2
+ export declare const longestMatchingPrefix: (matchingCodes: Country[]) => Country;
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/longestMatchingPrefix/index.js"],"names":[],"mappings":"AAAO,+DACoE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/longestMatchingPrefix/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,eAAO,MAAM,qBAAqB,kBAAmB,OAAO,EAAE,YACa,CAAC"}
@@ -1,2 +1,8 @@
1
- export function setDefaultPrefix(locale: string, countryCode: any): string;
1
+ /**
2
+ * Given a valid locale it returns the correspondent prefix if found or +44 otherwise.
3
+ *
4
+ * @param locale BCP 47 language tag of locale, e.g. `"es-ES"`.
5
+ * @param countryCode Two-letter country code (ISO 3166-1 alpha-2).
6
+ */
7
+ export declare const setDefaultPrefix: (locale: string, countryCode?: string) => string;
2
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/setDefaultPrefix/index.js"],"names":[],"mappings":"AAeO,yCAJI,MAAM,qBAEJ,MAAM,CAWlB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/setDefaultPrefix/index.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,WAAY,MAAM,gBAAgB,MAAM,WAKpE,CAAC"}
@@ -1,2 +1,2 @@
1
- export { sortArrayByProperty } from "./sortArrayByProperty";
1
+ export { sortArrayByProperty } from './sortArrayByProperty';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/sortArrayByProperty/index.js"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/sortArrayByProperty/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -1,2 +1,2 @@
1
- export function sortArrayByProperty(arrayToSort: any, property: any): any[];
1
+ export declare function sortArrayByProperty<T extends Record<PropertyKey, string>>(arrayToSort: T[], property: keyof T): T[];
2
2
  //# sourceMappingURL=sortArrayByProperty.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sortArrayByProperty.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/sortArrayByProperty/sortArrayByProperty.js"],"names":[],"mappings":"AACO,4EACkE"}
1
+ {"version":3,"file":"sortArrayByProperty.d.ts","sourceRoot":"","sources":["../../../../../src/phoneNumberInput/utils/sortArrayByProperty/sortArrayByProperty.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,EACvE,WAAW,EAAE,CAAC,EAAE,EAChB,QAAQ,EAAE,MAAM,CAAC,OAGlB"}
@@ -0,0 +1,31 @@
1
+ /// <reference types="react" />
2
+ type SegmentBase = {
3
+ id: string;
4
+ label: string;
5
+ value: string;
6
+ };
7
+ type Segment = SegmentBase & {
8
+ controls?: never;
9
+ };
10
+ type SegmentWithControls = SegmentBase & {
11
+ controls: string;
12
+ };
13
+ export type Segments = Segment[] | SegmentWithControls[];
14
+ type SegmentedControlPropsBase = {
15
+ name: string;
16
+ defaultValue: string;
17
+ mode: 'input' | 'view';
18
+ onChange: (value: string) => void;
19
+ };
20
+ type SegmentedControlViewProps = {
21
+ mode: 'view';
22
+ segments: SegmentWithControls[];
23
+ };
24
+ type SegmentedControlInputProps = {
25
+ mode: 'input';
26
+ segments: Segment[];
27
+ };
28
+ export type SegmentedControlProps = SegmentedControlPropsBase & (SegmentedControlViewProps | SegmentedControlInputProps);
29
+ declare const SegmentedControl: ({ name, defaultValue, mode, segments, onChange, }: SegmentedControlProps) => import("react").JSX.Element;
30
+ export default SegmentedControl;
31
+ //# sourceMappingURL=SegmentedControl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SegmentedControl.d.ts","sourceRoot":"","sources":["../../../src/segmentedControl/SegmentedControl.tsx"],"names":[],"mappings":";AAMA,KAAK,WAAW,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhE,KAAK,OAAO,GAAG,WAAW,GAAG;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAClD,KAAK,mBAAmB,GAAG,WAAW,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D,MAAM,MAAM,QAAQ,GAAG,OAAO,EAAE,GAAG,mBAAmB,EAAE,CAAC;AAEzD,KAAK,yBAAyB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IACvB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,mBAAmB,EAAE,CAAC;CACjC,CAAC;AAEF,KAAK,0BAA0B,GAAG;IAChC,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,yBAAyB,GAC3D,CAAC,yBAAyB,GAAG,0BAA0B,CAAC,CAAC;AAE3D,QAAA,MAAM,gBAAgB,sDAMnB,qBAAqB,gCAqIvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './SegmentedControl';
2
+ export { default } from './SegmentedControl';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/segmentedControl/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "46.6.0",
3
+ "version": "46.8.0",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -21,7 +21,7 @@
21
21
  "!**/*.tsbuildinfo"
22
22
  ],
23
23
  "devDependencies": {
24
- "@babel/core": "^7.22.15",
24
+ "@babel/core": "^7.23.9",
25
25
  "@babel/plugin-transform-runtime": "^7.22.15",
26
26
  "@babel/preset-env": "^7.22.15",
27
27
  "@babel/preset-react": "^7.22.15",
@@ -53,7 +53,7 @@
53
53
  "@testing-library/react-hooks": "^8.0.0",
54
54
  "@testing-library/user-event": "^13.2.1",
55
55
  "@transferwise/icons": "^3.7.0",
56
- "@transferwise/neptune-tokens": "^8.8.0",
56
+ "@transferwise/neptune-tokens": "^8.8.1",
57
57
  "@tsconfig/recommended": "^1.0.2",
58
58
  "@types/babel__core": "^7.20.1",
59
59
  "@types/jest": "^26.0.20",
@@ -65,25 +65,23 @@
65
65
  "@types/use-sync-external-store": "^0.0.4",
66
66
  "@wise/art": "^2.7.0",
67
67
  "@wojtekmaj/enzyme-adapter-react-17": "^0.6.3",
68
- "babel-plugin-formatjs": "^10.5.3",
68
+ "babel-plugin-formatjs": "^10.5.13",
69
69
  "babel-plugin-inline-react-svg": "^2.0.2",
70
70
  "enzyme": "^3.11.0",
71
- "html-loader": "^1.3.2",
72
71
  "jest": "^27.0.6",
73
72
  "jest-cli": "^27.0.6",
74
73
  "jest-fetch-mock": "^3.0.3",
75
74
  "lodash.times": "^4.3.2",
76
- "npm-watch": "^0.11.0",
77
75
  "react-intl": "^5.10.0",
78
76
  "rollup": "^3.28.1",
79
77
  "storybook": "^7.4.5",
80
78
  "@transferwise/less-config": "3.1.0",
81
- "@transferwise/neptune-css": "14.9.3",
79
+ "@transferwise/neptune-css": "14.9.5",
82
80
  "@wise/components-theming": "0.8.4"
83
81
  },
84
82
  "peerDependencies": {
85
83
  "@transferwise/icons": "^3.7.0",
86
- "@transferwise/neptune-css": "^14.9.3",
84
+ "@transferwise/neptune-css": "^14.9.5",
87
85
  "@wise/art": "^2.7.0",
88
86
  "@wise/components-theming": "^0.8.4",
89
87
  "react": ">=16.14",
@@ -119,21 +117,13 @@
119
117
  "react-transition-group": "^4.4.2",
120
118
  "use-sync-external-store": "^1.2.0"
121
119
  },
122
- "watch": {
123
- "build:crowdin-source-file": "src/**/*.messages.js"
124
- },
125
- "resolutions": {
126
- "**/remark-parse/trim": "0.0.3",
127
- "**/chokidar/glob-parent": "5.1.2",
128
- "**/fast-glob/glob-parent": "5.1.2"
129
- },
130
120
  "publishConfig": {
131
121
  "access": "public"
132
122
  },
133
123
  "scripts": {
134
124
  "dev": "npm-run-all --parallel dev:* dev:*:* storybook:dev",
135
125
  "dev:less:watch": "gulp watchLess --dest=src",
136
- "dev:translations": "npx npm-watch",
126
+ "dev:translations": "pnpm build:crowdin-source-file",
137
127
  "storybook:dev": "storybook dev -p 3001",
138
128
  "storybook:build": "storybook build --webpack-stats-json",
139
129
  "build:css": "gulp compileLess --dest=src",
@@ -24,8 +24,8 @@ describe('locale utils', () => {
24
24
  ['zh_HK', 'zh'],
25
25
  ['ja-JP', 'ja'],
26
26
  ['zhHK', null],
27
- [null, null],
28
- [undefined, null],
27
+ [null as any, null],
28
+ [undefined as any, null],
29
29
  ['', null],
30
30
  [' ', null],
31
31
  ['ar-dz', null],
@@ -51,8 +51,8 @@ describe('locale utils', () => {
51
51
  ['zh_HK', 'zh-HK'],
52
52
  ['ja-JP', 'ja-JP'],
53
53
  ['zhHK', null],
54
- [null, null],
55
- [undefined, null],
54
+ [null as any, null],
55
+ [undefined as any, null],
56
56
  ['', null],
57
57
  [' ', null],
58
58
  ['ar-dz', 'ar-DZ'],
@@ -0,0 +1,96 @@
1
+ import { Direction } from '..';
2
+
3
+ export const DEFAULT_LANG = 'en';
4
+ export const DEFAULT_LOCALE = 'en-GB';
5
+
6
+ /**
7
+ * Languages written right-to-left.
8
+ */
9
+ export const RTL_LANGUAGES = ['ar', 'he'];
10
+
11
+ /**
12
+ * @deprecated The source of truth for supported languages lives in Crab.
13
+ */
14
+ export const SUPPORTED_LANGUAGES = [
15
+ DEFAULT_LANG,
16
+ 'de',
17
+ 'es',
18
+ 'fr',
19
+ 'hu',
20
+ 'id',
21
+ 'it',
22
+ 'ja',
23
+ 'pl',
24
+ 'pt',
25
+ 'ro',
26
+ 'ru',
27
+ 'th',
28
+ 'tr',
29
+ 'uk',
30
+ 'zh',
31
+ ];
32
+
33
+ /**
34
+ * Verifies and adjusts locale, replacing `_` with `-`.
35
+ *
36
+ * @param locale `es`, `es_ES`, `en-GB`, `en`, `ja`, `ja-JP`, etc.
37
+ * @returns `null` if locale is unrecognized by `Intl.Locale`.
38
+ */
39
+ export function adjustLocale(locale: string) {
40
+ const localeTrimmed = locale?.trim();
41
+ if (localeTrimmed) {
42
+ try {
43
+ return new Intl.Locale(localeTrimmed.replace('_', '-')).baseName;
44
+ } catch (error) {
45
+ // eslint-disable-next-line no-console
46
+ console.error(error);
47
+ }
48
+ }
49
+ return null;
50
+ }
51
+
52
+ /**
53
+ * Provides corresponding lang (iso2) for provided locale.
54
+ *
55
+ * @deprecated The use of this function almost always breaks language variants
56
+ * e.g. Simplified and Traditional Chinese.
57
+ * There should be no use case for this function.
58
+ * To select the correct translations from a translations object, pass the
59
+ * locale directly into Crab's getLocalisedMessages.
60
+ * @param locale `es`, `es-ES`, `en-GB`, `en`, `ja`, `ja-JP`, etc.
61
+ * @returns Two-letter ISO 639-1 language code, falling back to `null` if locale is invalid or language is unsupported.
62
+ */
63
+ export function getLangFromLocale(locale: string) {
64
+ const adjustedLocale = adjustLocale(locale);
65
+ if (adjustedLocale != null) {
66
+ const { language } = new Intl.Locale(adjustedLocale);
67
+ if (SUPPORTED_LANGUAGES.includes(language)) {
68
+ return language;
69
+ }
70
+ }
71
+ return null;
72
+ }
73
+
74
+ /**
75
+ * Provides corresponding country code (iso2) for locales code with explicit region value.
76
+ *
77
+ * @param locale `es-ES`, `en-GB`, `ja-JP`, etc.
78
+ * @returns `null` if the locale is invalid or the region can‘t be identified.
79
+ */
80
+ export function getCountryFromLocale(locale: string) {
81
+ const adjustedLocale = adjustLocale(locale);
82
+ return adjustedLocale != null ? new Intl.Locale(adjustedLocale).region ?? null : null;
83
+ }
84
+
85
+ /**
86
+ * Provides the layout direction for a given locale.
87
+ *
88
+ * @param locale `es`, `es-ES`, `en-GB`, `en`, `ja`, `ja-JP`, etc.
89
+ * @returns The layout direction based on the locale, falling back to `Direction.LTR` if the locale is invalid or unsupported.
90
+ */
91
+ export function getDirectionFromLocale(locale: string) {
92
+ const adjustedLocale = adjustLocale(locale);
93
+ return adjustedLocale != null && RTL_LANGUAGES.includes(new Intl.Locale(adjustedLocale).language)
94
+ ? Direction.RTL
95
+ : Direction.LTR;
96
+ }