@transferwise/components 0.0.0-experimental-778ee44 → 0.0.0-experimental-ae2a4e7

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 (153) hide show
  1. package/build/index.esm.js +226 -327
  2. package/build/index.esm.js.map +1 -1
  3. package/build/index.js +227 -328
  4. package/build/index.js.map +1 -1
  5. package/build/types/common/locale/index.d.ts +26 -43
  6. package/build/types/common/locale/index.d.ts.map +1 -1
  7. package/build/types/common/textFormat/formatWithPattern/formatWithPattern.d.ts +1 -1
  8. package/build/types/common/textFormat/formatWithPattern/formatWithPattern.d.ts.map +1 -1
  9. package/build/types/common/textFormat/getCursorPositionAfterKeystroke/getCursorPositionAfterKeystroke.d.ts +2 -3
  10. package/build/types/common/textFormat/getCursorPositionAfterKeystroke/getCursorPositionAfterKeystroke.d.ts.map +1 -1
  11. package/build/types/common/textFormat/getSymbolsInPatternWithPosition/getSymbolsInPatternWithPosition.d.ts +1 -5
  12. package/build/types/common/textFormat/getSymbolsInPatternWithPosition/getSymbolsInPatternWithPosition.d.ts.map +1 -1
  13. package/build/types/common/textFormat/unformatWithPattern/unformatWithPattern.d.ts +1 -1
  14. package/build/types/common/textFormat/unformatWithPattern/unformatWithPattern.d.ts.map +1 -1
  15. package/build/types/index.d.ts +0 -2
  16. package/build/types/index.d.ts.map +1 -1
  17. package/build/types/inputWithDisplayFormat/InputWithDisplayFormat.d.ts +11 -5
  18. package/build/types/inputWithDisplayFormat/InputWithDisplayFormat.d.ts.map +1 -1
  19. package/build/types/inputWithDisplayFormat/index.d.ts +1 -2
  20. package/build/types/inputWithDisplayFormat/index.d.ts.map +1 -1
  21. package/build/types/inputs/Input.d.ts +6 -8
  22. package/build/types/inputs/Input.d.ts.map +1 -1
  23. package/build/types/phoneNumberInput/PhoneNumberInput.d.ts +30 -27
  24. package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
  25. package/build/types/phoneNumberInput/data/countries.d.ts +5 -10
  26. package/build/types/phoneNumberInput/data/countries.d.ts.map +1 -1
  27. package/build/types/phoneNumberInput/index.d.ts +1 -1
  28. package/build/types/phoneNumberInput/index.d.ts.map +1 -1
  29. package/build/types/phoneNumberInput/utils/cleanNumber/cleanNumber.d.ts +1 -1
  30. package/build/types/phoneNumberInput/utils/cleanNumber/cleanNumber.d.ts.map +1 -1
  31. package/build/types/phoneNumberInput/utils/cleanNumber/index.d.ts +1 -1
  32. package/build/types/phoneNumberInput/utils/cleanNumber/index.d.ts.map +1 -1
  33. package/build/types/phoneNumberInput/utils/excludeCountries/excludeCountries.d.ts +8 -1
  34. package/build/types/phoneNumberInput/utils/excludeCountries/excludeCountries.d.ts.map +1 -1
  35. package/build/types/phoneNumberInput/utils/excludeCountries/index.d.ts +1 -1
  36. package/build/types/phoneNumberInput/utils/excludeCountries/index.d.ts.map +1 -1
  37. package/build/types/phoneNumberInput/utils/explodeNumberModel/index.d.ts +8 -4
  38. package/build/types/phoneNumberInput/utils/explodeNumberModel/index.d.ts.map +1 -1
  39. package/build/types/phoneNumberInput/utils/findCountryByCode/index.d.ts +1 -1
  40. package/build/types/phoneNumberInput/utils/findCountryByCode/index.d.ts.map +1 -1
  41. package/build/types/phoneNumberInput/utils/findCountryByPrefix/index.d.ts +1 -1
  42. package/build/types/phoneNumberInput/utils/findCountryByPrefix/index.d.ts.map +1 -1
  43. package/build/types/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.d.ts +2 -1
  44. package/build/types/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.d.ts.map +1 -1
  45. package/build/types/phoneNumberInput/utils/groupCountriesByPrefix/index.d.ts +1 -1
  46. package/build/types/phoneNumberInput/utils/groupCountriesByPrefix/index.d.ts.map +1 -1
  47. package/build/types/phoneNumberInput/utils/index.d.ts +11 -13
  48. package/build/types/phoneNumberInput/utils/index.d.ts.map +1 -1
  49. package/build/types/phoneNumberInput/utils/isStringNumeric/index.d.ts +1 -1
  50. package/build/types/phoneNumberInput/utils/isStringNumeric/index.d.ts.map +1 -1
  51. package/build/types/phoneNumberInput/utils/isStringNumeric/isStringNumeric.d.ts +1 -1
  52. package/build/types/phoneNumberInput/utils/isStringNumeric/isStringNumeric.d.ts.map +1 -1
  53. package/build/types/phoneNumberInput/utils/isValidPhoneNumber/index.d.ts +1 -1
  54. package/build/types/phoneNumberInput/utils/isValidPhoneNumber/index.d.ts.map +1 -1
  55. package/build/types/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.d.ts +6 -1
  56. package/build/types/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.d.ts.map +1 -1
  57. package/build/types/phoneNumberInput/utils/longestMatchingPrefix/index.d.ts +2 -1
  58. package/build/types/phoneNumberInput/utils/longestMatchingPrefix/index.d.ts.map +1 -1
  59. package/build/types/phoneNumberInput/utils/setDefaultPrefix/index.d.ts +7 -1
  60. package/build/types/phoneNumberInput/utils/setDefaultPrefix/index.d.ts.map +1 -1
  61. package/build/types/phoneNumberInput/utils/sortArrayByProperty/index.d.ts +1 -1
  62. package/build/types/phoneNumberInput/utils/sortArrayByProperty/index.d.ts.map +1 -1
  63. package/build/types/phoneNumberInput/utils/sortArrayByProperty/sortArrayByProperty.d.ts +1 -1
  64. package/build/types/phoneNumberInput/utils/sortArrayByProperty/sortArrayByProperty.d.ts.map +1 -1
  65. package/build/types/textareaWithDisplayFormat/TextareaWithDisplayFormat.d.ts +11 -5
  66. package/build/types/textareaWithDisplayFormat/TextareaWithDisplayFormat.d.ts.map +1 -1
  67. package/build/types/textareaWithDisplayFormat/index.d.ts +1 -2
  68. package/build/types/textareaWithDisplayFormat/index.d.ts.map +1 -1
  69. package/build/types/withDisplayFormat/WithDisplayFormat.d.ts +82 -55
  70. package/build/types/withDisplayFormat/WithDisplayFormat.d.ts.map +1 -1
  71. package/build/types/withDisplayFormat/index.d.ts +1 -2
  72. package/build/types/withDisplayFormat/index.d.ts.map +1 -1
  73. package/package.json +1 -1
  74. package/src/common/locale/{index.spec.js → index.spec.ts} +0 -4
  75. package/src/common/locale/index.ts +96 -0
  76. package/src/common/textFormat/formatWithPattern/{formatWithPattern.ts → formatWithPattern.js} +4 -8
  77. package/src/common/textFormat/getCursorPositionAfterKeystroke/{getCursorPositionAfterKeystroke.ts → getCursorPositionAfterKeystroke.js} +8 -9
  78. package/src/common/textFormat/getSymbolsInPatternWithPosition/{getSymbolsInPatternWithPosition.ts → getSymbolsInPatternWithPosition.js} +2 -7
  79. package/src/common/textFormat/unformatWithPattern/{unformatWithPattern.ts → unformatWithPattern.js} +2 -3
  80. package/src/index.ts +0 -2
  81. package/src/inputWithDisplayFormat/InputWithDisplayFormat.js +14 -0
  82. package/src/inputWithDisplayFormat/index.js +1 -0
  83. package/src/inputs/Input.tsx +11 -6
  84. package/src/phoneNumberInput/PhoneNumberInput.spec.js +18 -22
  85. package/src/phoneNumberInput/PhoneNumberInput.tsx +201 -0
  86. package/src/phoneNumberInput/data/{countries.js → countries.ts} +9 -1
  87. package/src/phoneNumberInput/utils/cleanNumber/cleanNumber.ts +3 -0
  88. package/src/phoneNumberInput/utils/excludeCountries/{excludeCountries.spec.js → excludeCountries.spec.ts} +1 -1
  89. package/src/phoneNumberInput/utils/excludeCountries/{excludeCountries.js → excludeCountries.ts} +6 -5
  90. package/src/phoneNumberInput/utils/explodeNumberModel/{explodeNumberModel.spec.js → explodeNumberModel.spec.ts} +1 -1
  91. package/src/phoneNumberInput/utils/explodeNumberModel/index.ts +25 -0
  92. package/src/phoneNumberInput/utils/findCountryByCode/{findCountryByCode.spec.js → findCountryByCode.spec.ts} +0 -1
  93. package/src/phoneNumberInput/utils/findCountryByCode/index.ts +12 -0
  94. package/src/phoneNumberInput/utils/findCountryByPrefix/index.ts +12 -0
  95. package/src/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.spec.ts +102 -0
  96. package/src/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.ts +12 -0
  97. package/src/phoneNumberInput/utils/{index.js → index.ts} +0 -2
  98. package/src/phoneNumberInput/utils/isStringNumeric/{isStringNumeric.spec.js → isStringNumeric.spec.ts} +0 -1
  99. package/src/phoneNumberInput/utils/isStringNumeric/isStringNumeric.ts +1 -0
  100. package/src/phoneNumberInput/utils/isValidPhoneNumber/{isValidPhoneNumber.spec.js → isValidPhoneNumber.spec.ts} +1 -1
  101. package/src/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.ts +7 -0
  102. package/src/phoneNumberInput/utils/longestMatchingPrefix/index.ts +4 -0
  103. package/src/phoneNumberInput/utils/setDefaultPrefix/index.ts +20 -0
  104. package/src/phoneNumberInput/utils/sortArrayByProperty/sortArrayByProperty.ts +6 -0
  105. package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.js +14 -0
  106. package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.spec.js +1 -3
  107. package/src/textareaWithDisplayFormat/index.js +1 -0
  108. package/src/withDisplayFormat/{WithDisplayFormat.tsx → WithDisplayFormat.js} +104 -111
  109. package/src/withDisplayFormat/index.js +1 -0
  110. package/build/types/phoneNumberInput/utils/filterOptionsForQuery/index.d.ts +0 -2
  111. package/build/types/phoneNumberInput/utils/filterOptionsForQuery/index.d.ts.map +0 -1
  112. package/build/types/phoneNumberInput/utils/isOptionAndFitsQuery/index.d.ts +0 -2
  113. package/build/types/phoneNumberInput/utils/isOptionAndFitsQuery/index.d.ts.map +0 -1
  114. package/build/types/phoneNumberInput/utils/isOptionAndFitsQuery/isOptionAndFitsQuery.d.ts +0 -3
  115. package/build/types/phoneNumberInput/utils/isOptionAndFitsQuery/isOptionAndFitsQuery.d.ts.map +0 -1
  116. package/src/common/locale/index.js +0 -139
  117. package/src/inputWithDisplayFormat/InputWithDisplayFormat.tsx +0 -11
  118. package/src/inputWithDisplayFormat/index.ts +0 -2
  119. package/src/phoneNumberInput/PhoneNumberInput.js +0 -210
  120. package/src/phoneNumberInput/data/countries.spec.js +0 -12
  121. package/src/phoneNumberInput/utils/cleanNumber/cleanNumber.js +0 -4
  122. package/src/phoneNumberInput/utils/explodeNumberModel/index.js +0 -27
  123. package/src/phoneNumberInput/utils/filterOptionsForQuery/filterOptionsForQuery.spec.js +0 -36
  124. package/src/phoneNumberInput/utils/filterOptionsForQuery/index.js +0 -11
  125. package/src/phoneNumberInput/utils/findCountryByCode/index.js +0 -10
  126. package/src/phoneNumberInput/utils/findCountryByPrefix/index.js +0 -11
  127. package/src/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.js +0 -26
  128. package/src/phoneNumberInput/utils/groupCountriesByPrefix/groupCountriesByPrefix.spec.js +0 -67
  129. package/src/phoneNumberInput/utils/isOptionAndFitsQuery/index.js +0 -1
  130. package/src/phoneNumberInput/utils/isOptionAndFitsQuery/isOptionAndFitsQuery.js +0 -25
  131. package/src/phoneNumberInput/utils/isOptionAndFitsQuery/isOptionAndFitsQuery.spec.js +0 -66
  132. package/src/phoneNumberInput/utils/isStringNumeric/isStringNumeric.js +0 -1
  133. package/src/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.js +0 -10
  134. package/src/phoneNumberInput/utils/longestMatchingPrefix/index.js +0 -2
  135. package/src/phoneNumberInput/utils/setDefaultPrefix/index.js +0 -25
  136. package/src/phoneNumberInput/utils/sortArrayByProperty/sortArrayByProperty.js +0 -3
  137. package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.story.tsx +0 -32
  138. package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.tsx +0 -11
  139. package/src/textareaWithDisplayFormat/index.ts +0 -2
  140. package/src/withDisplayFormat/index.ts +0 -2
  141. /package/src/phoneNumberInput/{PhoneNumberInput.story.js → PhoneNumberInput.story.tsx} +0 -0
  142. /package/src/phoneNumberInput/{index.js → index.ts} +0 -0
  143. /package/src/phoneNumberInput/utils/cleanNumber/{cleanNumber.spec.js → cleanNumber.spec.ts} +0 -0
  144. /package/src/phoneNumberInput/utils/cleanNumber/{index.js → index.ts} +0 -0
  145. /package/src/phoneNumberInput/utils/excludeCountries/{index.js → index.ts} +0 -0
  146. /package/src/phoneNumberInput/utils/findCountryByPrefix/{findCountryByPrefix.spec.js → findCountryByPrefix.spec.ts} +0 -0
  147. /package/src/phoneNumberInput/utils/groupCountriesByPrefix/{index.js → index.ts} +0 -0
  148. /package/src/phoneNumberInput/utils/isStringNumeric/{index.js → index.ts} +0 -0
  149. /package/src/phoneNumberInput/utils/isValidPhoneNumber/{index.js → index.ts} +0 -0
  150. /package/src/phoneNumberInput/utils/longestMatchingPrefix/{longestMatchingPrefix.spec.js → longestMatchingPrefix.spec.ts} +0 -0
  151. /package/src/phoneNumberInput/utils/setDefaultPrefix/{setDefaultPrefix.spec.js → setDefaultPrefix.spec.ts} +0 -0
  152. /package/src/phoneNumberInput/utils/sortArrayByProperty/{index.js → index.ts} +0 -0
  153. /package/src/phoneNumberInput/utils/sortArrayByProperty/{sortArrayByProperty.spec.js → sortArrayByProperty.spec.ts} +0 -0
@@ -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"}
@@ -1,5 +1,11 @@
1
- /// <reference types="react" />
2
- import { type TextInputProps } from '../withDisplayFormat';
3
- declare const TextareaWithDisplayFormat: (props: TextInputProps) => import("react").JSX.Element;
4
- export default TextareaWithDisplayFormat;
5
- //# sourceMappingURL=TextareaWithDisplayFormat.d.ts.map
1
+ import * as React from 'react';
2
+
3
+ export interface TextareaWithDisplayFormatProps {
4
+ displayPattern: string;
5
+ onChange: (...args: any[])=>any;
6
+ }
7
+
8
+ declare const TextareaWithDisplayFormat: React.FC<TextareaWithDisplayFormatProps>;
9
+
10
+ export default TextareaWithDisplayFormat;
11
+
@@ -1 +1 @@
1
- {"version":3,"file":"TextareaWithDisplayFormat.d.ts","sourceRoot":"","sources":["../../../src/textareaWithDisplayFormat/TextareaWithDisplayFormat.tsx"],"names":[],"mappings":";AACA,OAA0B,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE9E,QAAA,MAAM,yBAAyB,UAAW,cAAc,gCAKvD,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
1
+ {"version":3,"file":"TextareaWithDisplayFormat.d.ts","sourceRoot":"","sources":["../../../src/textareaWithDisplayFormat/TextareaWithDisplayFormat.js"],"names":[],"mappings":";AAIA,oFAEC"}
@@ -1,3 +1,2 @@
1
- export { default } from './TextareaWithDisplayFormat';
2
- export type { TextInputProps as TextareaWithDisplayFormatProps } from '../withDisplayFormat';
1
+ export { default } from "./TextareaWithDisplayFormat";
3
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/textareaWithDisplayFormat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,YAAY,EAAE,cAAc,IAAI,8BAA8B,EAAE,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/textareaWithDisplayFormat/index.js"],"names":[],"mappings":""}
@@ -1,63 +1,90 @@
1
- import { Component, KeyboardEvent, ClipboardEvent, ChangeEvent, FocusEvent } from 'react';
2
- import { HistoryNavigator } from '../common';
3
- import { InputProps } from '../inputs/Input';
4
- import { TextAreaProps } from '../inputs/TextArea';
5
- import { Merge } from '../utils';
6
- export type TextInputProps = Merge<InputProps, {
7
- value?: string;
8
- displayPattern: string;
9
- /**
10
- * autocomplete hides our form help so we need to disable it when help text
11
- * is present. Chrome ignores autocomplete=off, the only way to disable it is
12
- * to provide an 'invalid' value, for which 'disabled' serves.
13
- */
14
- autoComplete?: InputProps['autoComplete'] | 'disabled';
15
- onChange?: (value: string) => void;
16
- onBlur?: (value: string) => void;
17
- onFocus?: (value: string) => void;
18
- }>;
19
- export type Props = typeof WithDisplayFormat.defaultProps & {
20
- render: (renderProps: InputProps | TextAreaProps) => JSX.Element;
21
- } & TextInputProps;
22
- export type EventType = 'KeyDown' | 'Paste' | 'Cut' | 'Undo' | 'Redo' | 'Backspace' | 'Delete' | null;
23
- type State = {
24
- value: string;
25
- historyNavigator: HistoryNavigator;
26
- prevDisplayPattern?: string;
27
- triggerType?: EventType;
28
- triggerEvent?: KeyboardEvent<HTMLInputElement> | null;
29
- pastedLength?: number;
30
- selectionStart?: HTMLInputElement['selectionStart'];
31
- selectionEnd?: HTMLInputElement['selectionEnd'];
32
- };
33
- declare class WithDisplayFormat extends Component<Props, State> {
34
- static defaultProps: {
35
- autoComplete: string;
36
- displayPattern: string;
37
- type: string;
38
- value: string;
39
- };
40
- constructor(props: Props);
41
- static getDerivedStateFromProps({ displayPattern }: Props, { prevDisplayPattern, value, historyNavigator }: State): {
42
- prevDisplayPattern: string;
43
- value: string;
1
+ export default WithDisplayFormat;
2
+ declare class WithDisplayFormat extends Component<any, any, any> {
3
+ static getDerivedStateFromProps(nextProps: any, previousState: any): {
4
+ prevDisplayPattern: any;
5
+ value: any;
44
6
  triggerType: null;
45
7
  triggerEvent: null;
46
8
  pastedLength: number;
47
9
  } | null;
48
- getUserAction: (unformattedValue: string) => EventType;
10
+ constructor(props: any);
11
+ state: {
12
+ value: any;
13
+ historyNavigator: HistoryNavigator;
14
+ prevDisplayPattern: any;
15
+ triggerType: null;
16
+ triggerEvent: null;
17
+ };
18
+ getUserAction: (unformattedValue: any) => any;
49
19
  resetEvent: () => void;
50
- detectUndoRedo: (event: KeyboardEvent<HTMLInputElement>) => "Undo" | "Redo" | null;
51
- handleOnKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void;
52
- handleOnPaste: (event: ClipboardEvent<HTMLInputElement>) => void;
20
+ detectUndoRedo: (event: any) => "Redo" | "Undo" | null;
21
+ handleOnKeyDown: (event: any) => void;
22
+ handleOnPaste: (event: any) => void;
53
23
  handleOnCut: () => void;
54
- isKeyAllowed: (action: EventType) => boolean;
55
- handleOnChange: (event: ChangeEvent<HTMLInputElement>) => void;
56
- handleOnBlur: (event: FocusEvent<HTMLInputElement>) => void;
57
- handleOnFocus: (event: FocusEvent<HTMLInputElement>) => void;
58
- handleDelete: (unformattedValue: string, action: EventType) => string;
59
- handleCursorPositioning: (action: EventType) => void;
60
- render(): JSX.Element;
24
+ isKeyAllowed: (action: any) => boolean;
25
+ handleOnChange: (event: any) => void;
26
+ handleOnBlur: (event: any) => void;
27
+ handleOnFocus: (event: any) => void;
28
+ handleDelete: (unformattedValue: any, action: any) => string;
29
+ handleCursorPositioning: (action: any) => void;
30
+ render(): any;
61
31
  }
62
- export default WithDisplayFormat;
32
+ declare namespace WithDisplayFormat {
33
+ namespace propTypes {
34
+ const autoComplete: any;
35
+ const className: any;
36
+ const disabled: any;
37
+ const id: any;
38
+ const maxLength: any;
39
+ const minLength: any;
40
+ const name: any;
41
+ const onFocus: any;
42
+ const onBlur: any;
43
+ const onChange: any;
44
+ const placeholder: any;
45
+ const readOnly: any;
46
+ const render: any;
47
+ const required: any;
48
+ const displayPattern: any;
49
+ const type: any;
50
+ const inputMode: any;
51
+ const value: any;
52
+ }
53
+ namespace defaultProps {
54
+ const autoComplete_1: string;
55
+ export { autoComplete_1 as autoComplete };
56
+ const className_1: null;
57
+ export { className_1 as className };
58
+ const disabled_1: boolean;
59
+ export { disabled_1 as disabled };
60
+ const id_1: null;
61
+ export { id_1 as id };
62
+ const maxLength_1: null;
63
+ export { maxLength_1 as maxLength };
64
+ const minLength_1: null;
65
+ export { minLength_1 as minLength };
66
+ const name_1: null;
67
+ export { name_1 as name };
68
+ const placeholder_1: null;
69
+ export { placeholder_1 as placeholder };
70
+ const readOnly_1: boolean;
71
+ export { readOnly_1 as readOnly };
72
+ const required_1: boolean;
73
+ export { required_1 as required };
74
+ const displayPattern_1: string;
75
+ export { displayPattern_1 as displayPattern };
76
+ const type_1: string;
77
+ export { type_1 as type };
78
+ const inputMode_1: null;
79
+ export { inputMode_1 as inputMode };
80
+ const value_1: string;
81
+ export { value_1 as value };
82
+ const onFocus_1: null;
83
+ export { onFocus_1 as onFocus };
84
+ const onBlur_1: null;
85
+ export { onBlur_1 as onBlur };
86
+ }
87
+ }
88
+ import { Component } from "react";
89
+ import { HistoryNavigator } from "../common";
63
90
  //# sourceMappingURL=WithDisplayFormat.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WithDisplayFormat.d.ts","sourceRoot":"","sources":["../../../src/withDisplayFormat/WithDisplayFormat.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE1F,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAS7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,MAAM,MAAM,cAAc,GAAG,KAAK,CAChC,UAAU,EACV;IACE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,YAAY,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,GAAG,UAAU,CAAC;IACvD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC,CACF,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,iBAAiB,CAAC,YAAY,GAAG;IAC1D,MAAM,EAAE,CAAC,WAAW,EAAE,UAAU,GAAG,aAAa,KAAK,GAAG,CAAC,OAAO,CAAC;CAClE,GAAG,cAAc,CAAC;AAEnB,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,OAAO,GACP,KAAK,GACL,MAAM,GACN,MAAM,GACN,WAAW,GACX,QAAQ,GACR,IAAI,CAAC;AAET,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,YAAY,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IACpD,YAAY,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;CACjD,CAAC;AAEF,cAAM,iBAAkB,SAAQ,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC;IACrD,MAAM,CAAC,YAAY;;;;;MAKjB;gBAEU,KAAK,EAAE,KAAK;IAYxB,MAAM,CAAC,wBAAwB,CAC7B,EAAE,cAAc,EAAE,EAAE,KAAK,EACzB,EAAE,kBAAmC,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE,KAAK;;;;;;;IAiBzE,aAAa,qBAAsB,MAAM,KAAG,SAAS,CA+BnD;IAEF,UAAU,aAMR;IAEF,cAAc,UAAW,cAAc,gBAAgB,CAAC,4BAMtD;IAEF,eAAe,UAAW,cAAc,gBAAgB,CAAC,UAuBvD;IAEF,aAAa,UAAW,eAAe,gBAAgB,CAAC,UAQtD;IAEF,WAAW,aAET;IAEF,YAAY,WAAY,SAAS,aAK/B;IAEF,cAAc,UAAW,YAAY,gBAAgB,CAAC,UA0BpD;IAEF,YAAY,UAAW,WAAW,gBAAgB,CAAC,UAEjD;IAEF,aAAa,UAAW,WAAW,gBAAgB,CAAC,UAMlD;IAEF,YAAY,qBAAsB,MAAM,UAAU,SAAS,YAwBzD;IAEF,uBAAuB,WAAY,SAAS,UAkB1C;IAEF,MAAM;CAuCP;AAED,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"WithDisplayFormat.d.ts","sourceRoot":"","sources":["../../../src/withDisplayFormat/WithDisplayFormat.js"],"names":[],"mappings":";AAaA;IAcE;;;;;;aAkBC;IA/BD,wBAWC;IAPC;;;;;;MAMC;IAuBH,8CA0BE;IAEF,uBAME;IAEF,uDAME;IAEF,sCAuBE;IAEF,oCAQE;IAEF,wBAEE;IAEF,uCAKE;IAEF,qCA0BE;IAEF,mCAKE;IAEF,oCAME;IAEF,6DAuBE;IAEF,+CAkBE;IAEF,cAsCC;CACF"}
@@ -1,3 +1,2 @@
1
- export { default } from './WithDisplayFormat';
2
- export type { Props as WithDisplayFormatProps, TextInputProps } from './WithDisplayFormat';
1
+ export { default } from "./WithDisplayFormat";
3
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/withDisplayFormat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,YAAY,EAAE,KAAK,IAAI,sBAAsB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/withDisplayFormat/index.js"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "0.0.0-experimental-778ee44",
3
+ "version": "0.0.0-experimental-ae2a4e7",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -24,8 +24,6 @@ describe('locale utils', () => {
24
24
  ['zh_HK', 'zh'],
25
25
  ['ja-JP', 'ja'],
26
26
  ['zhHK', null],
27
- [null, null],
28
- [undefined, null],
29
27
  ['', null],
30
28
  [' ', null],
31
29
  ['ar-dz', null],
@@ -51,8 +49,6 @@ describe('locale utils', () => {
51
49
  ['zh_HK', 'zh-HK'],
52
50
  ['ja-JP', 'ja-JP'],
53
51
  ['zhHK', null],
54
- [null, null],
55
- [undefined, null],
56
52
  ['', null],
57
53
  [' ', null],
58
54
  ['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
+ }
@@ -1,7 +1,6 @@
1
1
  import getSymbolsInPatternWithPosition from '../getSymbolsInPatternWithPosition';
2
- import type { SymbolWithPosition } from '../getSymbolsInPatternWithPosition/getSymbolsInPatternWithPosition';
3
2
 
4
- const formatWithPattern = (value: string, pattern: string): string => {
3
+ const formatWithPattern = (value, pattern) => {
5
4
  if (!value || value === '') {
6
5
  return '';
7
6
  }
@@ -10,16 +9,13 @@ const formatWithPattern = (value: string, pattern: string): string => {
10
9
 
11
10
  const patternWithSymbolsPosition = getSymbolsInPatternWithPosition(pattern);
12
11
 
13
- let patternSymbol: SymbolWithPosition[] = [];
12
+ let patternSymbol = [];
14
13
  // valueArray.length increments during the cycle cause we are adding new elements.
15
14
  for (let index = 0; index < valueArray.length; index += 1) {
16
- patternSymbol = patternWithSymbolsPosition.filter((pattern) => pattern.index === index);
15
+ patternSymbol = patternWithSymbolsPosition.filter((symbol) => symbol.index === index);
17
16
  // Add pattern's symbol at n position
18
17
  if (patternSymbol.length === 1) {
19
- const last = patternSymbol.pop();
20
- if (last) {
21
- valueArray.splice(index, 0, last.symbol);
22
- }
18
+ valueArray.splice(index, 0, patternSymbol.pop().symbol);
23
19
  }
24
20
  }
25
21
 
@@ -1,14 +1,13 @@
1
- import type { EventType } from '../../../withDisplayFormat/WithDisplayFormat';
2
1
  import getCountOfSymbolsInSelection from '../getCountOfSymbolsInSelection';
3
2
  import { getDistanceToNextSymbol, getDistanceToPreviousSymbol } from '../getDistanceToSymbol';
4
3
 
5
- const getCursorPositionAfterActionStroke = (
6
- action: EventType,
7
- selectionStart: number,
8
- selectionEnd: number,
9
- pattern: string,
10
- pastedLength: number,
11
- ): number => {
4
+ const getCursorPositionAfteractionstroke = (
5
+ action,
6
+ selectionStart,
7
+ selectionEnd,
8
+ pattern,
9
+ pastedLength,
10
+ ) => {
12
11
  let cursorPosition = selectionStart;
13
12
 
14
13
  switch (action) {
@@ -39,4 +38,4 @@ const getCursorPositionAfterActionStroke = (
39
38
  return cursorPosition;
40
39
  };
41
40
 
42
- export default getCursorPositionAfterActionStroke;
41
+ export default getCursorPositionAfteractionstroke;
@@ -1,10 +1,5 @@
1
- export type SymbolWithPosition = {
2
- index: number;
3
- symbol: string;
4
- };
5
-
6
- const getSymbolsInPatternWithPosition = (pattern: string): SymbolWithPosition[] => {
7
- const patternWithSymbolsPosition: SymbolWithPosition[] = [];
1
+ const getSymbolsInPatternWithPosition = (pattern) => {
2
+ const patternWithSymbolsPosition = [];
8
3
  const patternArray = pattern.split('');
9
4
  patternArray.forEach((symbol, index) => {
10
5
  if (symbol !== '*') {
@@ -1,4 +1,4 @@
1
- const unformatWithPattern = (value: string, pattern: string): string => {
1
+ const unformatWithPattern = (value, pattern) => {
2
2
  let valueArray = [''];
3
3
  if (value && value.length > 0) {
4
4
  valueArray = value.toString().split('');
@@ -8,7 +8,6 @@ const unformatWithPattern = (value: string, pattern: string): string => {
8
8
  return valueArray.join('');
9
9
  };
10
10
 
11
- const getSymbolsInPattern = (pattern: string): string[] =>
12
- pattern.split('').filter((symbol) => symbol !== '*');
11
+ const getSymbolsInPattern = (pattern) => pattern.split('').filter((symbol) => symbol !== '*');
13
12
 
14
13
  export default unformatWithPattern;
package/src/index.ts CHANGED
@@ -2,7 +2,6 @@
2
2
  * Types
3
3
  */
4
4
  export type { InputProps } from './inputs/Input';
5
- export type { InputWithDisplayFormatProps } from './inputWithDisplayFormat';
6
5
  export type { InputGroupProps } from './inputs/InputGroup';
7
6
  export type { SearchInputProps } from './inputs/SearchInput';
8
7
  export type {
@@ -15,7 +14,6 @@ export type {
15
14
  SelectInputTriggerButtonProps,
16
15
  } from './inputs/SelectInput';
17
16
  export type { TextAreaProps } from './inputs/TextArea';
18
- export type { TextareaWithDisplayFormatProps } from './textareaWithDisplayFormat';
19
17
  export type { UploadedFile, UploadError, UploadResponse } from './uploadInput/types';
20
18
  export type { ModalProps } from './modal';
21
19
  export type {
@@ -0,0 +1,14 @@
1
+ import PropTypes from 'prop-types';
2
+
3
+ import WithDisplayFormat from '../withDisplayFormat';
4
+
5
+ const InputWithDisplayFormat = (props) => (
6
+ <WithDisplayFormat {...props} render={(renderProps) => <input {...renderProps} />} />
7
+ );
8
+
9
+ InputWithDisplayFormat.propTypes = {
10
+ displayPattern: PropTypes.string.isRequired,
11
+ onChange: PropTypes.func.isRequired,
12
+ };
13
+
14
+ export default InputWithDisplayFormat;
@@ -0,0 +1 @@
1
+ export { default } from './InputWithDisplayFormat';
@@ -1,16 +1,21 @@
1
1
  import classNames from 'classnames';
2
- import { InputHTMLAttributes, forwardRef } from 'react';
2
+ import { forwardRef } from 'react';
3
3
 
4
4
  import { SizeLarge, SizeMedium, SizeSmall } from '../common';
5
+ import { Merge } from '../utils';
5
6
 
6
7
  import { useInputPaddings } from './InputGroup';
7
8
  import { formControlClassNameBase } from './_common';
8
9
 
9
- export type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> & {
10
- size?: 'auto' | SizeSmall | SizeMedium | SizeLarge;
11
- shape?: 'rectangle' | 'pill';
12
- 'aria-invalid'?: boolean;
13
- };
10
+ export interface InputProps
11
+ extends Merge<
12
+ React.ComponentPropsWithRef<'input'>,
13
+ {
14
+ size?: 'auto' | SizeSmall | SizeMedium | SizeLarge;
15
+ shape?: 'rectangle' | 'pill';
16
+ 'aria-invalid'?: boolean;
17
+ }
18
+ > {}
14
19
 
15
20
  export const Input = forwardRef(function Input(
16
21
  { size = 'auto', shape = 'rectangle', className, ...restProps }: InputProps,
@@ -37,11 +37,7 @@ describe('Given a telephone number component', () => {
37
37
  });
38
38
 
39
39
  it('should set prefix control to default UK value', () => {
40
- expect(select.props().value).toStrictEqual({
41
- value: '+44',
42
- note: 'GBR, GGY, IMN, JEY',
43
- label: '+44',
44
- });
40
+ expect(select.props().value).toBe('+44');
45
41
  });
46
42
 
47
43
  it('should set number control to empty', () => {
@@ -49,11 +45,11 @@ describe('Given a telephone number component', () => {
49
45
  });
50
46
 
51
47
  it('should not disable the select', () => {
52
- expect(select.prop('disabled')).toBe(false);
48
+ expect(select.prop('disabled')).toBeFalsy();
53
49
  });
54
50
 
55
51
  it('should not disable the input', () => {
56
- expect(input.prop('disabled')).toBe(false);
52
+ expect(input.prop('disabled')).toBeFalsy();
57
53
  });
58
54
  });
59
55
 
@@ -65,7 +61,7 @@ describe('Given a telephone number component', () => {
65
61
  });
66
62
 
67
63
  it('should set control values correctly', () => {
68
- expect(select.props().value.value).toStrictEqual('+39');
64
+ expect(select.props().value).toBe('+39');
69
65
  expect(input.prop('value')).toBe('123456789');
70
66
  });
71
67
  });
@@ -92,8 +88,8 @@ describe('Given a telephone number component', () => {
92
88
  input = component.find(NUMBER_SELECTOR);
93
89
  });
94
90
 
95
- it('should render input with null id', () => {
96
- expect(input.prop('id')).toBeNull();
91
+ it('should render input with unspecified id', () => {
92
+ expect(input.prop('id')).toBeUndefined();
97
93
  });
98
94
  });
99
95
 
@@ -118,7 +114,7 @@ describe('Given a telephone number component', () => {
118
114
  it(`${number} code should update the value properly`, () => {
119
115
  simulatePaste(component.find('input'), number);
120
116
 
121
- expect(select().props().value.value).toStrictEqual(countryCode);
117
+ expect(select().props().value).toBe(countryCode);
122
118
  expect(input().prop('value')).toBe(localNumber);
123
119
  expect(props.onChange).toHaveBeenCalledWith(number.replace(/(\s|-)+/g, ''), countryCode);
124
120
  });
@@ -126,28 +122,28 @@ describe('Given a telephone number component', () => {
126
122
 
127
123
  it('should not paste invalid characters', () => {
128
124
  simulatePaste(component.find('input'), '+36asdasdasd');
129
- expect(select().props().value.value).toStrictEqual('+39');
125
+ expect(select().props().value).toBe('+39');
130
126
  expect(input().prop('value')).toBe('123456789');
131
127
  expect(props.onChange).not.toHaveBeenCalled();
132
128
  });
133
129
 
134
130
  it('should not paste countries which are not in the select', () => {
135
131
  simulatePaste(component.find('input'), '+9992342343423');
136
- expect(select().props().value.value).toStrictEqual('+39');
132
+ expect(select().props().value).toBe('+39');
137
133
  expect(input().prop('value')).toBe('123456789');
138
134
  expect(props.onChange).not.toHaveBeenCalled();
139
135
  });
140
136
 
141
137
  it("should not paste numbers which doesn't start with the country code", () => {
142
138
  simulatePaste(component.find('input'), '0+36303932551');
143
- expect(select().props().value.value).toStrictEqual('+39');
139
+ expect(select().props().value).toBe('+39');
144
140
  expect(input().prop('value')).toBe('123456789');
145
141
  expect(props.onChange).not.toHaveBeenCalled();
146
142
  });
147
143
 
148
144
  it("should not paste numbers which doesn't contain a country code", () => {
149
145
  simulatePaste(component.find('input'), '06303932551');
150
- expect(select().props().value.value).toStrictEqual('+39');
146
+ expect(select().props().value).toBe('+39');
151
147
  expect(input().prop('value')).toBe('123456789');
152
148
  expect(props.onChange).not.toHaveBeenCalled();
153
149
  });
@@ -161,7 +157,7 @@ describe('Given a telephone number component', () => {
161
157
  });
162
158
 
163
159
  it('should set the select to the longest matching prefix', () => {
164
- expect(select.props().value.value).toStrictEqual('+1868');
160
+ expect(select.props().value).toBe('+1868');
165
161
  });
166
162
 
167
163
  it('should set the number input to the rest of the number', () => {
@@ -177,7 +173,7 @@ describe('Given a telephone number component', () => {
177
173
  });
178
174
 
179
175
  it('should empty the select', () => {
180
- expect(select.props().value).toBeUndefined();
176
+ expect(select.props().value).toBeNull();
181
177
  });
182
178
 
183
179
  it('should put the whole value in the input without the plus', () => {
@@ -191,7 +187,7 @@ describe('Given a telephone number component', () => {
191
187
  select = component.find(PREFIX_SELECT_SELECTOR);
192
188
  input = component.find(NUMBER_SELECTOR);
193
189
 
194
- expect(select.props().value.value).toStrictEqual('+44');
190
+ expect(select.props().value).toBe('+44');
195
191
  expect(input.prop('value')).toBe('');
196
192
  });
197
193
  });
@@ -254,7 +250,7 @@ describe('Given a telephone number component', () => {
254
250
  });
255
251
 
256
252
  it('should use the prefix of the supplied value', () => {
257
- expect(select.props().value.value).toBe('+1');
253
+ expect(select.props().value).toBe('+1');
258
254
  });
259
255
  });
260
256
 
@@ -268,7 +264,7 @@ describe('Given a telephone number component', () => {
268
264
  });
269
265
 
270
266
  it('should default the prefix to the local country', () => {
271
- expect(select.props().value.value).toBe('+34');
267
+ expect(select.props().value).toBe('+34');
272
268
  });
273
269
  });
274
270
 
@@ -281,7 +277,7 @@ describe('Given a telephone number component', () => {
281
277
  });
282
278
 
283
279
  it('should override locale prefix with country specific prefix', () => {
284
- expect(select.props().value.value).toBe('+1');
280
+ expect(select.props().value).toBe('+1');
285
281
  });
286
282
  });
287
283
  });
@@ -349,7 +345,7 @@ describe('Given a telephone number component', () => {
349
345
 
350
346
  it('renders Select component with expected props', () => {
351
347
  const select = component.find(PREFIX_SELECT_SELECTOR);
352
- expect(select.prop('className')).toStrictEqual('custom-class');
348
+ expect(select.prop('className')).toBe('custom-class');
353
349
  });
354
350
  });
355
351
  });